partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | project_get | Return a specific projects (keystone project-get)
Overrides keystone tenant-get form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
project_id
The project id.
name
The project name.
profile
Configuration profile - if configuration for multiple openstack... | salt/modules/keystone.py | def project_get(project_id=None, name=None, profile=None, **connection_args):
'''
Return a specific projects (keystone project-get)
Overrides keystone tenant-get form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
project_id
The project id.
name
The project ... | def project_get(project_id=None, name=None, profile=None, **connection_args):
'''
Return a specific projects (keystone project-get)
Overrides keystone tenant-get form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
project_id
The project id.
name
The project ... | [
"Return",
"a",
"specific",
"projects",
"(",
"keystone",
"project",
"-",
"get",
")",
"Overrides",
"keystone",
"tenant",
"-",
"get",
"form",
"api",
"V2",
".",
"For",
"keystone",
"api",
"V3",
"only",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L751-L781 | [
"def",
"project_get",
"(",
"project_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"if",
"_OS_IDENTITY_API_VERSION",
">",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tenant_list | Return a list of available tenants (keystone tenants-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.tenant_list | salt/modules/keystone.py | def tenant_list(profile=None, **connection_args):
'''
Return a list of available tenants (keystone tenants-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.tenant_list
'''
kstone = auth(profile, **connection_args)
ret = {}
for tenant in getattr(kstone, _TENANTS, None... | def tenant_list(profile=None, **connection_args):
'''
Return a list of available tenants (keystone tenants-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.tenant_list
'''
kstone = auth(profile, **connection_args)
ret = {}
for tenant in getattr(kstone, _TENANTS, None... | [
"Return",
"a",
"list",
"of",
"available",
"tenants",
"(",
"keystone",
"tenants",
"-",
"list",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L784-L801 | [
"def",
"tenant_list",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"ret",
"=",
"{",
"}",
"for",
"tenant",
"in",
"getattr",
"(",
"kstone",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | project_list | Return a list of available projects (keystone projects-list).
Overrides keystone tenants-list form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
profile
Configuration profile - if configuration for multiple openstack accounts required.
CLI Example:
.. code-block:: bas... | salt/modules/keystone.py | def project_list(profile=None, **connection_args):
'''
Return a list of available projects (keystone projects-list).
Overrides keystone tenants-list form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
profile
Configuration profile - if configuration for multiple openstac... | def project_list(profile=None, **connection_args):
'''
Return a list of available projects (keystone projects-list).
Overrides keystone tenants-list form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
profile
Configuration profile - if configuration for multiple openstac... | [
"Return",
"a",
"list",
"of",
"available",
"projects",
"(",
"keystone",
"projects",
"-",
"list",
")",
".",
"Overrides",
"keystone",
"tenants",
"-",
"list",
"form",
"api",
"V2",
".",
"For",
"keystone",
"api",
"V3",
"only",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L804-L826 | [
"def",
"project_list",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"if",
"_OS_IDENTITY_API_VERSION",
">",
"2",
":",
"return",
"tenant_list",
"(",
"profile",
",",
"*... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tenant_update | Update a tenant's information (keystone tenant-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
CLI Examples:
.. code-block:: bash
salt '*' keystone.tenant_update name=admin enabled=True
salt '*' keystone.tenant_update c9... | salt/modules/keystone.py | def tenant_update(tenant_id=None, name=None, description=None,
enabled=None, profile=None, **connection_args):
'''
Update a tenant's information (keystone tenant-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
CLI Ex... | def tenant_update(tenant_id=None, name=None, description=None,
enabled=None, profile=None, **connection_args):
'''
Update a tenant's information (keystone tenant-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
CLI Ex... | [
"Update",
"a",
"tenant",
"s",
"information",
"(",
"keystone",
"tenant",
"-",
"update",
")",
"The",
"following",
"fields",
"may",
"be",
"updated",
":",
"name",
"description",
"enabled",
".",
"Can",
"only",
"update",
"name",
"if",
"targeting",
"by",
"ID"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L829-L864 | [
"def",
"tenant_update",
"(",
"tenant_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | project_update | Update a tenant's information (keystone project-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
Overrides keystone tenant_update form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
project_id
The project i... | salt/modules/keystone.py | def project_update(project_id=None, name=None, description=None,
enabled=None, profile=None, **connection_args):
'''
Update a tenant's information (keystone project-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
Ov... | def project_update(project_id=None, name=None, description=None,
enabled=None, profile=None, **connection_args):
'''
Update a tenant's information (keystone project-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
Ov... | [
"Update",
"a",
"tenant",
"s",
"information",
"(",
"keystone",
"project",
"-",
"update",
")",
"The",
"following",
"fields",
"may",
"be",
"updated",
":",
"name",
"description",
"enabled",
".",
"Can",
"only",
"update",
"name",
"if",
"targeting",
"by",
"ID"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L867-L907 | [
"def",
"project_update",
"(",
"project_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"auth",
"(",
"profile",
",",
"*",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | token_get | Return the configured tokens (keystone token-get)
CLI Example:
.. code-block:: bash
salt '*' keystone.token_get c965f79c4f864eaaa9c3b41904e67082 | salt/modules/keystone.py | def token_get(profile=None, **connection_args):
'''
Return the configured tokens (keystone token-get)
CLI Example:
.. code-block:: bash
salt '*' keystone.token_get c965f79c4f864eaaa9c3b41904e67082
'''
kstone = auth(profile, **connection_args)
token = kstone.service_catalog.get_tok... | def token_get(profile=None, **connection_args):
'''
Return the configured tokens (keystone token-get)
CLI Example:
.. code-block:: bash
salt '*' keystone.token_get c965f79c4f864eaaa9c3b41904e67082
'''
kstone = auth(profile, **connection_args)
token = kstone.service_catalog.get_tok... | [
"Return",
"the",
"configured",
"tokens",
"(",
"keystone",
"token",
"-",
"get",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L910-L925 | [
"def",
"token_get",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"token",
"=",
"kstone",
".",
"service_catalog",
".",
"get_token",
"(",
")",
"return... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_list | Return a list of available users (keystone user-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.user_list | salt/modules/keystone.py | def user_list(profile=None, **connection_args):
'''
Return a list of available users (keystone user-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.user_list
'''
kstone = auth(profile, **connection_args)
ret = {}
for user in kstone.users.list():
ret[user.name... | def user_list(profile=None, **connection_args):
'''
Return a list of available users (keystone user-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.user_list
'''
kstone = auth(profile, **connection_args)
ret = {}
for user in kstone.users.list():
ret[user.name... | [
"Return",
"a",
"list",
"of",
"available",
"users",
"(",
"keystone",
"user",
"-",
"list",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L928-L947 | [
"def",
"user_list",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"ret",
"=",
"{",
"}",
"for",
"user",
"in",
"kstone",
".",
"users",
".",
"list",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_get | Return a specific users (keystone user-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_get c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_get user_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_get name=nova | salt/modules/keystone.py | def user_get(user_id=None, name=None, profile=None, **connection_args):
'''
Return a specific users (keystone user-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_get c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_get user_id=c965f79c4f864eaaa9c3b41904e67082
... | def user_get(user_id=None, name=None, profile=None, **connection_args):
'''
Return a specific users (keystone user-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_get c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_get user_id=c965f79c4f864eaaa9c3b41904e67082
... | [
"Return",
"a",
"specific",
"users",
"(",
"keystone",
"user",
"-",
"get",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L950-L985 | [
"def",
"user_get",
"(",
"user_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"ret",
"=",
"{",
"}",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_create | Create a user (keystone user-create)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_create name=jack password=zero email=jack@halloweentown.org \
tenant_id=a28a7b5a999a455f84b1f5210264375e enabled=True | salt/modules/keystone.py | def user_create(name, password, email, tenant_id=None,
enabled=True, profile=None, project_id=None, description=None, **connection_args):
'''
Create a user (keystone user-create)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_create name=jack password=zero email=jac... | def user_create(name, password, email, tenant_id=None,
enabled=True, profile=None, project_id=None, description=None, **connection_args):
'''
Create a user (keystone user-create)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_create name=jack password=zero email=jac... | [
"Create",
"a",
"user",
"(",
"keystone",
"user",
"-",
"create",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L988-L1017 | [
"def",
"user_create",
"(",
"name",
",",
"password",
",",
"email",
",",
"tenant_id",
"=",
"None",
",",
"enabled",
"=",
"True",
",",
"profile",
"=",
"None",
",",
"project_id",
"=",
"None",
",",
"description",
"=",
"None",
",",
"*",
"*",
"connection_args",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_delete | Delete a user (keystone user-delete)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_delete c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_delete user_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_delete name=nova | salt/modules/keystone.py | def user_delete(user_id=None, name=None, profile=None, **connection_args):
'''
Delete a user (keystone user-delete)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_delete c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_delete user_id=c965f79c4f864eaaa9c3b41904e67082
... | def user_delete(user_id=None, name=None, profile=None, **connection_args):
'''
Delete a user (keystone user-delete)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_delete c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_delete user_id=c965f79c4f864eaaa9c3b41904e67082
... | [
"Delete",
"a",
"user",
"(",
"keystone",
"user",
"-",
"delete",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L1020-L1045 | [
"def",
"user_delete",
"(",
"user_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"if",
"name",
":",
"fo... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_update | Update a user's information (keystone user-update)
The following fields may be updated: name, email, enabled, tenant.
Because the name is one of the fields, a valid user id is required.
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_update user_id=c965f79c4f864eaaa9c3b41904e67082 n... | salt/modules/keystone.py | def user_update(user_id=None, name=None, email=None, enabled=None,
tenant=None, profile=None, project=None, description=None, **connection_args):
'''
Update a user's information (keystone user-update)
The following fields may be updated: name, email, enabled, tenant.
Because the name is ... | def user_update(user_id=None, name=None, email=None, enabled=None,
tenant=None, profile=None, project=None, description=None, **connection_args):
'''
Update a user's information (keystone user-update)
The following fields may be updated: name, email, enabled, tenant.
Because the name is ... | [
"Update",
"a",
"user",
"s",
"information",
"(",
"keystone",
"user",
"-",
"update",
")",
"The",
"following",
"fields",
"may",
"be",
"updated",
":",
"name",
"email",
"enabled",
"tenant",
".",
"Because",
"the",
"name",
"is",
"one",
"of",
"the",
"fields",
"a... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L1048-L1109 | [
"def",
"user_update",
"(",
"user_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"email",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"tenant",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"project",
"=",
"None",
",",
"description",
"=",
"None"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_verify_password | Verify a user's password
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_verify_password name=test password=foobar
salt '*' keystone.user_verify_password user_id=c965f79c4f864eaaa9c3b41904e67082 password=foobar | salt/modules/keystone.py | def user_verify_password(user_id=None, name=None, password=None,
profile=None, **connection_args):
'''
Verify a user's password
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_verify_password name=test password=foobar
salt '*' keystone.user_verify_pa... | def user_verify_password(user_id=None, name=None, password=None,
profile=None, **connection_args):
'''
Verify a user's password
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_verify_password name=test password=foobar
salt '*' keystone.user_verify_pa... | [
"Verify",
"a",
"user",
"s",
"password"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L1112-L1157 | [
"def",
"user_verify_password",
"(",
"user_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"password",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connecti... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_password_update | Update a user's password (keystone user-password-update)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_password_update c965f79c4f864eaaa9c3b41904e67082 password=12345
salt '*' keystone.user_password_update user_id=c965f79c4f864eaaa9c3b41904e67082 password=12345
salt '*' ke... | salt/modules/keystone.py | def user_password_update(user_id=None, name=None, password=None,
profile=None, **connection_args):
'''
Update a user's password (keystone user-password-update)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_password_update c965f79c4f864eaaa9c3b41904e67082 p... | def user_password_update(user_id=None, name=None, password=None,
profile=None, **connection_args):
'''
Update a user's password (keystone user-password-update)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_password_update c965f79c4f864eaaa9c3b41904e67082 p... | [
"Update",
"a",
"user",
"s",
"password",
"(",
"keystone",
"user",
"-",
"password",
"-",
"update",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L1160-L1189 | [
"def",
"user_password_update",
"(",
"user_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"password",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connecti... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_role_add | Add role for user in tenant (keystone user-role-add)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_role_add \
user_id=298ce377245c4ec9b70e1c639c89e654 \
tenant_id=7167a092ece84bae8cead4bf9d15bb3b \
role_id=ce377245c4ec9b70e1c639c89e8cead4
salt '*' keystone.user_role_add user=admin... | salt/modules/keystone.py | def user_role_add(user_id=None, user=None, tenant_id=None,
tenant=None, role_id=None, role=None, profile=None,
project_id=None, project_name=None, **connection_args):
'''
Add role for user in tenant (keystone user-role-add)
CLI Examples:
.. code-block:: bash
... | def user_role_add(user_id=None, user=None, tenant_id=None,
tenant=None, role_id=None, role=None, profile=None,
project_id=None, project_name=None, **connection_args):
'''
Add role for user in tenant (keystone user-role-add)
CLI Examples:
.. code-block:: bash
... | [
"Add",
"role",
"for",
"user",
"in",
"tenant",
"(",
"keystone",
"user",
"-",
"role",
"-",
"add",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L1192-L1247 | [
"def",
"user_role_add",
"(",
"user_id",
"=",
"None",
",",
"user",
"=",
"None",
",",
"tenant_id",
"=",
"None",
",",
"tenant",
"=",
"None",
",",
"role_id",
"=",
"None",
",",
"role",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"project_id",
"=",
"Non... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | user_role_list | Return a list of available user_roles (keystone user-roles-list)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_role_list \
user_id=298ce377245c4ec9b70e1c639c89e654 \
tenant_id=7167a092ece84bae8cead4bf9d15bb3b
salt '*' keystone.user_role_list user_name=admin tenant_name=admin | salt/modules/keystone.py | def user_role_list(user_id=None, tenant_id=None, user_name=None,
tenant_name=None, profile=None, project_id=None, project_name=None, **connection_args):
'''
Return a list of available user_roles (keystone user-roles-list)
CLI Examples:
.. code-block:: bash
salt '*' keystone... | def user_role_list(user_id=None, tenant_id=None, user_name=None,
tenant_name=None, profile=None, project_id=None, project_name=None, **connection_args):
'''
Return a list of available user_roles (keystone user-roles-list)
CLI Examples:
.. code-block:: bash
salt '*' keystone... | [
"Return",
"a",
"list",
"of",
"available",
"user_roles",
"(",
"keystone",
"user",
"-",
"roles",
"-",
"list",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L1307-L1353 | [
"def",
"user_role_list",
"(",
"user_id",
"=",
"None",
",",
"tenant_id",
"=",
"None",
",",
"user_name",
"=",
"None",
",",
"tenant_name",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"project_id",
"=",
"None",
",",
"project_name",
"=",
"None",
",",
"*",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _item_list | Template for writing list functions
Return a list of available items (keystone items-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.item_list | salt/modules/keystone.py | def _item_list(profile=None, **connection_args):
'''
Template for writing list functions
Return a list of available items (keystone items-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.item_list
'''
kstone = auth(profile, **connection_args)
ret = []
for item in ... | def _item_list(profile=None, **connection_args):
'''
Template for writing list functions
Return a list of available items (keystone items-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.item_list
'''
kstone = auth(profile, **connection_args)
ret = []
for item in ... | [
"Template",
"for",
"writing",
"list",
"functions",
"Return",
"a",
"list",
"of",
"available",
"items",
"(",
"keystone",
"items",
"-",
"list",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystone.py#L1356-L1375 | [
"def",
"_item_list",
"(",
"profile",
"=",
"None",
",",
"*",
"*",
"connection_args",
")",
":",
"kstone",
"=",
"auth",
"(",
"profile",
",",
"*",
"*",
"connection_args",
")",
"ret",
"=",
"[",
"]",
"for",
"item",
"in",
"kstone",
".",
"items",
".",
"list"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_ssh_config_file | :return: Path to the .ssh/config file - usually <home>/.ssh/config | salt/roster/sshconfig.py | def _get_ssh_config_file(opts):
'''
:return: Path to the .ssh/config file - usually <home>/.ssh/config
'''
ssh_config_file = opts.get('ssh_config_file')
if not os.path.isfile(ssh_config_file):
raise IOError('Cannot find SSH config file')
if not os.access(ssh_config_file, os.R_OK):
... | def _get_ssh_config_file(opts):
'''
:return: Path to the .ssh/config file - usually <home>/.ssh/config
'''
ssh_config_file = opts.get('ssh_config_file')
if not os.path.isfile(ssh_config_file):
raise IOError('Cannot find SSH config file')
if not os.access(ssh_config_file, os.R_OK):
... | [
":",
"return",
":",
"Path",
"to",
"the",
".",
"ssh",
"/",
"config",
"file",
"-",
"usually",
"<home",
">",
"/",
".",
"ssh",
"/",
"config"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/sshconfig.py#L33-L42 | [
"def",
"_get_ssh_config_file",
"(",
"opts",
")",
":",
"ssh_config_file",
"=",
"opts",
".",
"get",
"(",
"'ssh_config_file'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"ssh_config_file",
")",
":",
"raise",
"IOError",
"(",
"'Cannot find SSH config ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_ssh_config | Parses lines from the SSH config to create roster targets.
:param lines: Individual lines from the ssh config file
:return: Dictionary of targets in similar style to the flat roster | salt/roster/sshconfig.py | def parse_ssh_config(lines):
'''
Parses lines from the SSH config to create roster targets.
:param lines: Individual lines from the ssh config file
:return: Dictionary of targets in similar style to the flat roster
'''
# transform the list of individual lines into a list of sublists where each
... | def parse_ssh_config(lines):
'''
Parses lines from the SSH config to create roster targets.
:param lines: Individual lines from the ssh config file
:return: Dictionary of targets in similar style to the flat roster
'''
# transform the list of individual lines into a list of sublists where each
... | [
"Parses",
"lines",
"from",
"the",
"SSH",
"config",
"to",
"create",
"roster",
"targets",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/sshconfig.py#L45-L94 | [
"def",
"parse_ssh_config",
"(",
"lines",
")",
":",
"# transform the list of individual lines into a list of sublists where each",
"# sublist represents a single Host definition",
"hosts",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"line",
"=",
"salt",
".",
"utils",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | targets | Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster | salt/roster/sshconfig.py | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
ssh_config_file = _get_ssh_config_file(__opts__)
with salt.utils.files.fopen(ssh_config_file, 'r') as fp:
all_minions = parse_ssh_con... | def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
ssh_config_file = _get_ssh_config_file(__opts__)
with salt.utils.files.fopen(ssh_config_file, 'r') as fp:
all_minions = parse_ssh_con... | [
"Return",
"the",
"targets",
"from",
"the",
"flat",
"yaml",
"file",
"checks",
"opts",
"for",
"location",
"but",
"defaults",
"to",
"/",
"etc",
"/",
"salt",
"/",
"roster"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/sshconfig.py#L97-L107 | [
"def",
"targets",
"(",
"tgt",
",",
"tgt_type",
"=",
"'glob'",
",",
"*",
"*",
"kwargs",
")",
":",
"ssh_config_file",
"=",
"_get_ssh_config_file",
"(",
"__opts__",
")",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"ssh_config_file",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.ret_glob_minions | Return minions that match via glob | salt/roster/sshconfig.py | def ret_glob_minions(self):
'''
Return minions that match via glob
'''
minions = {}
for minion in self.raw:
if fnmatch.fnmatch(minion, self.tgt):
data = self.get_data(minion)
if data:
minions[minion] = data
r... | def ret_glob_minions(self):
'''
Return minions that match via glob
'''
minions = {}
for minion in self.raw:
if fnmatch.fnmatch(minion, self.tgt):
data = self.get_data(minion)
if data:
minions[minion] = data
r... | [
"Return",
"minions",
"that",
"match",
"via",
"glob"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/sshconfig.py#L128-L138 | [
"def",
"ret_glob_minions",
"(",
"self",
")",
":",
"minions",
"=",
"{",
"}",
"for",
"minion",
"in",
"self",
".",
"raw",
":",
"if",
"fnmatch",
".",
"fnmatch",
"(",
"minion",
",",
"self",
".",
"tgt",
")",
":",
"data",
"=",
"self",
".",
"get_data",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | RosterMatcher.get_data | Return the configured ip | salt/roster/sshconfig.py | def get_data(self, minion):
'''
Return the configured ip
'''
if isinstance(self.raw[minion], six.string_types):
return {'host': self.raw[minion]}
if isinstance(self.raw[minion], dict):
return self.raw[minion]
return False | def get_data(self, minion):
'''
Return the configured ip
'''
if isinstance(self.raw[minion], six.string_types):
return {'host': self.raw[minion]}
if isinstance(self.raw[minion], dict):
return self.raw[minion]
return False | [
"Return",
"the",
"configured",
"ip"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/sshconfig.py#L140-L148 | [
"def",
"get_data",
"(",
"self",
",",
"minion",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"raw",
"[",
"minion",
"]",
",",
"six",
".",
"string_types",
")",
":",
"return",
"{",
"'host'",
":",
"self",
".",
"raw",
"[",
"minion",
"]",
"}",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | SaltException.pack | Pack this exception into a serializable dictionary that is safe for
transport via msgpack | salt/exceptions.py | def pack(self):
'''
Pack this exception into a serializable dictionary that is safe for
transport via msgpack
'''
if six.PY3:
return {'message': six.text_type(self), 'args': self.args}
return dict(message=self.__unicode__(), args=self.args) | def pack(self):
'''
Pack this exception into a serializable dictionary that is safe for
transport via msgpack
'''
if six.PY3:
return {'message': six.text_type(self), 'args': self.args}
return dict(message=self.__unicode__(), args=self.args) | [
"Pack",
"this",
"exception",
"into",
"a",
"serializable",
"dictionary",
"that",
"is",
"safe",
"for",
"transport",
"via",
"msgpack"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/exceptions.py#L65-L72 | [
"def",
"pack",
"(",
"self",
")",
":",
"if",
"six",
".",
"PY3",
":",
"return",
"{",
"'message'",
":",
"six",
".",
"text_type",
"(",
"self",
")",
",",
"'args'",
":",
"self",
".",
"args",
"}",
"return",
"dict",
"(",
"message",
"=",
"self",
".",
"__u... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reactivate | Try to reactivate the expired domain name
Returns the following information:
- Whether or not the domain was reactivated successfully
- The amount charged for reactivation
- The order ID
- The transaction ID
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.re... | salt/modules/namecheap_domains.py | def reactivate(domain_name):
'''
Try to reactivate the expired domain name
Returns the following information:
- Whether or not the domain was reactivated successfully
- The amount charged for reactivation
- The order ID
- The transaction ID
CLI Example:
.. code-block:: bash
... | def reactivate(domain_name):
'''
Try to reactivate the expired domain name
Returns the following information:
- Whether or not the domain was reactivated successfully
- The amount charged for reactivation
- The order ID
- The transaction ID
CLI Example:
.. code-block:: bash
... | [
"Try",
"to",
"reactivate",
"the",
"expired",
"domain",
"name"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains.py#L54-L80 | [
"def",
"reactivate",
"(",
"domain_name",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.reactivate'",
")",
"opts",
"[",
"'DomainName'",
"]",
"=",
"domain_name",
"response_xml",
"=",
"salt",
".",
"utils"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | renew | Try to renew the specified expiring domain name for a specified number of years
domain_name
The domain name to be renewed
years
Number of years to renew
Returns the following information:
- Whether or not the domain was renewed successfully
- The domain ID
- The order ID
... | salt/modules/namecheap_domains.py | def renew(domain_name, years, promotion_code=None):
'''
Try to renew the specified expiring domain name for a specified number of years
domain_name
The domain name to be renewed
years
Number of years to renew
Returns the following information:
- Whether or not the domain was ... | def renew(domain_name, years, promotion_code=None):
'''
Try to renew the specified expiring domain name for a specified number of years
domain_name
The domain name to be renewed
years
Number of years to renew
Returns the following information:
- Whether or not the domain was ... | [
"Try",
"to",
"renew",
"the",
"specified",
"expiring",
"domain",
"name",
"for",
"a",
"specified",
"number",
"of",
"years"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains.py#L83-L120 | [
"def",
"renew",
"(",
"domain_name",
",",
"years",
",",
"promotion_code",
"=",
"None",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.renew'",
")",
"opts",
"[",
"'DomainName'",
"]",
"=",
"domain_name",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create | Try to register the specified domain name
domain_name
The domain name to be registered
years
Number of years to register
Returns the following information:
- Whether or not the domain was renewed successfully
- Whether or not WhoisGuard is enabled
- Whether or not registratio... | salt/modules/namecheap_domains.py | def create(domain_name, years, **kwargs):
'''
Try to register the specified domain name
domain_name
The domain name to be registered
years
Number of years to register
Returns the following information:
- Whether or not the domain was renewed successfully
- Whether or not ... | def create(domain_name, years, **kwargs):
'''
Try to register the specified domain name
domain_name
The domain name to be registered
years
Number of years to register
Returns the following information:
- Whether or not the domain was renewed successfully
- Whether or not ... | [
"Try",
"to",
"register",
"the",
"specified",
"domain",
"name"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains.py#L123-L209 | [
"def",
"create",
"(",
"domain_name",
",",
"years",
",",
"*",
"*",
"kwargs",
")",
":",
"idn_codes",
"=",
"(",
"'afr'",
",",
"'alb'",
",",
"'ara'",
",",
"'arg'",
",",
"'arm'",
",",
"'asm'",
",",
"'ast'",
",",
"'ave'",
",",
"'awa'",
",",
"'aze'",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check | Checks the availability of domains
domains_to_check
array of strings List of domains to check
Returns a dictionary mapping the each domain name to a boolean denoting
whether or not it is available.
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.check domai... | salt/modules/namecheap_domains.py | def check(*domains_to_check):
'''
Checks the availability of domains
domains_to_check
array of strings List of domains to check
Returns a dictionary mapping the each domain name to a boolean denoting
whether or not it is available.
CLI Example:
.. code-block:: bash
salt... | def check(*domains_to_check):
'''
Checks the availability of domains
domains_to_check
array of strings List of domains to check
Returns a dictionary mapping the each domain name to a boolean denoting
whether or not it is available.
CLI Example:
.. code-block:: bash
salt... | [
"Checks",
"the",
"availability",
"of",
"domains"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains.py#L212-L241 | [
"def",
"check",
"(",
"*",
"domains_to_check",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.check'",
")",
"opts",
"[",
"'DomainList'",
"]",
"=",
"','",
".",
"join",
"(",
"domains_to_check",
")",
"r... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_info | Returns information about the requested domain
returns a dictionary of information about the domain_name
domain_name
string Domain name to get information about
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_info my-domain-name | salt/modules/namecheap_domains.py | def get_info(domain_name):
'''
Returns information about the requested domain
returns a dictionary of information about the domain_name
domain_name
string Domain name to get information about
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_info my-d... | def get_info(domain_name):
'''
Returns information about the requested domain
returns a dictionary of information about the domain_name
domain_name
string Domain name to get information about
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_info my-d... | [
"Returns",
"information",
"about",
"the",
"requested",
"domain"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains.py#L244-L269 | [
"def",
"get_info",
"(",
"domain_name",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.getinfo'",
")",
"opts",
"[",
"'DomainName'",
"]",
"=",
"domain_name",
"response_xml",
"=",
"salt",
".",
"utils",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_tld_list | Returns a list of TLDs as objects
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_tld_list | salt/modules/namecheap_domains.py | def get_tld_list():
'''
Returns a list of TLDs as objects
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_tld_list
'''
response_xml = salt.utils.namecheap.get_request(salt.utils.namecheap.get_opts('namecheap.domains.gettldlist'))
if response_xml is None:... | def get_tld_list():
'''
Returns a list of TLDs as objects
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_tld_list
'''
response_xml = salt.utils.namecheap.get_request(salt.utils.namecheap.get_opts('namecheap.domains.gettldlist'))
if response_xml is None:... | [
"Returns",
"a",
"list",
"of",
"TLDs",
"as",
"objects"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains.py#L272-L301 | [
"def",
"get_tld_list",
"(",
")",
":",
"response_xml",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_request",
"(",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"(",
"'namecheap.domains.gettldlist'",
")",
")",
"if",
"response_xml",
"is",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_list | Returns a list of domains for the particular user as a list of objects
offset by ``page`` length of ``page_size``
list_type : ALL
One of ``ALL``, ``EXPIRING``, ``EXPIRED``
search_term
Keyword to look for on the domain list
page : 1
Number of result page to return
page_siz... | salt/modules/namecheap_domains.py | def get_list(list_type=None,
search_term=None,
page=None,
page_size=None,
sort_by=None):
'''
Returns a list of domains for the particular user as a list of objects
offset by ``page`` length of ``page_size``
list_type : ALL
One of ``ALL``, ``EX... | def get_list(list_type=None,
search_term=None,
page=None,
page_size=None,
sort_by=None):
'''
Returns a list of domains for the particular user as a list of objects
offset by ``page`` length of ``page_size``
list_type : ALL
One of ``ALL``, ``EX... | [
"Returns",
"a",
"list",
"of",
"domains",
"for",
"the",
"particular",
"user",
"as",
"a",
"list",
"of",
"objects",
"offset",
"by",
"page",
"length",
"of",
"page_size"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_domains.py#L304-L376 | [
"def",
"get_list",
"(",
"list_type",
"=",
"None",
",",
"search_term",
"=",
"None",
",",
"page",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
"sort_by",
"=",
"None",
")",
":",
"opts",
"=",
"salt",
".",
"utils",
".",
"namecheap",
".",
"get_opts",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Obtain the Pillar data from **reclass** for the given ``minion_id``. | salt/pillar/reclass_adapter.py | def ext_pillar(minion_id, pillar, **kwargs):
'''
Obtain the Pillar data from **reclass** for the given ``minion_id``.
'''
# If reclass is installed, __virtual__ put it onto the search path, so we
# don't need to protect against ImportError:
# pylint: disable=3rd-party-module-not-gated
from ... | def ext_pillar(minion_id, pillar, **kwargs):
'''
Obtain the Pillar data from **reclass** for the given ``minion_id``.
'''
# If reclass is installed, __virtual__ put it onto the search path, so we
# don't need to protect against ImportError:
# pylint: disable=3rd-party-module-not-gated
from ... | [
"Obtain",
"the",
"Pillar",
"data",
"from",
"**",
"reclass",
"**",
"for",
"the",
"given",
"minion_id",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/reclass_adapter.py#L93-L135 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"*",
"kwargs",
")",
":",
"# If reclass is installed, __virtual__ put it onto the search path, so we",
"# don't need to protect against ImportError:",
"# pylint: disable=3rd-party-module-not-gated",
"from",
"reclass",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _set_status | Assign status data to a dict. | salt/modules/zcbuildout.py | def _set_status(m,
comment=INVALID_RESPONSE,
status=False,
out=None):
'''
Assign status data to a dict.
'''
m['out'] = out
m['status'] = status
m['logs'] = LOG.messages[:]
m['logs_by_level'] = LOG.by_level.copy()
outlog, outlog_by_level = '... | def _set_status(m,
comment=INVALID_RESPONSE,
status=False,
out=None):
'''
Assign status data to a dict.
'''
m['out'] = out
m['status'] = status
m['logs'] = LOG.messages[:]
m['logs_by_level'] = LOG.by_level.copy()
outlog, outlog_by_level = '... | [
"Assign",
"status",
"data",
"to",
"a",
"dict",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L209-L248 | [
"def",
"_set_status",
"(",
"m",
",",
"comment",
"=",
"INVALID_RESPONSE",
",",
"status",
"=",
"False",
",",
"out",
"=",
"None",
")",
":",
"m",
"[",
"'out'",
"]",
"=",
"out",
"m",
"[",
"'status'",
"]",
"=",
"status",
"m",
"[",
"'logs'",
"]",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _invalid | Return invalid status. | salt/modules/zcbuildout.py | def _invalid(m, comment=INVALID_RESPONSE, out=None):
'''
Return invalid status.
'''
return _set_status(m, status=False, comment=comment, out=out) | def _invalid(m, comment=INVALID_RESPONSE, out=None):
'''
Return invalid status.
'''
return _set_status(m, status=False, comment=comment, out=out) | [
"Return",
"invalid",
"status",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L251-L255 | [
"def",
"_invalid",
"(",
"m",
",",
"comment",
"=",
"INVALID_RESPONSE",
",",
"out",
"=",
"None",
")",
":",
"return",
"_set_status",
"(",
"m",
",",
"status",
"=",
"False",
",",
"comment",
"=",
"comment",
",",
"out",
"=",
"out",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _valid | Return valid status. | salt/modules/zcbuildout.py | def _valid(m, comment=VALID_RESPONSE, out=None):
'''
Return valid status.
'''
return _set_status(m, status=True, comment=comment, out=out) | def _valid(m, comment=VALID_RESPONSE, out=None):
'''
Return valid status.
'''
return _set_status(m, status=True, comment=comment, out=out) | [
"Return",
"valid",
"status",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L258-L262 | [
"def",
"_valid",
"(",
"m",
",",
"comment",
"=",
"VALID_RESPONSE",
",",
"out",
"=",
"None",
")",
":",
"return",
"_set_status",
"(",
"m",
",",
"status",
"=",
"True",
",",
"comment",
"=",
"comment",
",",
"out",
"=",
"out",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _Popen | Run a command.
output
return output if true
directory
directory to execute in
runas
user used to run buildout as
env
environment variables to set when running
exitcode
fails if cmd does not return this exit code
(set to None to disable check)
... | salt/modules/zcbuildout.py | def _Popen(command,
output=False,
directory='.',
runas=None,
env=(),
exitcode=0,
use_vt=False,
loglevel=None):
'''
Run a command.
output
return output if true
directory
directory to execute in
runas
... | def _Popen(command,
output=False,
directory='.',
runas=None,
env=(),
exitcode=0,
use_vt=False,
loglevel=None):
'''
Run a command.
output
return output if true
directory
directory to execute in
runas
... | [
"Run",
"a",
"command",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L265-L312 | [
"def",
"_Popen",
"(",
"command",
",",
"output",
"=",
"False",
",",
"directory",
"=",
"'.'",
",",
"runas",
"=",
"None",
",",
"env",
"=",
"(",
")",
",",
"exitcode",
"=",
"0",
",",
"use_vt",
"=",
"False",
",",
"loglevel",
"=",
"None",
")",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _find_cfgs | Find all buildout configs in a subdirectory.
only buildout.cfg and etc/buildout.cfg are valid in::
path
directory where to start to search
cfg
a optional list to append to
.
├── buildout.cfg
├── etc
│ └── buildout.cfg
├── foo
... | salt/modules/zcbuildout.py | def _find_cfgs(path, cfgs=None):
'''
Find all buildout configs in a subdirectory.
only buildout.cfg and etc/buildout.cfg are valid in::
path
directory where to start to search
cfg
a optional list to append to
.
├── buildout.cfg
├── etc
... | def _find_cfgs(path, cfgs=None):
'''
Find all buildout configs in a subdirectory.
only buildout.cfg and etc/buildout.cfg are valid in::
path
directory where to start to search
cfg
a optional list to append to
.
├── buildout.cfg
├── etc
... | [
"Find",
"all",
"buildout",
"configs",
"in",
"a",
"subdirectory",
".",
"only",
"buildout",
".",
"cfg",
"and",
"etc",
"/",
"buildout",
".",
"cfg",
"are",
"valid",
"in",
"::"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L353-L388 | [
"def",
"_find_cfgs",
"(",
"path",
",",
"cfgs",
"=",
"None",
")",
":",
"ignored",
"=",
"[",
"'var'",
",",
"'parts'",
"]",
"dirs",
"=",
"[",
"]",
"if",
"not",
"cfgs",
":",
"cfgs",
"=",
"[",
"]",
"for",
"i",
"in",
"os",
".",
"listdir",
"(",
"path"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_bootstrap_content | Get the current bootstrap.py script content | salt/modules/zcbuildout.py | def _get_bootstrap_content(directory='.'):
'''
Get the current bootstrap.py script content
'''
try:
with salt.utils.files.fopen(os.path.join(
os.path.abspath(directory),
'bootstrap.py')) as fic:
oldcontent = salt.utils.s... | def _get_bootstrap_content(directory='.'):
'''
Get the current bootstrap.py script content
'''
try:
with salt.utils.files.fopen(os.path.join(
os.path.abspath(directory),
'bootstrap.py')) as fic:
oldcontent = salt.utils.s... | [
"Get",
"the",
"current",
"bootstrap",
".",
"py",
"script",
"content"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L391-L404 | [
"def",
"_get_bootstrap_content",
"(",
"directory",
"=",
"'.'",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"directory",
")",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_buildout_ver | Check for buildout versions.
In any cases, check for a version pinning
Also check for buildout.dumppickedversions which is buildout1 specific
Also check for the version targeted by the local bootstrap file
Take as default buildout2
directory
directory to execute in | salt/modules/zcbuildout.py | def _get_buildout_ver(directory='.'):
'''Check for buildout versions.
In any cases, check for a version pinning
Also check for buildout.dumppickedversions which is buildout1 specific
Also check for the version targeted by the local bootstrap file
Take as default buildout2
directory
dir... | def _get_buildout_ver(directory='.'):
'''Check for buildout versions.
In any cases, check for a version pinning
Also check for buildout.dumppickedversions which is buildout1 specific
Also check for the version targeted by the local bootstrap file
Take as default buildout2
directory
dir... | [
"Check",
"for",
"buildout",
"versions",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L407-L441 | [
"def",
"_get_buildout_ver",
"(",
"directory",
"=",
"'.'",
")",
":",
"directory",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"directory",
")",
"buildoutver",
"=",
"2",
"try",
":",
"files",
"=",
"_find_cfgs",
"(",
"directory",
")",
"for",
"f",
"in",
"f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_bootstrap_url | Get the most appropriate download URL for the bootstrap script.
directory
directory to execute in | salt/modules/zcbuildout.py | def _get_bootstrap_url(directory):
'''
Get the most appropriate download URL for the bootstrap script.
directory
directory to execute in
'''
v = _get_buildout_ver(directory)
return _URL_VERSIONS.get(v, _URL_VERSIONS[DEFAULT_VER]) | def _get_bootstrap_url(directory):
'''
Get the most appropriate download URL for the bootstrap script.
directory
directory to execute in
'''
v = _get_buildout_ver(directory)
return _URL_VERSIONS.get(v, _URL_VERSIONS[DEFAULT_VER]) | [
"Get",
"the",
"most",
"appropriate",
"download",
"URL",
"for",
"the",
"bootstrap",
"script",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L444-L453 | [
"def",
"_get_bootstrap_url",
"(",
"directory",
")",
":",
"v",
"=",
"_get_buildout_ver",
"(",
"directory",
")",
"return",
"_URL_VERSIONS",
".",
"get",
"(",
"v",
",",
"_URL_VERSIONS",
"[",
"DEFAULT_VER",
"]",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | upgrade_bootstrap | Upgrade current bootstrap.py with the last released one.
Indeed, when we first run a buildout, a common source of problem
is to have a locally stale bootstrap, we just try to grab a new copy
directory
directory to execute in
offline
are we executing buildout in offline mode
build... | salt/modules/zcbuildout.py | def upgrade_bootstrap(directory='.',
onlyif=None,
unless=None,
runas=None,
env=(),
offline=False,
buildout_ver=None):
'''
Upgrade current bootstrap.py with the last released one.
... | def upgrade_bootstrap(directory='.',
onlyif=None,
unless=None,
runas=None,
env=(),
offline=False,
buildout_ver=None):
'''
Upgrade current bootstrap.py with the last released one.
... | [
"Upgrade",
"current",
"bootstrap",
".",
"py",
"with",
"the",
"last",
"released",
"one",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L468-L553 | [
"def",
"upgrade_bootstrap",
"(",
"directory",
"=",
"'.'",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"env",
"=",
"(",
")",
",",
"offline",
"=",
"False",
",",
"buildout_ver",
"=",
"None",
")",
":",
"if",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | bootstrap | Run the buildout bootstrap dance (python bootstrap.py).
directory
directory to execute in
config
alternative buildout configuration file to use
runas
User used to run buildout as
env
environment variables to set when running
buildout_ver
force a specific ... | salt/modules/zcbuildout.py | def bootstrap(directory='.',
config='buildout.cfg',
python=sys.executable,
onlyif=None,
unless=None,
runas=None,
env=(),
distribute=None,
buildout_ver=None,
test_release=False,
off... | def bootstrap(directory='.',
config='buildout.cfg',
python=sys.executable,
onlyif=None,
unless=None,
runas=None,
env=(),
distribute=None,
buildout_ver=None,
test_release=False,
off... | [
"Run",
"the",
"buildout",
"bootstrap",
"dance",
"(",
"python",
"bootstrap",
".",
"py",
")",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L557-L764 | [
"def",
"bootstrap",
"(",
"directory",
"=",
"'.'",
",",
"config",
"=",
"'buildout.cfg'",
",",
"python",
"=",
"sys",
".",
"executable",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"env",
"=",
"(",
")",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | run_buildout | Run a buildout in a directory.
directory
directory to execute in
config
alternative buildout configuration file to use
offline
are we executing buildout in offline mode
runas
user used to run buildout as
env
environment variables to set when running
... | salt/modules/zcbuildout.py | def run_buildout(directory='.',
config='buildout.cfg',
parts=None,
onlyif=None,
unless=None,
offline=False,
newest=True,
runas=None,
env=(),
verbose=False,
... | def run_buildout(directory='.',
config='buildout.cfg',
parts=None,
onlyif=None,
unless=None,
offline=False,
newest=True,
runas=None,
env=(),
verbose=False,
... | [
"Run",
"a",
"buildout",
"in",
"a",
"directory",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L768-L870 | [
"def",
"run_buildout",
"(",
"directory",
"=",
"'.'",
",",
"config",
"=",
"'buildout.cfg'",
",",
"parts",
"=",
"None",
",",
"onlyif",
"=",
"None",
",",
"unless",
"=",
"None",
",",
"offline",
"=",
"False",
",",
"newest",
"=",
"True",
",",
"runas",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | buildout | Run buildout in a directory.
directory
directory to execute in
config
buildout config to use
parts
specific buildout parts to run
runas
user used to run buildout as
env
environment variables to set when running
buildout_ver
force a specific b... | salt/modules/zcbuildout.py | def buildout(directory='.',
config='buildout.cfg',
parts=None,
runas=None,
env=(),
buildout_ver=None,
test_release=False,
distribute=None,
new_st=None,
offline=False,
newest=False,
... | def buildout(directory='.',
config='buildout.cfg',
parts=None,
runas=None,
env=(),
buildout_ver=None,
test_release=False,
distribute=None,
new_st=None,
offline=False,
newest=False,
... | [
"Run",
"buildout",
"in",
"a",
"directory",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zcbuildout.py#L922-L1024 | [
"def",
"buildout",
"(",
"directory",
"=",
"'.'",
",",
"config",
"=",
"'buildout.cfg'",
",",
"parts",
"=",
"None",
",",
"runas",
"=",
"None",
",",
"env",
"=",
"(",
")",
",",
"buildout_ver",
"=",
"None",
",",
"test_release",
"=",
"False",
",",
"distribut... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Execute queries against SQLite3, merge and return as a dict | salt/pillar/sqlite3.py | def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against SQLite3, merge and return as a dict
'''
return SQLite3ExtPillar().fetch(minion_id, pillar, *args, **kwargs) | def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against SQLite3, merge and return as a dict
'''
return SQLite3ExtPillar().fetch(minion_id, pillar, *args, **kwargs) | [
"Execute",
"queries",
"against",
"SQLite3",
"merge",
"and",
"return",
"as",
"a",
"dict"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/sqlite3.py#L110-L117 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"SQLite3ExtPillar",
"(",
")",
".",
"fetch",
"(",
"minion_id",
",",
"pillar",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ext_pillar | Read pillar data from HTTP response.
:param str url: Url to request.
:param bool with_grains: Whether to substitute strings in the url with their grain values.
:return: A dictionary of the pillar data to add.
:rtype: dict | salt/pillar/http_json.py | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
url,
with_grains=False):
'''
Read pillar data from HTTP response.
:param str url: Url to request.
:param bool with_grains: Whether to substitute strings in the url with their grain values.
:retu... | def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
url,
with_grains=False):
'''
Read pillar data from HTTP response.
:param str url: Url to request.
:param bool with_grains: Whether to substitute strings in the url with their grain values.
:retu... | [
"Read",
"pillar",
"data",
"from",
"HTTP",
"response",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/http_json.py#L66-L109 | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"pillar",
",",
"# pylint: disable=W0613",
"url",
",",
"with_grains",
"=",
"False",
")",
":",
"url",
"=",
"url",
".",
"replace",
"(",
"'%s'",
",",
"_quote",
"(",
"minion_id",
")",
")",
"grain_pattern",
"=",
"r'<(?... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | check_password | Verify user password.
username
Username on which to perform password check
password
Password to check
encrypted
Whether or not the password is encrypted
Default: False
.. code-block: bash
salt '*' nxos.cmd check_password username=admin password=admin
... | salt/modules/nxos.py | def check_password(username, password, encrypted=False, **kwargs):
'''
Verify user password.
username
Username on which to perform password check
password
Password to check
encrypted
Whether or not the password is encrypted
Default: False
.. code-block: bash
... | def check_password(username, password, encrypted=False, **kwargs):
'''
Verify user password.
username
Username on which to perform password check
password
Password to check
encrypted
Whether or not the password is encrypted
Default: False
.. code-block: bash
... | [
"Verify",
"user",
"password",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L143-L181 | [
"def",
"check_password",
"(",
"username",
",",
"password",
",",
"encrypted",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"hash_algorithms",
"=",
"{",
"'1'",
":",
"'md5'",
",",
"'2a'",
":",
"'blowfish'",
",",
"'5'",
":",
"'sha256'",
",",
"'6'",
":"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | cmd | NOTE: This function is preserved for backwards compatibilty. This allows
commands to be executed using either of the following syntactic forms.
salt '*' nxos.cmd <function>
or
salt '*' nxos.<function>
command
function from `salt.modules.nxos` to run
args
positional args to ... | salt/modules/nxos.py | def cmd(command, *args, **kwargs):
'''
NOTE: This function is preserved for backwards compatibilty. This allows
commands to be executed using either of the following syntactic forms.
salt '*' nxos.cmd <function>
or
salt '*' nxos.<function>
command
function from `salt.modules.nxo... | def cmd(command, *args, **kwargs):
'''
NOTE: This function is preserved for backwards compatibilty. This allows
commands to be executed using either of the following syntactic forms.
salt '*' nxos.cmd <function>
or
salt '*' nxos.<function>
command
function from `salt.modules.nxo... | [
"NOTE",
":",
"This",
"function",
"is",
"preserved",
"for",
"backwards",
"compatibilty",
".",
"This",
"allows",
"commands",
"to",
"be",
"executed",
"using",
"either",
"of",
"the",
"following",
"syntactic",
"forms",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L195-L228 | [
"def",
"cmd",
"(",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"k",
"in",
"list",
"(",
"kwargs",
")",
":",
"if",
"k",
".",
"startswith",
"(",
"'__pub_'",
")",
":",
"kwargs",
".",
"pop",
"(",
"k",
")",
"local_command",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_roles | Get roles assigned to a username.
.. code-block: bash
salt '*' nxos.cmd get_roles username=admin | salt/modules/nxos.py | def get_roles(username, **kwargs):
'''
Get roles assigned to a username.
.. code-block: bash
salt '*' nxos.cmd get_roles username=admin
'''
user = get_user(username)
if not user:
return []
command = 'show user-account {0}'.format(username)
info = ''
info = show(comm... | def get_roles(username, **kwargs):
'''
Get roles assigned to a username.
.. code-block: bash
salt '*' nxos.cmd get_roles username=admin
'''
user = get_user(username)
if not user:
return []
command = 'show user-account {0}'.format(username)
info = ''
info = show(comm... | [
"Get",
"roles",
"assigned",
"to",
"a",
"username",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L247-L268 | [
"def",
"get_roles",
"(",
"username",
",",
"*",
"*",
"kwargs",
")",
":",
"user",
"=",
"get_user",
"(",
"username",
")",
"if",
"not",
"user",
":",
"return",
"[",
"]",
"command",
"=",
"'show user-account {0}'",
".",
"format",
"(",
"username",
")",
"info",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_user | Get username line from switch.
.. code-block: bash
salt '*' nxos.cmd get_user username=admin | salt/modules/nxos.py | def get_user(username, **kwargs):
'''
Get username line from switch.
.. code-block: bash
salt '*' nxos.cmd get_user username=admin
'''
command = 'show run | include "^username {0} password 5 "'.format(username)
info = ''
info = show(command, **kwargs)
if isinstance(info, list):... | def get_user(username, **kwargs):
'''
Get username line from switch.
.. code-block: bash
salt '*' nxos.cmd get_user username=admin
'''
command = 'show run | include "^username {0} password 5 "'.format(username)
info = ''
info = show(command, **kwargs)
if isinstance(info, list):... | [
"Get",
"username",
"line",
"from",
"switch",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L271-L284 | [
"def",
"get_user",
"(",
"username",
",",
"*",
"*",
"kwargs",
")",
":",
"command",
"=",
"'show run | include \"^username {0} password 5 \"'",
".",
"format",
"(",
"username",
")",
"info",
"=",
"''",
"info",
"=",
"show",
"(",
"command",
",",
"*",
"*",
"kwargs",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | grains | Get grains for minion.
.. code-block: bash
salt '*' nxos.cmd grains | salt/modules/nxos.py | def grains(**kwargs):
'''
Get grains for minion.
.. code-block: bash
salt '*' nxos.cmd grains
'''
if not DEVICE_DETAILS['grains_cache']:
ret = salt.utils.nxos.system_info(show_ver(**kwargs))
log.debug(ret)
DEVICE_DETAILS['grains_cache'].update(ret['nxos'])
retur... | def grains(**kwargs):
'''
Get grains for minion.
.. code-block: bash
salt '*' nxos.cmd grains
'''
if not DEVICE_DETAILS['grains_cache']:
ret = salt.utils.nxos.system_info(show_ver(**kwargs))
log.debug(ret)
DEVICE_DETAILS['grains_cache'].update(ret['nxos'])
retur... | [
"Get",
"grains",
"for",
"minion",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L287-L299 | [
"def",
"grains",
"(",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"DEVICE_DETAILS",
"[",
"'grains_cache'",
"]",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"nxos",
".",
"system_info",
"(",
"show_ver",
"(",
"*",
"*",
"kwargs",
")",
")",
"log",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sendline | Send arbitray commands to the NX-OS device.
command
The command to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to the device.
Defaults to ``cli_show_ascii`... | salt/modules/nxos.py | def sendline(command, method='cli_show_ascii', **kwargs):
'''
Send arbitray commands to the NX-OS device.
command
The command to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send confi... | def sendline(command, method='cli_show_ascii', **kwargs):
'''
Send arbitray commands to the NX-OS device.
command
The command to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send confi... | [
"Send",
"arbitray",
"commands",
"to",
"the",
"NX",
"-",
"OS",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L314-L345 | [
"def",
"sendline",
"(",
"command",
",",
"method",
"=",
"'cli_show_ascii'",
",",
"*",
"*",
"kwargs",
")",
":",
"smethods",
"=",
"[",
"'cli_show_ascii'",
",",
"'cli_show'",
",",
"'cli_conf'",
"]",
"if",
"method",
"not",
"in",
"smethods",
":",
"msg",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show | Execute one or more show (non-configuration) commands.
commands
The commands to be executed.
raw_text: ``True``
Whether to return raw text or structured data.
NOTE: raw_text option is ignored for SSH proxy minion. Data is
returned unstructured.
CLI Example:
.. code-b... | salt/modules/nxos.py | def show(commands, raw_text=True, **kwargs):
'''
Execute one or more show (non-configuration) commands.
commands
The commands to be executed.
raw_text: ``True``
Whether to return raw text or structured data.
NOTE: raw_text option is ignored for SSH proxy minion. Data is
... | def show(commands, raw_text=True, **kwargs):
'''
Execute one or more show (non-configuration) commands.
commands
The commands to be executed.
raw_text: ``True``
Whether to return raw text or structured data.
NOTE: raw_text option is ignored for SSH proxy minion. Data is
... | [
"Execute",
"one",
"or",
"more",
"show",
"(",
"non",
"-",
"configuration",
")",
"commands",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L348-L388 | [
"def",
"show",
"(",
"commands",
",",
"raw_text",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"raw_text",
",",
"bool",
")",
":",
"msg",
"=",
"\"\"\"\n INPUT ERROR: Second argument 'raw_text' must be either True or False\n ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_ver | Shortcut to run `show version` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_ver | salt/modules/nxos.py | def show_ver(**kwargs):
'''
Shortcut to run `show version` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_ver
'''
command = 'show version'
info = ''
info = show(command, **kwargs)
if isinstance(info, list):
info = info[0]
return info | def show_ver(**kwargs):
'''
Shortcut to run `show version` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_ver
'''
command = 'show version'
info = ''
info = show(command, **kwargs)
if isinstance(info, list):
info = info[0]
return info | [
"Shortcut",
"to",
"run",
"show",
"version",
"on",
"the",
"NX",
"-",
"OS",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L391-L404 | [
"def",
"show_ver",
"(",
"*",
"*",
"kwargs",
")",
":",
"command",
"=",
"'show version'",
"info",
"=",
"''",
"info",
"=",
"show",
"(",
"command",
",",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"info",
",",
"list",
")",
":",
"info",
"=",
"info... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_run | Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run | salt/modules/nxos.py | def show_run(**kwargs):
'''
Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run
'''
command = 'show running-config'
info = ''
info = show(command, **kwargs)
if isinstance(info, list):
info = info[0]
return info | def show_run(**kwargs):
'''
Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run
'''
command = 'show running-config'
info = ''
info = show(command, **kwargs)
if isinstance(info, list):
info = info[0]
return info | [
"Shortcut",
"to",
"run",
"show",
"running",
"-",
"config",
"on",
"the",
"NX",
"-",
"OS",
"device",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L407-L420 | [
"def",
"show_run",
"(",
"*",
"*",
"kwargs",
")",
":",
"command",
"=",
"'show running-config'",
"info",
"=",
"''",
"info",
"=",
"show",
"(",
"command",
",",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"info",
",",
"list",
")",
":",
"info",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | config | Configures the Nexus switch with the specified commands.
This method is used to send configuration commands to the switch. It
will take either a string or a list and prepend the necessary commands
to put the session into config mode.
.. warning::
All the commands will be applied directly to ... | salt/modules/nxos.py | def config(commands=None,
config_file=None,
template_engine='jinja',
context=None,
defaults=None,
saltenv='base',
**kwargs):
'''
Configures the Nexus switch with the specified commands.
This method is used to send configuration commands to t... | def config(commands=None,
config_file=None,
template_engine='jinja',
context=None,
defaults=None,
saltenv='base',
**kwargs):
'''
Configures the Nexus switch with the specified commands.
This method is used to send configuration commands to t... | [
"Configures",
"the",
"Nexus",
"switch",
"with",
"the",
"specified",
"commands",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L459-L556 | [
"def",
"config",
"(",
"commands",
"=",
"None",
",",
"config_file",
"=",
"None",
",",
"template_engine",
"=",
"'jinja'",
",",
"context",
"=",
"None",
",",
"defaults",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"initia... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_config | Delete one or more config lines to the switch running config.
lines
Configuration lines to remove.
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code-block:: bash... | salt/modules/nxos.py | def delete_config(lines, **kwargs):
'''
Delete one or more config lines to the switch running config.
lines
Configuration lines to remove.
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
... | def delete_config(lines, **kwargs):
'''
Delete one or more config lines to the switch running config.
lines
Configuration lines to remove.
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
... | [
"Delete",
"one",
"or",
"more",
"config",
"lines",
"to",
"the",
"switch",
"running",
"config",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L573-L604 | [
"def",
"delete_config",
"(",
"lines",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"lines",
",",
"list",
")",
":",
"lines",
"=",
"[",
"lines",
"]",
"for",
"i",
",",
"_",
"in",
"enumerate",
"(",
"lines",
")",
":",
"lines",
"[... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_password | Set users password on switch.
username
Username to configure
password
Password to configure for username
encrypted
Whether or not to encrypt the password
Default: False
role
Configure role for the username
Default: None
crypt_salt
Configur... | salt/modules/nxos.py | def set_password(username,
password,
encrypted=False,
role=None,
crypt_salt=None,
algorithm='sha256',
**kwargs):
'''
Set users password on switch.
username
Username to configure
password
... | def set_password(username,
password,
encrypted=False,
role=None,
crypt_salt=None,
algorithm='sha256',
**kwargs):
'''
Set users password on switch.
username
Username to configure
password
... | [
"Set",
"users",
"password",
"on",
"switch",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L667-L723 | [
"def",
"set_password",
"(",
"username",
",",
"password",
",",
"encrypted",
"=",
"False",
",",
"role",
"=",
"None",
",",
"crypt_salt",
"=",
"None",
",",
"algorithm",
"=",
"'sha256'",
",",
"*",
"*",
"kwargs",
")",
":",
"password_line",
"=",
"get_user",
"("... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_role | Assign role to username.
username
Username for role configuration
role
Configure role for username
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code... | salt/modules/nxos.py | def set_role(username, role, **kwargs):
'''
Assign role to username.
username
Username for role configuration
role
Configure role for username
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startu... | def set_role(username, role, **kwargs):
'''
Assign role to username.
username
Username for role configuration
role
Configure role for username
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startu... | [
"Assign",
"role",
"to",
"username",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L726-L746 | [
"def",
"set_role",
"(",
"username",
",",
"role",
",",
"*",
"*",
"kwargs",
")",
":",
"role_line",
"=",
"'username {0} role {1}'",
".",
"format",
"(",
"username",
",",
"role",
")",
"return",
"config",
"(",
"role_line",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | unset_role | Remove role from username.
username
Username for role removal
role
Role to remove
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code-block:: bash
... | salt/modules/nxos.py | def unset_role(username, role, **kwargs):
'''
Remove role from username.
username
Username for role removal
role
Role to remove
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration... | def unset_role(username, role, **kwargs):
'''
Remove role from username.
username
Username for role removal
role
Role to remove
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration... | [
"Remove",
"role",
"from",
"username",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L749-L769 | [
"def",
"unset_role",
"(",
"username",
",",
"role",
",",
"*",
"*",
"kwargs",
")",
":",
"role_line",
"=",
"'no username {0} role {1}'",
".",
"format",
"(",
"username",
",",
"role",
")",
"return",
"config",
"(",
"role_line",
",",
"*",
"*",
"kwargs",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _configure_device | Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH. | salt/modules/nxos.py | def _configure_device(commands, **kwargs):
'''
Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH.
'''
if salt.utils.platform.is_proxy():
return __proxy__['nxos.proxy_config'](commands, **kwargs)
else:
return _nxa... | def _configure_device(commands, **kwargs):
'''
Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH.
'''
if salt.utils.platform.is_proxy():
return __proxy__['nxos.proxy_config'](commands, **kwargs)
else:
return _nxa... | [
"Helper",
"function",
"to",
"send",
"configuration",
"commands",
"to",
"the",
"device",
"over",
"a",
"proxy",
"minion",
"or",
"native",
"minion",
"using",
"NX",
"-",
"API",
"or",
"SSH",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L775-L783 | [
"def",
"_configure_device",
"(",
"commands",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"__proxy__",
"[",
"'nxos.proxy_config'",
"]",
"(",
"commands",
",",
"*",
"*",
"kwargs",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _nxapi_config | Helper function to send configuration commands using NX-API. | salt/modules/nxos.py | def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs):
'''
Helper function to send configuration commands using NX-API.
'''
api_kwargs = __salt__['config.get']('nxos', {})
api_kwargs.update(**kwargs)
if not isinstance(commands, list):
commands = [commands]
try:
... | def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs):
'''
Helper function to send configuration commands using NX-API.
'''
api_kwargs = __salt__['config.get']('nxos', {})
api_kwargs.update(**kwargs)
if not isinstance(commands, list):
commands = [commands]
try:
... | [
"Helper",
"function",
"to",
"send",
"configuration",
"commands",
"using",
"NX",
"-",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L786-L806 | [
"def",
"_nxapi_config",
"(",
"commands",
",",
"methods",
"=",
"'cli_conf'",
",",
"bsb_arg",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"api_kwargs",
"=",
"__salt__",
"[",
"'config.get'",
"]",
"(",
"'nxos'",
",",
"{",
"}",
")",
"api_kwargs",
".",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _nxapi_request | Helper function to send exec and config requests over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to t... | salt/modules/nxos.py | def _nxapi_request(commands,
method='cli_conf',
**kwargs):
'''
Helper function to send exec and config requests over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured o... | def _nxapi_request(commands,
method='cli_conf',
**kwargs):
'''
Helper function to send exec and config requests over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured o... | [
"Helper",
"function",
"to",
"send",
"exec",
"and",
"config",
"requests",
"over",
"NX",
"-",
"API",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nxos.py#L809-L829 | [
"def",
"_nxapi_request",
"(",
"commands",
",",
"method",
"=",
"'cli_conf'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"platform",
".",
"is_proxy",
"(",
")",
":",
"return",
"__proxy__",
"[",
"'nxos._nxapi_request'",
"]",
"(",
"co... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | compress | Returns the data compressed at gzip level compression. | salt/utils/gzip_util.py | def compress(data, compresslevel=9):
'''
Returns the data compressed at gzip level compression.
'''
buf = BytesIO()
with open_fileobj(buf, 'wb', compresslevel) as ogz:
if six.PY3 and not isinstance(data, bytes):
data = data.encode(__salt_system_encoding__)
ogz.write(data)... | def compress(data, compresslevel=9):
'''
Returns the data compressed at gzip level compression.
'''
buf = BytesIO()
with open_fileobj(buf, 'wb', compresslevel) as ogz:
if six.PY3 and not isinstance(data, bytes):
data = data.encode(__salt_system_encoding__)
ogz.write(data)... | [
"Returns",
"the",
"data",
"compressed",
"at",
"gzip",
"level",
"compression",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gzip_util.py#L54-L64 | [
"def",
"compress",
"(",
"data",
",",
"compresslevel",
"=",
"9",
")",
":",
"buf",
"=",
"BytesIO",
"(",
")",
"with",
"open_fileobj",
"(",
"buf",
",",
"'wb'",
",",
"compresslevel",
")",
"as",
"ogz",
":",
"if",
"six",
".",
"PY3",
"and",
"not",
"isinstanc... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | compress_file | Generator that reads chunk_size bytes at a time from a file/filehandle and
yields the compressed result of each read.
.. note::
Each chunk is compressed separately. They cannot be stitched together
to form a compressed file. This function is designed to break up a file
into compressed c... | salt/utils/gzip_util.py | def compress_file(fh_, compresslevel=9, chunk_size=1048576):
'''
Generator that reads chunk_size bytes at a time from a file/filehandle and
yields the compressed result of each read.
.. note::
Each chunk is compressed separately. They cannot be stitched together
to form a compressed fil... | def compress_file(fh_, compresslevel=9, chunk_size=1048576):
'''
Generator that reads chunk_size bytes at a time from a file/filehandle and
yields the compressed result of each read.
.. note::
Each chunk is compressed separately. They cannot be stitched together
to form a compressed fil... | [
"Generator",
"that",
"reads",
"chunk_size",
"bytes",
"at",
"a",
"time",
"from",
"a",
"file",
"/",
"filehandle",
"and",
"yields",
"the",
"compressed",
"result",
"of",
"each",
"read",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gzip_util.py#L74-L106 | [
"def",
"compress_file",
"(",
"fh_",
",",
"compresslevel",
"=",
"9",
",",
"chunk_size",
"=",
"1048576",
")",
":",
"try",
":",
"bytes_read",
"=",
"int",
"(",
"chunk_size",
")",
"if",
"bytes_read",
"!=",
"chunk_size",
":",
"raise",
"ValueError",
"except",
"Va... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _root | Relocate an absolute path to a new root directory. | salt/modules/systemd_service.py | def _root(path, root):
'''
Relocate an absolute path to a new root directory.
'''
if root:
return os.path.join(root, os.path.relpath(path, os.path.sep))
else:
return path | def _root(path, root):
'''
Relocate an absolute path to a new root directory.
'''
if root:
return os.path.join(root, os.path.relpath(path, os.path.sep))
else:
return path | [
"Relocate",
"an",
"absolute",
"path",
"to",
"a",
"new",
"root",
"directory",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L73-L80 | [
"def",
"_root",
"(",
"path",
",",
"root",
")",
":",
"if",
"root",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"os",
".",
"path",
".",
"relpath",
"(",
"path",
",",
"os",
".",
"path",
".",
"sep",
")",
")",
"else",
":",
"ret... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _canonical_unit_name | Build a canonical unit name treating unit names without one
of the valid suffixes as a service. | salt/modules/systemd_service.py | def _canonical_unit_name(name):
'''
Build a canonical unit name treating unit names without one
of the valid suffixes as a service.
'''
if not isinstance(name, six.string_types):
name = six.text_type(name)
if any(name.endswith(suffix) for suffix in VALID_UNIT_TYPES):
return name
... | def _canonical_unit_name(name):
'''
Build a canonical unit name treating unit names without one
of the valid suffixes as a service.
'''
if not isinstance(name, six.string_types):
name = six.text_type(name)
if any(name.endswith(suffix) for suffix in VALID_UNIT_TYPES):
return name
... | [
"Build",
"a",
"canonical",
"unit",
"name",
"treating",
"unit",
"names",
"without",
"one",
"of",
"the",
"valid",
"suffixes",
"as",
"a",
"service",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L83-L92 | [
"def",
"_canonical_unit_name",
"(",
"name",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"six",
".",
"string_types",
")",
":",
"name",
"=",
"six",
".",
"text_type",
"(",
"name",
")",
"if",
"any",
"(",
"name",
".",
"endswith",
"(",
"suffix",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_available | Returns boolean telling whether or not the named service is available | salt/modules/systemd_service.py | def _check_available(name):
'''
Returns boolean telling whether or not the named service is available
'''
_status = _systemctl_status(name)
sd_version = salt.utils.systemd.version(__context__)
if sd_version is not None and sd_version >= 231:
# systemd 231 changed the output of "systemctl... | def _check_available(name):
'''
Returns boolean telling whether or not the named service is available
'''
_status = _systemctl_status(name)
sd_version = salt.utils.systemd.version(__context__)
if sd_version is not None and sd_version >= 231:
# systemd 231 changed the output of "systemctl... | [
"Returns",
"boolean",
"telling",
"whether",
"or",
"not",
"the",
"named",
"service",
"is",
"available"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L95-L125 | [
"def",
"_check_available",
"(",
"name",
")",
":",
"_status",
"=",
"_systemctl_status",
"(",
"name",
")",
"sd_version",
"=",
"salt",
".",
"utils",
".",
"systemd",
".",
"version",
"(",
"__context__",
")",
"if",
"sd_version",
"is",
"not",
"None",
"and",
"sd_v... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_for_unit_changes | Check for modified/updated unit files, and run a daemon-reload if any are
found. | salt/modules/systemd_service.py | def _check_for_unit_changes(name):
'''
Check for modified/updated unit files, and run a daemon-reload if any are
found.
'''
contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)
if contextkey not in __context__:
if _untracked_custom_unit_found(name) or _unit_file_changed(name):... | def _check_for_unit_changes(name):
'''
Check for modified/updated unit files, and run a daemon-reload if any are
found.
'''
contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)
if contextkey not in __context__:
if _untracked_custom_unit_found(name) or _unit_file_changed(name):... | [
"Check",
"for",
"modified",
"/",
"updated",
"unit",
"files",
"and",
"run",
"a",
"daemon",
"-",
"reload",
"if",
"any",
"are",
"found",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L128-L138 | [
"def",
"_check_for_unit_changes",
"(",
"name",
")",
":",
"contextkey",
"=",
"'systemd._check_for_unit_changes.{0}'",
".",
"format",
"(",
"name",
")",
"if",
"contextkey",
"not",
"in",
"__context__",
":",
"if",
"_untracked_custom_unit_found",
"(",
"name",
")",
"or",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _check_unmask | Common code for conditionally removing masks before making changes to a
service's state. | salt/modules/systemd_service.py | def _check_unmask(name, unmask, unmask_runtime, root=None):
'''
Common code for conditionally removing masks before making changes to a
service's state.
'''
if unmask:
unmask_(name, runtime=False, root=root)
if unmask_runtime:
unmask_(name, runtime=True, root=root) | def _check_unmask(name, unmask, unmask_runtime, root=None):
'''
Common code for conditionally removing masks before making changes to a
service's state.
'''
if unmask:
unmask_(name, runtime=False, root=root)
if unmask_runtime:
unmask_(name, runtime=True, root=root) | [
"Common",
"code",
"for",
"conditionally",
"removing",
"masks",
"before",
"making",
"changes",
"to",
"a",
"service",
"s",
"state",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L141-L149 | [
"def",
"_check_unmask",
"(",
"name",
",",
"unmask",
",",
"unmask_runtime",
",",
"root",
"=",
"None",
")",
":",
"if",
"unmask",
":",
"unmask_",
"(",
"name",
",",
"runtime",
"=",
"False",
",",
"root",
"=",
"root",
")",
"if",
"unmask_runtime",
":",
"unmas... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _clear_context | Remove context | salt/modules/systemd_service.py | def _clear_context():
'''
Remove context
'''
# Using list() here because modifying a dictionary during iteration will
# raise a RuntimeError.
for key in list(__context__):
try:
if key.startswith('systemd._systemctl_status.'):
__context__.pop(key)
excep... | def _clear_context():
'''
Remove context
'''
# Using list() here because modifying a dictionary during iteration will
# raise a RuntimeError.
for key in list(__context__):
try:
if key.startswith('systemd._systemctl_status.'):
__context__.pop(key)
excep... | [
"Remove",
"context"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L152-L163 | [
"def",
"_clear_context",
"(",
")",
":",
"# Using list() here because modifying a dictionary during iteration will",
"# raise a RuntimeError.",
"for",
"key",
"in",
"list",
"(",
"__context__",
")",
":",
"try",
":",
"if",
"key",
".",
"startswith",
"(",
"'systemd._systemctl_s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _default_runlevel | Try to figure out the default runlevel. It is kept in
/etc/init/rc-sysinit.conf, but can be overridden with entries
in /etc/inittab, or via the kernel command-line at boot | salt/modules/systemd_service.py | def _default_runlevel():
'''
Try to figure out the default runlevel. It is kept in
/etc/init/rc-sysinit.conf, but can be overridden with entries
in /etc/inittab, or via the kernel command-line at boot
'''
# Try to get the "main" default. If this fails, throw up our
# hands and just guess "... | def _default_runlevel():
'''
Try to figure out the default runlevel. It is kept in
/etc/init/rc-sysinit.conf, but can be overridden with entries
in /etc/inittab, or via the kernel command-line at boot
'''
# Try to get the "main" default. If this fails, throw up our
# hands and just guess "... | [
"Try",
"to",
"figure",
"out",
"the",
"default",
"runlevel",
".",
"It",
"is",
"kept",
"in",
"/",
"etc",
"/",
"init",
"/",
"rc",
"-",
"sysinit",
".",
"conf",
"but",
"can",
"be",
"overridden",
"with",
"entries",
"in",
"/",
"etc",
"/",
"inittab",
"or",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L166-L208 | [
"def",
"_default_runlevel",
"(",
")",
":",
"# Try to get the \"main\" default. If this fails, throw up our",
"# hands and just guess \"2\", because things are horribly broken",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"'/etc/init/rc-sysinit.conf... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_systemd_services | Use os.listdir() to get all the unit files | salt/modules/systemd_service.py | def _get_systemd_services(root):
'''
Use os.listdir() to get all the unit files
'''
ret = set()
for path in SYSTEM_CONFIG_PATHS + (LOCAL_CONFIG_PATH,):
# Make sure user has access to the path, and if the path is a
# link it's likely that another entry in SYSTEM_CONFIG_PATHS
#... | def _get_systemd_services(root):
'''
Use os.listdir() to get all the unit files
'''
ret = set()
for path in SYSTEM_CONFIG_PATHS + (LOCAL_CONFIG_PATH,):
# Make sure user has access to the path, and if the path is a
# link it's likely that another entry in SYSTEM_CONFIG_PATHS
#... | [
"Use",
"os",
".",
"listdir",
"()",
"to",
"get",
"all",
"the",
"unit",
"files"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L211-L229 | [
"def",
"_get_systemd_services",
"(",
"root",
")",
":",
"ret",
"=",
"set",
"(",
")",
"for",
"path",
"in",
"SYSTEM_CONFIG_PATHS",
"+",
"(",
"LOCAL_CONFIG_PATH",
",",
")",
":",
"# Make sure user has access to the path, and if the path is a",
"# link it's likely that another ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_sysv_services | Use os.listdir() and os.access() to get all the initscripts | salt/modules/systemd_service.py | def _get_sysv_services(root, systemd_services=None):
'''
Use os.listdir() and os.access() to get all the initscripts
'''
initscript_path = _root(INITSCRIPT_PATH, root)
try:
sysv_services = os.listdir(initscript_path)
except OSError as exc:
if exc.errno == errno.ENOENT:
... | def _get_sysv_services(root, systemd_services=None):
'''
Use os.listdir() and os.access() to get all the initscripts
'''
initscript_path = _root(INITSCRIPT_PATH, root)
try:
sysv_services = os.listdir(initscript_path)
except OSError as exc:
if exc.errno == errno.ENOENT:
... | [
"Use",
"os",
".",
"listdir",
"()",
"and",
"os",
".",
"access",
"()",
"to",
"get",
"all",
"the",
"initscripts"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L232-L269 | [
"def",
"_get_sysv_services",
"(",
"root",
",",
"systemd_services",
"=",
"None",
")",
":",
"initscript_path",
"=",
"_root",
"(",
"INITSCRIPT_PATH",
",",
"root",
")",
"try",
":",
"sysv_services",
"=",
"os",
".",
"listdir",
"(",
"initscript_path",
")",
"except",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_service_exec | Returns the path to the sysv service manager (either update-rc.d or
chkconfig) | salt/modules/systemd_service.py | def _get_service_exec():
'''
Returns the path to the sysv service manager (either update-rc.d or
chkconfig)
'''
contextkey = 'systemd._get_service_exec'
if contextkey not in __context__:
executables = ('update-rc.d', 'chkconfig')
for executable in executables:
service... | def _get_service_exec():
'''
Returns the path to the sysv service manager (either update-rc.d or
chkconfig)
'''
contextkey = 'systemd._get_service_exec'
if contextkey not in __context__:
executables = ('update-rc.d', 'chkconfig')
for executable in executables:
service... | [
"Returns",
"the",
"path",
"to",
"the",
"sysv",
"service",
"manager",
"(",
"either",
"update",
"-",
"rc",
".",
"d",
"or",
"chkconfig",
")"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L272-L291 | [
"def",
"_get_service_exec",
"(",
")",
":",
"contextkey",
"=",
"'systemd._get_service_exec'",
"if",
"contextkey",
"not",
"in",
"__context__",
":",
"executables",
"=",
"(",
"'update-rc.d'",
",",
"'chkconfig'",
")",
"for",
"executable",
"in",
"executables",
":",
"ser... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _runlevel | Return the current runlevel | salt/modules/systemd_service.py | def _runlevel():
'''
Return the current runlevel
'''
contextkey = 'systemd._runlevel'
if contextkey in __context__:
return __context__[contextkey]
out = __salt__['cmd.run']('runlevel', python_shell=False, ignore_retcode=True)
try:
ret = out.split()[1]
except IndexError:
... | def _runlevel():
'''
Return the current runlevel
'''
contextkey = 'systemd._runlevel'
if contextkey in __context__:
return __context__[contextkey]
out = __salt__['cmd.run']('runlevel', python_shell=False, ignore_retcode=True)
try:
ret = out.split()[1]
except IndexError:
... | [
"Return",
"the",
"current",
"runlevel"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L294-L308 | [
"def",
"_runlevel",
"(",
")",
":",
"contextkey",
"=",
"'systemd._runlevel'",
"if",
"contextkey",
"in",
"__context__",
":",
"return",
"__context__",
"[",
"contextkey",
"]",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"'runlevel'",
",",
"python_shell",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _strip_scope | Strip unnecessary message about running the command with --scope from
stderr so that we can raise an exception with the remaining stderr text. | salt/modules/systemd_service.py | def _strip_scope(msg):
'''
Strip unnecessary message about running the command with --scope from
stderr so that we can raise an exception with the remaining stderr text.
'''
ret = []
for line in msg.splitlines():
if not line.endswith('.scope'):
ret.append(line)
return '\n... | def _strip_scope(msg):
'''
Strip unnecessary message about running the command with --scope from
stderr so that we can raise an exception with the remaining stderr text.
'''
ret = []
for line in msg.splitlines():
if not line.endswith('.scope'):
ret.append(line)
return '\n... | [
"Strip",
"unnecessary",
"message",
"about",
"running",
"the",
"command",
"with",
"--",
"scope",
"from",
"stderr",
"so",
"that",
"we",
"can",
"raise",
"an",
"exception",
"with",
"the",
"remaining",
"stderr",
"text",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L311-L320 | [
"def",
"_strip_scope",
"(",
"msg",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"line",
"in",
"msg",
".",
"splitlines",
"(",
")",
":",
"if",
"not",
"line",
".",
"endswith",
"(",
"'.scope'",
")",
":",
"ret",
".",
"append",
"(",
"line",
")",
"return",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _systemctl_cmd | Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service. | salt/modules/systemd_service.py | def _systemctl_cmd(action, name=None, systemd_scope=False, no_block=False,
root=None):
'''
Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service.
'''
ret = []
if systemd_scope \
and salt.utils.systemd.has_scope(__context__)... | def _systemctl_cmd(action, name=None, systemd_scope=False, no_block=False,
root=None):
'''
Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service.
'''
ret = []
if systemd_scope \
and salt.utils.systemd.has_scope(__context__)... | [
"Build",
"a",
"systemctl",
"command",
"line",
".",
"Treat",
"unit",
"names",
"without",
"one",
"of",
"the",
"valid",
"suffixes",
"as",
"a",
"service",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L323-L346 | [
"def",
"_systemctl_cmd",
"(",
"action",
",",
"name",
"=",
"None",
",",
"systemd_scope",
"=",
"False",
",",
"no_block",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"systemd_scope",
"and",
"salt",
".",
"utils",
".",
"s... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _systemctl_status | Helper function which leverages __context__ to keep from running 'systemctl
status' more than once. | salt/modules/systemd_service.py | def _systemctl_status(name):
'''
Helper function which leverages __context__ to keep from running 'systemctl
status' more than once.
'''
contextkey = 'systemd._systemctl_status.%s' % name
if contextkey in __context__:
return __context__[contextkey]
__context__[contextkey] = __salt__[... | def _systemctl_status(name):
'''
Helper function which leverages __context__ to keep from running 'systemctl
status' more than once.
'''
contextkey = 'systemd._systemctl_status.%s' % name
if contextkey in __context__:
return __context__[contextkey]
__context__[contextkey] = __salt__[... | [
"Helper",
"function",
"which",
"leverages",
"__context__",
"to",
"keep",
"from",
"running",
"systemctl",
"status",
"more",
"than",
"once",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L349-L363 | [
"def",
"_systemctl_status",
"(",
"name",
")",
":",
"contextkey",
"=",
"'systemd._systemctl_status.%s'",
"%",
"name",
"if",
"contextkey",
"in",
"__context__",
":",
"return",
"__context__",
"[",
"contextkey",
"]",
"__context__",
"[",
"contextkey",
"]",
"=",
"__salt_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sysv_enabled | A System-V style service is assumed disabled if the "startup" symlink
(starts with "S") to its script is found in /etc/init.d in the current
runlevel. | salt/modules/systemd_service.py | def _sysv_enabled(name, root):
'''
A System-V style service is assumed disabled if the "startup" symlink
(starts with "S") to its script is found in /etc/init.d in the current
runlevel.
'''
# Find exact match (disambiguate matches like "S01anacron" for cron)
rc = _root('/etc/rc{}.d/S*{}'.for... | def _sysv_enabled(name, root):
'''
A System-V style service is assumed disabled if the "startup" symlink
(starts with "S") to its script is found in /etc/init.d in the current
runlevel.
'''
# Find exact match (disambiguate matches like "S01anacron" for cron)
rc = _root('/etc/rc{}.d/S*{}'.for... | [
"A",
"System",
"-",
"V",
"style",
"service",
"is",
"assumed",
"disabled",
"if",
"the",
"startup",
"symlink",
"(",
"starts",
"with",
"S",
")",
"to",
"its",
"script",
"is",
"found",
"in",
"/",
"etc",
"/",
"init",
".",
"d",
"in",
"the",
"current",
"runl... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L366-L377 | [
"def",
"_sysv_enabled",
"(",
"name",
",",
"root",
")",
":",
"# Find exact match (disambiguate matches like \"S01anacron\" for cron)",
"rc",
"=",
"_root",
"(",
"'/etc/rc{}.d/S*{}'",
".",
"format",
"(",
"_runlevel",
"(",
")",
",",
"name",
")",
",",
"root",
")",
"for... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _untracked_custom_unit_found | If the passed service name is not available, but a unit file exist in
/etc/systemd/system, return True. Otherwise, return False. | salt/modules/systemd_service.py | def _untracked_custom_unit_found(name, root=None):
'''
If the passed service name is not available, but a unit file exist in
/etc/systemd/system, return True. Otherwise, return False.
'''
system = _root('/etc/systemd/system', root)
unit_path = os.path.join(system, _canonical_unit_name(name))
... | def _untracked_custom_unit_found(name, root=None):
'''
If the passed service name is not available, but a unit file exist in
/etc/systemd/system, return True. Otherwise, return False.
'''
system = _root('/etc/systemd/system', root)
unit_path = os.path.join(system, _canonical_unit_name(name))
... | [
"If",
"the",
"passed",
"service",
"name",
"is",
"not",
"available",
"but",
"a",
"unit",
"file",
"exist",
"in",
"/",
"etc",
"/",
"systemd",
"/",
"system",
"return",
"True",
".",
"Otherwise",
"return",
"False",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L380-L387 | [
"def",
"_untracked_custom_unit_found",
"(",
"name",
",",
"root",
"=",
"None",
")",
":",
"system",
"=",
"_root",
"(",
"'/etc/systemd/system'",
",",
"root",
")",
"unit_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"system",
",",
"_canonical_unit_name",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | systemctl_reload | .. versionadded:: 0.15.0
Reloads systemctl, an action needed whenever unit files are updated.
CLI Example:
.. code-block:: bash
salt '*' service.systemctl_reload | salt/modules/systemd_service.py | def systemctl_reload():
'''
.. versionadded:: 0.15.0
Reloads systemctl, an action needed whenever unit files are updated.
CLI Example:
.. code-block:: bash
salt '*' service.systemctl_reload
'''
out = __salt__['cmd.run_all'](
_systemctl_cmd('--system daemon-reload'),
... | def systemctl_reload():
'''
.. versionadded:: 0.15.0
Reloads systemctl, an action needed whenever unit files are updated.
CLI Example:
.. code-block:: bash
salt '*' service.systemctl_reload
'''
out = __salt__['cmd.run_all'](
_systemctl_cmd('--system daemon-reload'),
... | [
"..",
"versionadded",
"::",
"0",
".",
"15",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L399-L420 | [
"def",
"systemctl_reload",
"(",
")",
":",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"_systemctl_cmd",
"(",
"'--system daemon-reload'",
")",
",",
"python_shell",
"=",
"False",
",",
"redirect_stderr",
"=",
"True",
")",
"if",
"out",
"[",
"'retcode'"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_running | Return a list of all running services, so far as systemd is concerned
CLI Example:
.. code-block:: bash
salt '*' service.get_running | salt/modules/systemd_service.py | def get_running():
'''
Return a list of all running services, so far as systemd is concerned
CLI Example:
.. code-block:: bash
salt '*' service.get_running
'''
ret = set()
# Get running systemd units
out = __salt__['cmd.run'](
_systemctl_cmd('--full --no-legend --no-pa... | def get_running():
'''
Return a list of all running services, so far as systemd is concerned
CLI Example:
.. code-block:: bash
salt '*' service.get_running
'''
ret = set()
# Get running systemd units
out = __salt__['cmd.run'](
_systemctl_cmd('--full --no-legend --no-pa... | [
"Return",
"a",
"list",
"of",
"all",
"running",
"services",
"so",
"far",
"as",
"systemd",
"is",
"concerned"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L423-L458 | [
"def",
"get_running",
"(",
")",
":",
"ret",
"=",
"set",
"(",
")",
"# Get running systemd units",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"_systemctl_cmd",
"(",
"'--full --no-legend --no-pager'",
")",
",",
"python_shell",
"=",
"False",
",",
"ignore_re... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_static | .. versionadded:: 2015.8.5
Return a list of all static services
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.get_static | salt/modules/systemd_service.py | def get_static(root=None):
'''
.. versionadded:: 2015.8.5
Return a list of all static services
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.get_static
'''
ret = set()
# Get static systemd u... | def get_static(root=None):
'''
.. versionadded:: 2015.8.5
Return a list of all static services
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.get_static
'''
ret = set()
# Get static systemd u... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"5"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L547-L586 | [
"def",
"get_static",
"(",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"set",
"(",
")",
"# Get static systemd units. Can't use --state=static here because it's",
"# not present until systemd 216.",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"_systemctl_cmd",
"(",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_all | Return a list of all available services
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.get_all | salt/modules/systemd_service.py | def get_all(root=None):
'''
Return a list of all available services
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
ret = _get_systemd_services(root)
ret.update(set(_get_sysv_services(r... | def get_all(root=None):
'''
Return a list of all available services
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
ret = _get_systemd_services(root)
ret.update(set(_get_sysv_services(r... | [
"Return",
"a",
"list",
"of",
"all",
"available",
"services"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L589-L604 | [
"def",
"get_all",
"(",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"_get_systemd_services",
"(",
"root",
")",
"ret",
".",
"update",
"(",
"set",
"(",
"_get_sysv_services",
"(",
"root",
",",
"systemd_services",
"=",
"ret",
")",
")",
")",
"return",
"sorted",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | unmask_ | .. versionadded:: 2015.5.0
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases where
t... | salt/modules/systemd_service.py | def unmask_(name, runtime=False, root=None):
'''
.. versionadded:: 2015.5.0
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This i... | def unmask_(name, runtime=False, root=None):
'''
.. versionadded:: 2015.5.0
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This i... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0",
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"r... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L641-L693 | [
"def",
"unmask_",
"(",
"name",
",",
"runtime",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"_check_for_unit_changes",
"(",
"name",
")",
"if",
"not",
"masked",
"(",
"name",
",",
"runtime",
",",
"root",
"=",
"root",
")",
":",
"log",
".",
"debug",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mask | .. versionadded:: 2015.5.0
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases where
t... | salt/modules/systemd_service.py | def mask(name, runtime=False, root=None):
'''
.. versionadded:: 2015.5.0
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is d... | def mask(name, runtime=False, root=None):
'''
.. versionadded:: 2015.5.0
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is d... | [
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"0",
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"r... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L696-L741 | [
"def",
"mask",
"(",
"name",
",",
"runtime",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"_check_for_unit_changes",
"(",
"name",
")",
"cmd",
"=",
"'mask --runtime'",
"if",
"runtime",
"else",
"'mask'",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",
"]",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | masked | .. versionadded:: 2015.8.0
.. versionchanged:: 2015.8.5
The return data for this function has changed. If the service is
masked, the return value will now be the output of the ``systemctl
is-enabled`` command (so that a persistent mask can be distinguished
from a runtime mask). If th... | salt/modules/systemd_service.py | def masked(name, runtime=False, root=None):
'''
.. versionadded:: 2015.8.0
.. versionchanged:: 2015.8.5
The return data for this function has changed. If the service is
masked, the return value will now be the output of the ``systemctl
is-enabled`` command (so that a persistent mask ... | def masked(name, runtime=False, root=None):
'''
.. versionadded:: 2015.8.0
.. versionchanged:: 2015.8.5
The return data for this function has changed. If the service is
masked, the return value will now be the output of the ``systemctl
is-enabled`` command (so that a persistent mask ... | [
"..",
"versionadded",
"::",
"2015",
".",
"8",
".",
"0",
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"5",
"The",
"return",
"data",
"for",
"this",
"function",
"has",
"changed",
".",
"If",
"the",
"service",
"is",
"masked",
"the",
"return",
"value... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L744-L805 | [
"def",
"masked",
"(",
"name",
",",
"runtime",
"=",
"False",
",",
"root",
"=",
"None",
")",
":",
"_check_for_unit_changes",
"(",
"name",
")",
"root_dir",
"=",
"_root",
"(",
"'/run'",
"if",
"runtime",
"else",
"'/etc'",
",",
"root",
")",
"link_path",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stop | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases where
the ``salt-minion`` service is r... | salt/modules/systemd_service.py | def stop(name, no_block=False):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases wh... | def stop(name, no_block=False):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases wh... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L864-L894 | [
"def",
"stop",
"(",
"name",
",",
"no_block",
"=",
"False",
")",
":",
"_check_for_unit_changes",
"(",
"name",
")",
"# Using cmd.run_all instead of cmd.retcode here to make unit tests easier",
"return",
"__salt__",
"[",
"'cmd.run_all'",
"]",
"(",
"_systemctl_cmd",
"(",
"'... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | restart | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases where
the ``salt-minion`` service is r... | salt/modules/systemd_service.py | def restart(name, no_block=False, unmask=False, unmask_runtime=False):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is don... | def restart(name, no_block=False, unmask=False, unmask_runtime=False):
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is don... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L897-L950 | [
"def",
"restart",
"(",
"name",
",",
"no_block",
"=",
"False",
",",
"unmask",
"=",
"False",
",",
"unmask_runtime",
"=",
"False",
")",
":",
"_check_for_unit_changes",
"(",
"name",
")",
"_check_unmask",
"(",
"name",
",",
"unmask",
",",
"unmask_runtime",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | status | Return the status for a service via systemd.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of the service to check
sig (str... | salt/modules/systemd_service.py | def status(name, sig=None): # pylint: disable=unused-argument
'''
Return the status for a service via systemd.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
... | def status(name, sig=None): # pylint: disable=unused-argument
'''
Return the status for a service via systemd.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
... | [
"Return",
"the",
"status",
"for",
"a",
"service",
"via",
"systemd",
".",
"If",
"the",
"name",
"contains",
"globbing",
"a",
"dict",
"mapping",
"service",
"name",
"to",
"True",
"/",
"False",
"values",
"is",
"returned",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1070-L1107 | [
"def",
"status",
"(",
"name",
",",
"sig",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"contains_globbing",
"=",
"bool",
"(",
"re",
".",
"search",
"(",
"r'\\*|\\?|\\[.+\\]'",
",",
"name",
")",
")",
"if",
"contains_globbing",
":",
"services",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enable | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases where
the ``salt-minion`` service is r... | salt/modules/systemd_service.py | def enable(name, no_block=False, unmask=False, unmask_runtime=False,
root=None, **kwargs): # pylint: disable=unused-argument
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function fr... | def enable(name, no_block=False, unmask=False, unmask_runtime=False,
root=None, **kwargs): # pylint: disable=unused-argument
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function fr... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1112-L1184 | [
"def",
"enable",
"(",
"name",
",",
"no_block",
"=",
"False",
",",
"unmask",
"=",
"False",
",",
"unmask_runtime",
"=",
"False",
",",
"root",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"_check_for_unit_changes",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | disable | .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
control group. This is done to avoid a race condition in cases where
the ``salt-minion`` service is r... | salt/modules/systemd_service.py | def disable(name, no_block=False, root=None, **kwargs): # pylint: disable=unused-argument
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
contro... | def disable(name, no_block=False, root=None, **kwargs): # pylint: disable=unused-argument
'''
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
On minions running systemd>=205, `systemd-run(1)`_ is now used to
isolate commands run by this function from the ``salt-minion`` daemon's
contro... | [
"..",
"versionchanged",
"::",
"2015",
".",
"8",
".",
"12",
"2016",
".",
"3",
".",
"3",
"2016",
".",
"11",
".",
"0",
"On",
"minions",
"running",
"systemd",
">",
"=",
"205",
"systemd",
"-",
"run",
"(",
"1",
")",
"_",
"is",
"now",
"used",
"to",
"i... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1189-L1237 | [
"def",
"disable",
"(",
"name",
",",
"no_block",
"=",
"False",
",",
"root",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"_check_for_unit_changes",
"(",
"name",
")",
"if",
"name",
"in",
"_get_sysv_services",
"(",
"root",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | enabled | Return if the named service is enabled to start on boot
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name> | salt/modules/systemd_service.py | def enabled(name, root=None, **kwargs): # pylint: disable=unused-argument
'''
Return if the named service is enabled to start on boot
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
... | def enabled(name, root=None, **kwargs): # pylint: disable=unused-argument
'''
Return if the named service is enabled to start on boot
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
... | [
"Return",
"if",
"the",
"named",
"service",
"is",
"enabled",
"to",
"start",
"on",
"boot"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1242-L1276 | [
"def",
"enabled",
"(",
"name",
",",
"root",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"# Try 'systemctl is-enabled' first, then look for a symlink created by",
"# systemctl (older systemd releases did not support using is-enabled to",
"# c... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show | .. versionadded:: 2014.7.0
Show properties of one or more units/jobs or the manager
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
salt '*' service.show <service name> | salt/modules/systemd_service.py | def show(name, root=None):
'''
.. versionadded:: 2014.7.0
Show properties of one or more units/jobs or the manager
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
salt '*' service.show <service name>
'''
ret = {}
out = __salt__['cmd.ru... | def show(name, root=None):
'''
.. versionadded:: 2014.7.0
Show properties of one or more units/jobs or the manager
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
salt '*' service.show <service name>
'''
ret = {}
out = __salt__['cmd.ru... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1295-L1326 | [
"def",
"show",
"(",
"name",
",",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"out",
"=",
"__salt__",
"[",
"'cmd.run'",
"]",
"(",
"_systemctl_cmd",
"(",
"'show'",
",",
"name",
",",
"root",
"=",
"root",
")",
",",
"python_shell",
"=",
"False"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | execs | .. versionadded:: 2014.7.0
Return a list of all files specified as ``ExecStart`` for all services.
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
salt '*' service.execs | salt/modules/systemd_service.py | def execs(root=None):
'''
.. versionadded:: 2014.7.0
Return a list of all files specified as ``ExecStart`` for all services.
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
salt '*' service.execs
'''
ret = {}
for service in get_all(roo... | def execs(root=None):
'''
.. versionadded:: 2014.7.0
Return a list of all files specified as ``ExecStart`` for all services.
root
Enable/disable/mask unit files in the specified root directory
CLI Example:
salt '*' service.execs
'''
ret = {}
for service in get_all(roo... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/systemd_service.py#L1329-L1348 | [
"def",
"execs",
"(",
"root",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"service",
"in",
"get_all",
"(",
"root",
"=",
"root",
")",
":",
"data",
"=",
"show",
"(",
"service",
",",
"root",
"=",
"root",
")",
"if",
"'ExecStart'",
"not",
"in",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | keys | Manage libvirt keys.
name
The name variable used to track the execution
basepath
Defaults to ``/etc/pki``, this is the root location used for libvirt
keys on the hypervisor
The following parameters are optional:
country
The country that the certificate should ... | salt/states/virt.py | def keys(name, basepath='/etc/pki', **kwargs):
'''
Manage libvirt keys.
name
The name variable used to track the execution
basepath
Defaults to ``/etc/pki``, this is the root location used for libvirt
keys on the hypervisor
The following parameters are optional:
c... | def keys(name, basepath='/etc/pki', **kwargs):
'''
Manage libvirt keys.
name
The name variable used to track the execution
basepath
Defaults to ``/etc/pki``, this is the root location used for libvirt
keys on the hypervisor
The following parameters are optional:
c... | [
"Manage",
"libvirt",
"keys",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L51-L145 | [
"def",
"keys",
"(",
"name",
",",
"basepath",
"=",
"'/etc/pki'",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
"}",
"# Grab all ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _virt_call | Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return: | salt/states/virt.py | def _virt_call(domain, function, section, comment,
connection=None, username=None, password=None, **kwargs):
'''
Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return:
'''
ret = {'name': domain,... | def _virt_call(domain, function, section, comment,
connection=None, username=None, password=None, **kwargs):
'''
Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return:
'''
ret = {'name': domain,... | [
"Helper",
"to",
"call",
"the",
"virt",
"functions",
".",
"Wildcards",
"supported",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L148-L184 | [
"def",
"_virt_call",
"(",
"domain",
",",
"function",
",",
"section",
",",
"comment",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"domai... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | stopped | Stops a VM by shutting it down nicely.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to connect w... | salt/states/virt.py | def stopped(name, connection=None, username=None, password=None):
'''
Stops a VM by shutting it down nicely.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
... | def stopped(name, connection=None, username=None, password=None):
'''
Stops a VM by shutting it down nicely.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
... | [
"Stops",
"a",
"VM",
"by",
"shutting",
"it",
"down",
"nicely",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L187-L210 | [
"def",
"stopped",
"(",
"name",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"return",
"_virt_call",
"(",
"name",
",",
"'shutdown'",
",",
"'stopped'",
",",
"\"Machine has been shut down\"",
",",
"connec... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | powered_off | Stops a VM by power off.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param password: password to connect with, overridin... | salt/states/virt.py | def powered_off(name, connection=None, username=None, password=None):
'''
Stops a VM by power off.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.... | def powered_off(name, connection=None, username=None, password=None):
'''
Stops a VM by power off.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.... | [
"Stops",
"a",
"VM",
"by",
"power",
"off",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L213-L236 | [
"def",
"powered_off",
"(",
"name",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"return",
"_virt_call",
"(",
"name",
",",
"'stop'",
",",
"'unpowered'",
",",
"'Machine has been powered off'",
",",
"conn... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | running | Starts an existing guest, or defines and starts a new VM with specified arguments.
.. versionadded:: 2016.3.0
:param name: name of the virtual machine to run
:param cpu: number of CPUs for the virtual machine to create
:param mem: amount of memory in MiB for the new virtual machine
:param image: d... | salt/states/virt.py | def running(name,
cpu=None,
mem=None,
image=None,
vm_type=None,
disk_profile=None,
disks=None,
nic_profile=None,
interfaces=None,
graphics=None,
loader=None,
seed=True,
install... | def running(name,
cpu=None,
mem=None,
image=None,
vm_type=None,
disk_profile=None,
disks=None,
nic_profile=None,
interfaces=None,
graphics=None,
loader=None,
seed=True,
install... | [
"Starts",
"an",
"existing",
"guest",
"or",
"defines",
"and",
"starts",
"a",
"new",
"VM",
"with",
"specified",
"arguments",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L239-L481 | [
"def",
"running",
"(",
"name",
",",
"cpu",
"=",
"None",
",",
"mem",
"=",
"None",
",",
"image",
"=",
"None",
",",
"vm_type",
"=",
"None",
",",
"disk_profile",
"=",
"None",
",",
"disks",
"=",
"None",
",",
"nic_profile",
"=",
"None",
",",
"interfaces",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | snapshot | Takes a snapshot of a particular VM or by a UNIX-style wildcard.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: username to connect with, overriding defaults
.. versionadded:: 2019.2.0
:param passw... | salt/states/virt.py | def snapshot(name, suffix=None, connection=None, username=None, password=None):
'''
Takes a snapshot of a particular VM or by a UNIX-style wildcard.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: userna... | def snapshot(name, suffix=None, connection=None, username=None, password=None):
'''
Takes a snapshot of a particular VM or by a UNIX-style wildcard.
.. versionadded:: 2016.3.0
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:param username: userna... | [
"Takes",
"a",
"snapshot",
"of",
"a",
"particular",
"VM",
"or",
"by",
"a",
"UNIX",
"-",
"style",
"wildcard",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/virt.py#L484-L512 | [
"def",
"snapshot",
"(",
"name",
",",
"suffix",
"=",
"None",
",",
"connection",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"return",
"_virt_call",
"(",
"name",
",",
"'snapshot'",
",",
"'saved'",
",",
"'Snapshot has ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.