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 | deployments | Return a list of kubernetes deployments defined in the namespace
CLI Examples::
salt '*' kubernetes.deployments
salt '*' kubernetes.deployments namespace=default | salt/modules/kubernetesmod.py | def deployments(namespace='default', **kwargs):
'''
Return a list of kubernetes deployments defined in the namespace
CLI Examples::
salt '*' kubernetes.deployments
salt '*' kubernetes.deployments namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kube... | def deployments(namespace='default', **kwargs):
'''
Return a list of kubernetes deployments defined in the namespace
CLI Examples::
salt '*' kubernetes.deployments
salt '*' kubernetes.deployments namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kube... | [
"Return",
"a",
"list",
"of",
"kubernetes",
"deployments",
"defined",
"in",
"the",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L429-L454 | [
"def",
"deployments",
"(",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client",
".",
"ExtensionsV1beta1Api",
"(",
")",
"ap... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | services | Return a list of kubernetes services defined in the namespace
CLI Examples::
salt '*' kubernetes.services
salt '*' kubernetes.services namespace=default | salt/modules/kubernetesmod.py | def services(namespace='default', **kwargs):
'''
Return a list of kubernetes services defined in the namespace
CLI Examples::
salt '*' kubernetes.services
salt '*' kubernetes.services namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.clien... | def services(namespace='default', **kwargs):
'''
Return a list of kubernetes services defined in the namespace
CLI Examples::
salt '*' kubernetes.services
salt '*' kubernetes.services namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.clien... | [
"Return",
"a",
"list",
"of",
"kubernetes",
"services",
"defined",
"in",
"the",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L457-L482 | [
"def",
"services",
"(",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client",
".",
"CoreV1Api",
"(",
")",
"api_response",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | pods | Return a list of kubernetes pods defined in the namespace
CLI Examples::
salt '*' kubernetes.pods
salt '*' kubernetes.pods namespace=default | salt/modules/kubernetesmod.py | def pods(namespace='default', **kwargs):
'''
Return a list of kubernetes pods defined in the namespace
CLI Examples::
salt '*' kubernetes.pods
salt '*' kubernetes.pods namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.client.CoreV1Api()
... | def pods(namespace='default', **kwargs):
'''
Return a list of kubernetes pods defined in the namespace
CLI Examples::
salt '*' kubernetes.pods
salt '*' kubernetes.pods namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.client.CoreV1Api()
... | [
"Return",
"a",
"list",
"of",
"kubernetes",
"pods",
"defined",
"in",
"the",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L485-L510 | [
"def",
"pods",
"(",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client",
".",
"CoreV1Api",
"(",
")",
"api_response",
"="... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | configmaps | Return a list of kubernetes configmaps defined in the namespace
CLI Examples::
salt '*' kubernetes.configmaps
salt '*' kubernetes.configmaps namespace=default | salt/modules/kubernetesmod.py | def configmaps(namespace='default', **kwargs):
'''
Return a list of kubernetes configmaps defined in the namespace
CLI Examples::
salt '*' kubernetes.configmaps
salt '*' kubernetes.configmaps namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernet... | def configmaps(namespace='default', **kwargs):
'''
Return a list of kubernetes configmaps defined in the namespace
CLI Examples::
salt '*' kubernetes.configmaps
salt '*' kubernetes.configmaps namespace=default
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernet... | [
"Return",
"a",
"list",
"of",
"kubernetes",
"configmaps",
"defined",
"in",
"the",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L541-L566 | [
"def",
"configmaps",
"(",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client",
".",
"CoreV1Api",
"(",
")",
"api_response",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_deployment | Return the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.show_deployment my-nginx default
salt '*' kubernetes.show_deployment name=my-nginx namespace=default | salt/modules/kubernetesmod.py | def show_deployment(name, namespace='default', **kwargs):
'''
Return the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.show_deployment my-nginx default
salt '*' kubernetes.show_deployment name=my-nginx namespace=default
'''
cfg = _setup_conn... | def show_deployment(name, namespace='default', **kwargs):
'''
Return the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.show_deployment my-nginx default
salt '*' kubernetes.show_deployment name=my-nginx namespace=default
'''
cfg = _setup_conn... | [
"Return",
"the",
"kubernetes",
"deployment",
"defined",
"by",
"name",
"and",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L569-L594 | [
"def",
"show_deployment",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client",
".",
"ExtensionsV1beta1Api"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_namespace | Return information for a given namespace defined by the specified name
CLI Examples::
salt '*' kubernetes.show_namespace kube-system | salt/modules/kubernetesmod.py | def show_namespace(name, **kwargs):
'''
Return information for a given namespace defined by the specified name
CLI Examples::
salt '*' kubernetes.show_namespace kube-system
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.client.CoreV1Api()
api_response = ... | def show_namespace(name, **kwargs):
'''
Return information for a given namespace defined by the specified name
CLI Examples::
salt '*' kubernetes.show_namespace kube-system
'''
cfg = _setup_conn(**kwargs)
try:
api_instance = kubernetes.client.CoreV1Api()
api_response = ... | [
"Return",
"information",
"for",
"a",
"given",
"namespace",
"defined",
"by",
"the",
"specified",
"name"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L653-L677 | [
"def",
"show_namespace",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client",
".",
"CoreV1Api",
"(",
")",
"api_response",
"=",
"api_instance... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | show_secret | Return the kubernetes secret defined by name and namespace.
The secrets can be decoded if specified by the user. Warning: this has
security implications.
CLI Examples::
salt '*' kubernetes.show_secret confidential default
salt '*' kubernetes.show_secret name=confidential namespace=default
... | salt/modules/kubernetesmod.py | def show_secret(name, namespace='default', decode=False, **kwargs):
'''
Return the kubernetes secret defined by name and namespace.
The secrets can be decoded if specified by the user. Warning: this has
security implications.
CLI Examples::
salt '*' kubernetes.show_secret confidential defa... | def show_secret(name, namespace='default', decode=False, **kwargs):
'''
Return the kubernetes secret defined by name and namespace.
The secrets can be decoded if specified by the user. Warning: this has
security implications.
CLI Examples::
salt '*' kubernetes.show_secret confidential defa... | [
"Return",
"the",
"kubernetes",
"secret",
"defined",
"by",
"name",
"and",
"namespace",
".",
"The",
"secrets",
"can",
"be",
"decoded",
"if",
"specified",
"by",
"the",
"user",
".",
"Warning",
":",
"this",
"has",
"security",
"implications",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L680-L713 | [
"def",
"show_secret",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"decode",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_deployment | Deletes the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_deployment my-nginx
salt '*' kubernetes.delete_deployment name=my-nginx namespace=default | salt/modules/kubernetesmod.py | def delete_deployment(name, namespace='default', **kwargs):
'''
Deletes the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_deployment my-nginx
salt '*' kubernetes.delete_deployment name=my-nginx namespace=default
'''
cfg = _setup_conn(... | def delete_deployment(name, namespace='default', **kwargs):
'''
Deletes the kubernetes deployment defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_deployment my-nginx
salt '*' kubernetes.delete_deployment name=my-nginx namespace=default
'''
cfg = _setup_conn(... | [
"Deletes",
"the",
"kubernetes",
"deployment",
"defined",
"by",
"name",
"and",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L746-L798 | [
"def",
"delete_deployment",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"body",
"=",
"kubernetes",
".",
"client",
".",
"V1DeleteOptions",
"(",
"orphan_dependen... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_service | Deletes the kubernetes service defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_service my-nginx default
salt '*' kubernetes.delete_service name=my-nginx namespace=default | salt/modules/kubernetesmod.py | def delete_service(name, namespace='default', **kwargs):
'''
Deletes the kubernetes service defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_service my-nginx default
salt '*' kubernetes.delete_service name=my-nginx namespace=default
'''
cfg = _setup_conn(**kw... | def delete_service(name, namespace='default', **kwargs):
'''
Deletes the kubernetes service defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_service my-nginx default
salt '*' kubernetes.delete_service name=my-nginx namespace=default
'''
cfg = _setup_conn(**kw... | [
"Deletes",
"the",
"kubernetes",
"service",
"defined",
"by",
"name",
"and",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L801-L828 | [
"def",
"delete_service",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"try",
":",
"api_instance",
"=",
"kubernetes",
".",
"client",
".",
"CoreV1Api",
"(",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | delete_pod | Deletes the kubernetes pod defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_pod guestbook-708336848-5nl8c default
salt '*' kubernetes.delete_pod name=guestbook-708336848-5nl8c namespace=default | salt/modules/kubernetesmod.py | def delete_pod(name, namespace='default', **kwargs):
'''
Deletes the kubernetes pod defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_pod guestbook-708336848-5nl8c default
salt '*' kubernetes.delete_pod name=guestbook-708336848-5nl8c namespace=default
'''
cfg ... | def delete_pod(name, namespace='default', **kwargs):
'''
Deletes the kubernetes pod defined by name and namespace
CLI Examples::
salt '*' kubernetes.delete_pod guestbook-708336848-5nl8c default
salt '*' kubernetes.delete_pod name=guestbook-708336848-5nl8c namespace=default
'''
cfg ... | [
"Deletes",
"the",
"kubernetes",
"pod",
"defined",
"by",
"name",
"and",
"namespace"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L831-L861 | [
"def",
"delete_pod",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"cfg",
"=",
"_setup_conn",
"(",
"*",
"*",
"kwargs",
")",
"body",
"=",
"kubernetes",
".",
"client",
".",
"V1DeleteOptions",
"(",
"orphan_dependents",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_pod | Creates the kubernetes deployment as defined by the user. | salt/modules/kubernetesmod.py | def create_pod(
name,
namespace,
metadata,
spec,
source,
template,
saltenv,
**kwargs):
'''
Creates the kubernetes deployment as defined by the user.
'''
body = __create_object_body(
kind='Pod',
obj_class=kubernetes.client.V1... | def create_pod(
name,
namespace,
metadata,
spec,
source,
template,
saltenv,
**kwargs):
'''
Creates the kubernetes deployment as defined by the user.
'''
body = __create_object_body(
kind='Pod',
obj_class=kubernetes.client.V1... | [
"Creates",
"the",
"kubernetes",
"deployment",
"as",
"defined",
"by",
"the",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1003-L1045 | [
"def",
"create_pod",
"(",
"name",
",",
"namespace",
",",
"metadata",
",",
"spec",
",",
"source",
",",
"template",
",",
"saltenv",
",",
"*",
"*",
"kwargs",
")",
":",
"body",
"=",
"__create_object_body",
"(",
"kind",
"=",
"'Pod'",
",",
"obj_class",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_secret | Creates the kubernetes secret as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_secret \
passwords default '{"db": "letmein"}'
salt 'minion2' kubernetes.create_secret \
name=passwords namespace=default data='{"db": "letmein"}' | salt/modules/kubernetesmod.py | def create_secret(
name,
namespace='default',
data=None,
source=None,
template=None,
saltenv='base',
**kwargs):
'''
Creates the kubernetes secret as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_secret \
pas... | def create_secret(
name,
namespace='default',
data=None,
source=None,
template=None,
saltenv='base',
**kwargs):
'''
Creates the kubernetes secret as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_secret \
pas... | [
"Creates",
"the",
"kubernetes",
"secret",
"as",
"defined",
"by",
"the",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1093-L1145 | [
"def",
"create_secret",
"(",
"name",
",",
"namespace",
"=",
"'default'",
",",
"data",
"=",
"None",
",",
"source",
"=",
"None",
",",
"template",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"source",
":",
"data"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_configmap | Creates the kubernetes configmap as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_configmap \
settings default '{"example.conf": "# example file"}'
salt 'minion2' kubernetes.create_configmap \
name=settings namespace=default data='{"example.conf": "#... | salt/modules/kubernetesmod.py | def create_configmap(
name,
namespace,
data,
source=None,
template=None,
saltenv='base',
**kwargs):
'''
Creates the kubernetes configmap as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_configmap \
settings ... | def create_configmap(
name,
namespace,
data,
source=None,
template=None,
saltenv='base',
**kwargs):
'''
Creates the kubernetes configmap as defined by the user.
CLI Examples::
salt 'minion1' kubernetes.create_configmap \
settings ... | [
"Creates",
"the",
"kubernetes",
"configmap",
"as",
"defined",
"by",
"the",
"user",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1148-L1196 | [
"def",
"create_configmap",
"(",
"name",
",",
"namespace",
",",
"data",
",",
"source",
"=",
"None",
",",
"template",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"source",
":",
"data",
"=",
"__read_and_render_yaml_f... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | create_namespace | Creates a namespace with the specified name.
CLI Example:
salt '*' kubernetes.create_namespace salt
salt '*' kubernetes.create_namespace name=salt | salt/modules/kubernetesmod.py | def create_namespace(
name,
**kwargs):
'''
Creates a namespace with the specified name.
CLI Example:
salt '*' kubernetes.create_namespace salt
salt '*' kubernetes.create_namespace name=salt
'''
meta_obj = kubernetes.client.V1ObjectMeta(name=name)
body = kubernet... | def create_namespace(
name,
**kwargs):
'''
Creates a namespace with the specified name.
CLI Example:
salt '*' kubernetes.create_namespace salt
salt '*' kubernetes.create_namespace name=salt
'''
meta_obj = kubernetes.client.V1ObjectMeta(name=name)
body = kubernet... | [
"Creates",
"a",
"namespace",
"with",
"the",
"specified",
"name",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1199-L1231 | [
"def",
"create_namespace",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"meta_obj",
"=",
"kubernetes",
".",
"client",
".",
"V1ObjectMeta",
"(",
"name",
"=",
"name",
")",
"body",
"=",
"kubernetes",
".",
"client",
".",
"V1Namespace",
"(",
"metadata",
"=... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | replace_deployment | Replaces an existing deployment with a new one defined by name and
namespace, having the specificed metadata and spec. | salt/modules/kubernetesmod.py | def replace_deployment(name,
metadata,
spec,
source,
template,
saltenv,
namespace='default',
**kwargs):
'''
Replaces an existing deployment with a new ... | def replace_deployment(name,
metadata,
spec,
source,
template,
saltenv,
namespace='default',
**kwargs):
'''
Replaces an existing deployment with a new ... | [
"Replaces",
"an",
"existing",
"deployment",
"with",
"a",
"new",
"one",
"defined",
"by",
"name",
"and",
"namespace",
"having",
"the",
"specificed",
"metadata",
"and",
"spec",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1234-L1276 | [
"def",
"replace_deployment",
"(",
"name",
",",
"metadata",
",",
"spec",
",",
"source",
",",
"template",
",",
"saltenv",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"body",
"=",
"__create_object_body",
"(",
"kind",
"=",
"'Deployme... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | replace_service | Replaces an existing service with a new one defined by name and namespace,
having the specificed metadata and spec. | salt/modules/kubernetesmod.py | def replace_service(name,
metadata,
spec,
source,
template,
old_service,
saltenv,
namespace='default',
**kwargs):
'''
Replaces an existing service with ... | def replace_service(name,
metadata,
spec,
source,
template,
old_service,
saltenv,
namespace='default',
**kwargs):
'''
Replaces an existing service with ... | [
"Replaces",
"an",
"existing",
"service",
"with",
"a",
"new",
"one",
"defined",
"by",
"name",
"and",
"namespace",
"having",
"the",
"specificed",
"metadata",
"and",
"spec",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1279-L1327 | [
"def",
"replace_service",
"(",
"name",
",",
"metadata",
",",
"spec",
",",
"source",
",",
"template",
",",
"old_service",
",",
"saltenv",
",",
"namespace",
"=",
"'default'",
",",
"*",
"*",
"kwargs",
")",
":",
"body",
"=",
"__create_object_body",
"(",
"kind"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __create_object_body | Create a Kubernetes Object body instance. | salt/modules/kubernetesmod.py | def __create_object_body(kind,
obj_class,
spec_creator,
name,
namespace,
metadata,
spec,
source,
template,
... | def __create_object_body(kind,
obj_class,
spec_creator,
name,
namespace,
metadata,
spec,
source,
template,
... | [
"Create",
"a",
"Kubernetes",
"Object",
"body",
"instance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1434-L1464 | [
"def",
"__create_object_body",
"(",
"kind",
",",
"obj_class",
",",
"spec_creator",
",",
"name",
",",
"namespace",
",",
"metadata",
",",
"spec",
",",
"source",
",",
"template",
",",
"saltenv",
")",
":",
"if",
"source",
":",
"src_obj",
"=",
"__read_and_render_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __read_and_render_yaml_file | Read a yaml file and, if needed, renders that using the specifieds
templating. Returns the python objects defined inside of the file. | salt/modules/kubernetesmod.py | def __read_and_render_yaml_file(source,
template,
saltenv):
'''
Read a yaml file and, if needed, renders that using the specifieds
templating. Returns the python objects defined inside of the file.
'''
sfn = __salt__['cp.cache_file'](so... | def __read_and_render_yaml_file(source,
template,
saltenv):
'''
Read a yaml file and, if needed, renders that using the specifieds
templating. Returns the python objects defined inside of the file.
'''
sfn = __salt__['cp.cache_file'](so... | [
"Read",
"a",
"yaml",
"file",
"and",
"if",
"needed",
"renders",
"that",
"using",
"the",
"specifieds",
"templating",
".",
"Returns",
"the",
"python",
"objects",
"defined",
"inside",
"of",
"the",
"file",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1467-L1510 | [
"def",
"__read_and_render_yaml_file",
"(",
"source",
",",
"template",
",",
"saltenv",
")",
":",
"sfn",
"=",
"__salt__",
"[",
"'cp.cache_file'",
"]",
"(",
"source",
",",
"saltenv",
")",
"if",
"not",
"sfn",
":",
"raise",
"CommandExecutionError",
"(",
"'Source fi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __dict_to_object_meta | Converts a dictionary into kubernetes ObjectMetaV1 instance. | salt/modules/kubernetesmod.py | def __dict_to_object_meta(name, namespace, metadata):
'''
Converts a dictionary into kubernetes ObjectMetaV1 instance.
'''
meta_obj = kubernetes.client.V1ObjectMeta()
meta_obj.namespace = namespace
# Replicate `kubectl [create|replace|apply] --record`
if 'annotations' not in metadata:
... | def __dict_to_object_meta(name, namespace, metadata):
'''
Converts a dictionary into kubernetes ObjectMetaV1 instance.
'''
meta_obj = kubernetes.client.V1ObjectMeta()
meta_obj.namespace = namespace
# Replicate `kubectl [create|replace|apply] --record`
if 'annotations' not in metadata:
... | [
"Converts",
"a",
"dictionary",
"into",
"kubernetes",
"ObjectMetaV1",
"instance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1513-L1536 | [
"def",
"__dict_to_object_meta",
"(",
"name",
",",
"namespace",
",",
"metadata",
")",
":",
"meta_obj",
"=",
"kubernetes",
".",
"client",
".",
"V1ObjectMeta",
"(",
")",
"meta_obj",
".",
"namespace",
"=",
"namespace",
"# Replicate `kubectl [create|replace|apply] --record... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __dict_to_deployment_spec | Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance. | salt/modules/kubernetesmod.py | def __dict_to_deployment_spec(spec):
'''
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.
'''
spec_obj = AppsV1beta1DeploymentSpec(template=spec.get('template', ''))
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, valu... | def __dict_to_deployment_spec(spec):
'''
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.
'''
spec_obj = AppsV1beta1DeploymentSpec(template=spec.get('template', ''))
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, valu... | [
"Converts",
"a",
"dictionary",
"into",
"kubernetes",
"AppsV1beta1DeploymentSpec",
"instance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1539-L1548 | [
"def",
"__dict_to_deployment_spec",
"(",
"spec",
")",
":",
"spec_obj",
"=",
"AppsV1beta1DeploymentSpec",
"(",
"template",
"=",
"spec",
".",
"get",
"(",
"'template'",
",",
"''",
")",
")",
"for",
"key",
",",
"value",
"in",
"iteritems",
"(",
"spec",
")",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __dict_to_pod_spec | Converts a dictionary into kubernetes V1PodSpec instance. | salt/modules/kubernetesmod.py | def __dict_to_pod_spec(spec):
'''
Converts a dictionary into kubernetes V1PodSpec instance.
'''
spec_obj = kubernetes.client.V1PodSpec()
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, value)
return spec_obj | def __dict_to_pod_spec(spec):
'''
Converts a dictionary into kubernetes V1PodSpec instance.
'''
spec_obj = kubernetes.client.V1PodSpec()
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, value)
return spec_obj | [
"Converts",
"a",
"dictionary",
"into",
"kubernetes",
"V1PodSpec",
"instance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1551-L1560 | [
"def",
"__dict_to_pod_spec",
"(",
"spec",
")",
":",
"spec_obj",
"=",
"kubernetes",
".",
"client",
".",
"V1PodSpec",
"(",
")",
"for",
"key",
",",
"value",
"in",
"iteritems",
"(",
"spec",
")",
":",
"if",
"hasattr",
"(",
"spec_obj",
",",
"key",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __dict_to_service_spec | Converts a dictionary into kubernetes V1ServiceSpec instance. | salt/modules/kubernetesmod.py | def __dict_to_service_spec(spec):
'''
Converts a dictionary into kubernetes V1ServiceSpec instance.
'''
spec_obj = kubernetes.client.V1ServiceSpec()
for key, value in iteritems(spec): # pylint: disable=too-many-nested-blocks
if key == 'ports':
spec_obj.ports = []
for... | def __dict_to_service_spec(spec):
'''
Converts a dictionary into kubernetes V1ServiceSpec instance.
'''
spec_obj = kubernetes.client.V1ServiceSpec()
for key, value in iteritems(spec): # pylint: disable=too-many-nested-blocks
if key == 'ports':
spec_obj.ports = []
for... | [
"Converts",
"a",
"dictionary",
"into",
"kubernetes",
"V1ServiceSpec",
"instance",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1563-L1583 | [
"def",
"__dict_to_service_spec",
"(",
"spec",
")",
":",
"spec_obj",
"=",
"kubernetes",
".",
"client",
".",
"V1ServiceSpec",
"(",
")",
"for",
"key",
",",
"value",
"in",
"iteritems",
"(",
"spec",
")",
":",
"# pylint: disable=too-many-nested-blocks",
"if",
"key",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | __enforce_only_strings_dict | Returns a dictionary that has string keys and values. | salt/modules/kubernetesmod.py | def __enforce_only_strings_dict(dictionary):
'''
Returns a dictionary that has string keys and values.
'''
ret = {}
for key, value in iteritems(dictionary):
ret[six.text_type(key)] = six.text_type(value)
return ret | def __enforce_only_strings_dict(dictionary):
'''
Returns a dictionary that has string keys and values.
'''
ret = {}
for key, value in iteritems(dictionary):
ret[six.text_type(key)] = six.text_type(value)
return ret | [
"Returns",
"a",
"dictionary",
"that",
"has",
"string",
"keys",
"and",
"values",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kubernetesmod.py#L1586-L1595 | [
"def",
"__enforce_only_strings_dict",
"(",
"dictionary",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"iteritems",
"(",
"dictionary",
")",
":",
"ret",
"[",
"six",
".",
"text_type",
"(",
"key",
")",
"]",
"=",
"six",
".",
"text_type"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | VirtKey.accept | Accept the provided key | salt/utils/virt.py | def accept(self, pub):
'''
Accept the provided key
'''
try:
with salt.utils.files.fopen(self.path, 'r') as fp_:
expiry = int(fp_.read())
except (OSError, IOError):
log.error(
'Request to sign key for minion \'%s\' on hyper \... | def accept(self, pub):
'''
Accept the provided key
'''
try:
with salt.utils.files.fopen(self.path, 'r') as fp_:
expiry = int(fp_.read())
except (OSError, IOError):
log.error(
'Request to sign key for minion \'%s\' on hyper \... | [
"Accept",
"the",
"provided",
"key"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virt.py#L32-L64 | [
"def",
"accept",
"(",
"self",
",",
"pub",
")",
":",
"try",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"self",
".",
"path",
",",
"'r'",
")",
"as",
"fp_",
":",
"expiry",
"=",
"int",
"(",
"fp_",
".",
"read",
"(",
")",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | VirtKey.authorize | Prepare the master to expect a signing request | salt/utils/virt.py | def authorize(self):
'''
Prepare the master to expect a signing request
'''
with salt.utils.files.fopen(self.path, 'w+') as fp_:
fp_.write(str(int(time.time()))) # future lint: disable=blacklisted-function
return True | def authorize(self):
'''
Prepare the master to expect a signing request
'''
with salt.utils.files.fopen(self.path, 'w+') as fp_:
fp_.write(str(int(time.time()))) # future lint: disable=blacklisted-function
return True | [
"Prepare",
"the",
"master",
"to",
"expect",
"a",
"signing",
"request"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/virt.py#L66-L72 | [
"def",
"authorize",
"(",
"self",
")",
":",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"self",
".",
"path",
",",
"'w+'",
")",
"as",
"fp_",
":",
"fp_",
".",
"write",
"(",
"str",
"(",
"int",
"(",
"time",
".",
"time",
"(",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | patch | Main entry point for patching the ``collections.abc`` and ``inspect``
standard library modules. | salt/ext/backports_abc.py | def patch(patch_inspect=True):
"""
Main entry point for patching the ``collections.abc`` and ``inspect``
standard library modules.
"""
PATCHED['collections.abc.Generator'] = _collections_abc.Generator = Generator
PATCHED['collections.abc.Coroutine'] = _collections_abc.Coroutine = Coroutine
P... | def patch(patch_inspect=True):
"""
Main entry point for patching the ``collections.abc`` and ``inspect``
standard library modules.
"""
PATCHED['collections.abc.Generator'] = _collections_abc.Generator = Generator
PATCHED['collections.abc.Coroutine'] = _collections_abc.Coroutine = Coroutine
P... | [
"Main",
"entry",
"point",
"for",
"patching",
"the",
"collections",
".",
"abc",
"and",
"inspect",
"standard",
"library",
"modules",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/ext/backports_abc.py#L205-L216 | [
"def",
"patch",
"(",
"patch_inspect",
"=",
"True",
")",
":",
"PATCHED",
"[",
"'collections.abc.Generator'",
"]",
"=",
"_collections_abc",
".",
"Generator",
"=",
"Generator",
"PATCHED",
"[",
"'collections.abc.Coroutine'",
"]",
"=",
"_collections_abc",
".",
"Coroutine... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_auth | Parses the auth/authconfig line | salt/utils/kickstart.py | def parse_auth(rule):
'''
Parses the auth/authconfig line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
noargs = ('back', 'test', 'nostart', 'kickstart', 'probe', 'enablecache',
'disablecache', 'disablenis', 'enableshadow', 'disableshadow',
... | def parse_auth(rule):
'''
Parses the auth/authconfig line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
noargs = ('back', 'test', 'nostart', 'kickstart', 'probe', 'enablecache',
'disablecache', 'disablenis', 'enableshadow', 'disableshadow',
... | [
"Parses",
"the",
"auth",
"/",
"authconfig",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L25-L83 | [
"def",
"parse_auth",
"(",
"rule",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"rules",
"=",
"shlex",
".",
"split",
"(",
"rule",
")",
"rules",
".",
"pop",
"(",
"0",
")",
"noargs",
"=",
"(",
"'back'",
",",
"'test'",
",",
"'n... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_iscsiname | Parse the iscsiname line | salt/utils/kickstart.py | def parse_iscsiname(rule):
'''
Parse the iscsiname line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
#parser.add_argument('iqn')
args = clean_args(vars(parser.parse_args(rules)))
parser = None
return args | def parse_iscsiname(rule):
'''
Parse the iscsiname line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
#parser.add_argument('iqn')
args = clean_args(vars(parser.parse_args(rules)))
parser = None
return args | [
"Parse",
"the",
"iscsiname",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L345-L356 | [
"def",
"parse_iscsiname",
"(",
"rule",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"rules",
"=",
"shlex",
".",
"split",
"(",
"rule",
")",
"rules",
".",
"pop",
"(",
"0",
")",
"#parser.add_argument('iqn')",
"args",
"=",
"clean_args"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_partition | Parse the partition line | salt/utils/kickstart.py | def parse_partition(rule):
'''
Parse the partition line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
parser.add_argument('mntpoint')
parser.add_argument('--size', dest='size', action='store')
parser.add_argument('--grow', dest='grow', action='store_tr... | def parse_partition(rule):
'''
Parse the partition line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
parser.add_argument('mntpoint')
parser.add_argument('--size', dest='size', action='store')
parser.add_argument('--grow', dest='grow', action='store_tr... | [
"Parse",
"the",
"partition",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L528-L557 | [
"def",
"parse_partition",
"(",
"rule",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"rules",
"=",
"shlex",
".",
"split",
"(",
"rule",
")",
"rules",
".",
"pop",
"(",
"0",
")",
"parser",
".",
"add_argument",
"(",
"'mntpoint'",
")... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_raid | Parse the raid line | salt/utils/kickstart.py | def parse_raid(rule):
'''
Parse the raid line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
partitions = []
newrules = []
for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
... | def parse_raid(rule):
'''
Parse the raid line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
partitions = []
newrules = []
for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
... | [
"Parse",
"the",
"raid",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L560-L601 | [
"def",
"parse_raid",
"(",
"rule",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"rules",
"=",
"shlex",
".",
"split",
"(",
"rule",
")",
"rules",
".",
"pop",
"(",
"0",
")",
"partitions",
"=",
"[",
"]",
"newrules",
"=",
"[",
"]... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_services | Parse the services line | salt/utils/kickstart.py | def parse_services(rule):
'''
Parse the services line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
parser.add_argument('--disabled', dest='disabled', action='store')
parser.add_argument('--enabled', dest='enabled', action='store')
args = clean_args(v... | def parse_services(rule):
'''
Parse the services line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
parser.add_argument('--disabled', dest='disabled', action='store')
parser.add_argument('--enabled', dest='enabled', action='store')
args = clean_args(v... | [
"Parse",
"the",
"services",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L689-L701 | [
"def",
"parse_services",
"(",
"rule",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"rules",
"=",
"shlex",
".",
"split",
"(",
"rule",
")",
"rules",
".",
"pop",
"(",
"0",
")",
"parser",
".",
"add_argument",
"(",
"'--disabled'",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_updates | Parse the updates line | salt/utils/kickstart.py | def parse_updates(rule):
'''
Parse the updates line
'''
rules = shlex.split(rule)
rules.pop(0)
return {'url': rules[0]} if rules else True | def parse_updates(rule):
'''
Parse the updates line
'''
rules = shlex.split(rule)
rules.pop(0)
return {'url': rules[0]} if rules else True | [
"Parse",
"the",
"updates",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L739-L745 | [
"def",
"parse_updates",
"(",
"rule",
")",
":",
"rules",
"=",
"shlex",
".",
"split",
"(",
"rule",
")",
"rules",
".",
"pop",
"(",
"0",
")",
"return",
"{",
"'url'",
":",
"rules",
"[",
"0",
"]",
"}",
"if",
"rules",
"else",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_volgroup | Parse the volgroup line | salt/utils/kickstart.py | def parse_volgroup(rule):
'''
Parse the volgroup line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
partitions = []
newrules = []
for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
... | def parse_volgroup(rule):
'''
Parse the volgroup line
'''
parser = argparse.ArgumentParser()
rules = shlex.split(rule)
rules.pop(0)
partitions = []
newrules = []
for count in range(0, len(rules)):
if count == 0:
newrules.append(rules[count])
continue
... | [
"Parse",
"the",
"volgroup",
"line"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L820-L855 | [
"def",
"parse_volgroup",
"(",
"rule",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"rules",
"=",
"shlex",
".",
"split",
"(",
"rule",
")",
"rules",
".",
"pop",
"(",
"0",
")",
"partitions",
"=",
"[",
"]",
"newrules",
"=",
"[",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | mksls | Convert a kickstart file to an SLS file | salt/utils/kickstart.py | def mksls(src, dst=None):
'''
Convert a kickstart file to an SLS file
'''
mode = 'command'
sls = {}
ks_opts = {}
with salt.utils.files.fopen(src, 'r') as fh_:
for line in fh_:
if line.startswith('#'):
continue
if mode == 'command':
... | def mksls(src, dst=None):
'''
Convert a kickstart file to an SLS file
'''
mode = 'command'
sls = {}
ks_opts = {}
with salt.utils.files.fopen(src, 'r') as fh_:
for line in fh_:
if line.startswith('#'):
continue
if mode == 'command':
... | [
"Convert",
"a",
"kickstart",
"file",
"to",
"an",
"SLS",
"file"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/kickstart.py#L891-L1178 | [
"def",
"mksls",
"(",
"src",
",",
"dst",
"=",
"None",
")",
":",
"mode",
"=",
"'command'",
"sls",
"=",
"{",
"}",
"ks_opts",
"=",
"{",
"}",
"with",
"salt",
".",
"utils",
".",
"files",
".",
"fopen",
"(",
"src",
",",
"'r'",
")",
"as",
"fh_",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _validate_sleep | Helper function that validates the minutes parameter. Can be any number
between 1 and 180. Can also be the string values "Never" and "Off".
Because "On" and "Off" get converted to boolean values on the command line
it will error if "On" is passed
Returns: The value to be passed to the command | salt/modules/mac_power.py | def _validate_sleep(minutes):
'''
Helper function that validates the minutes parameter. Can be any number
between 1 and 180. Can also be the string values "Never" and "Off".
Because "On" and "Off" get converted to boolean values on the command line
it will error if "On" is passed
Returns: The ... | def _validate_sleep(minutes):
'''
Helper function that validates the minutes parameter. Can be any number
between 1 and 180. Can also be the string values "Never" and "Off".
Because "On" and "Off" get converted to boolean values on the command line
it will error if "On" is passed
Returns: The ... | [
"Helper",
"function",
"that",
"validates",
"the",
"minutes",
"parameter",
".",
"Can",
"be",
"any",
"number",
"between",
"1",
"and",
"180",
".",
"Can",
"also",
"be",
"the",
"string",
"values",
"Never",
"and",
"Off",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L33-L72 | [
"def",
"_validate_sleep",
"(",
"minutes",
")",
":",
"# Must be a value between 1 and 180 or Never/Off",
"if",
"isinstance",
"(",
"minutes",
",",
"six",
".",
"string_types",
")",
":",
"if",
"minutes",
".",
"lower",
"(",
")",
"in",
"[",
"'never'",
",",
"'off'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_sleep | Sets the amount of idle time until the machine sleeps. Sets the same value
for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers
that should never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False ... | salt/modules/mac_power.py | def set_sleep(minutes):
'''
Sets the amount of idle time until the machine sleeps. Sets the same value
for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers
that should never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
... | def set_sleep(minutes):
'''
Sets the amount of idle time until the machine sleeps. Sets the same value
for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers
that should never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
... | [
"Sets",
"the",
"amount",
"of",
"idle",
"time",
"until",
"the",
"machine",
"sleeps",
".",
"Sets",
"the",
"same",
"value",
"for",
"Computer",
"Display",
"and",
"Hard",
"Disk",
".",
"Pass",
"Never",
"or",
"Off",
"for",
"computers",
"that",
"should",
"never",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L96-L125 | [
"def",
"set_sleep",
"(",
"minutes",
")",
":",
"value",
"=",
"_validate_sleep",
"(",
"minutes",
")",
"cmd",
"=",
"'systemsetup -setsleep {0}'",
".",
"format",
"(",
"value",
")",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
"(",
"cmd",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_computer_sleep | Display the amount of idle time until the computer sleeps.
:return: A string representing the sleep settings for the computer
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_computer_sleep | salt/modules/mac_power.py | def get_computer_sleep():
'''
Display the amount of idle time until the computer sleeps.
:return: A string representing the sleep settings for the computer
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_computer_sleep
'''
ret = salt.utils.mac_utils.execute_re... | def get_computer_sleep():
'''
Display the amount of idle time until the computer sleeps.
:return: A string representing the sleep settings for the computer
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_computer_sleep
'''
ret = salt.utils.mac_utils.execute_re... | [
"Display",
"the",
"amount",
"of",
"idle",
"time",
"until",
"the",
"computer",
"sleeps",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L128-L143 | [
"def",
"get_computer_sleep",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getcomputersleep'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_computer_sleep | Set the amount of idle time until the computer sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*'... | salt/modules/mac_power.py | def set_computer_sleep(minutes):
'''
Set the amount of idle time until the computer sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example... | def set_computer_sleep(minutes):
'''
Set the amount of idle time until the computer sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example... | [
"Set",
"the",
"amount",
"of",
"idle",
"time",
"until",
"the",
"computer",
"sleeps",
".",
"Pass",
"Never",
"of",
"Off",
"to",
"never",
"sleep",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L146-L171 | [
"def",
"set_computer_sleep",
"(",
"minutes",
")",
":",
"value",
"=",
"_validate_sleep",
"(",
"minutes",
")",
"cmd",
"=",
"'systemsetup -setcomputersleep {0}'",
".",
"format",
"(",
"value",
")",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_display_sleep | Display the amount of idle time until the display sleeps.
:return: A string representing the sleep settings for the displey
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_display_sleep | salt/modules/mac_power.py | def get_display_sleep():
'''
Display the amount of idle time until the display sleeps.
:return: A string representing the sleep settings for the displey
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_display_sleep
'''
ret = salt.utils.mac_utils.execute_return... | def get_display_sleep():
'''
Display the amount of idle time until the display sleeps.
:return: A string representing the sleep settings for the displey
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_display_sleep
'''
ret = salt.utils.mac_utils.execute_return... | [
"Display",
"the",
"amount",
"of",
"idle",
"time",
"until",
"the",
"display",
"sleeps",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L174-L189 | [
"def",
"get_display_sleep",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getdisplaysleep'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_display_sleep | Set the amount of idle time until the display sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' ... | salt/modules/mac_power.py | def set_display_sleep(minutes):
'''
Set the amount of idle time until the display sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example:
... | def set_display_sleep(minutes):
'''
Set the amount of idle time until the display sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example:
... | [
"Set",
"the",
"amount",
"of",
"idle",
"time",
"until",
"the",
"display",
"sleeps",
".",
"Pass",
"Never",
"of",
"Off",
"to",
"never",
"sleep",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L192-L217 | [
"def",
"set_display_sleep",
"(",
"minutes",
")",
":",
"value",
"=",
"_validate_sleep",
"(",
"minutes",
")",
"cmd",
"=",
"'systemsetup -setdisplaysleep {0}'",
".",
"format",
"(",
"value",
")",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_harddisk_sleep | Display the amount of idle time until the hard disk sleeps.
:return: A string representing the sleep settings for the hard disk
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_harddisk_sleep | salt/modules/mac_power.py | def get_harddisk_sleep():
'''
Display the amount of idle time until the hard disk sleeps.
:return: A string representing the sleep settings for the hard disk
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_harddisk_sleep
'''
ret = salt.utils.mac_utils.execute_... | def get_harddisk_sleep():
'''
Display the amount of idle time until the hard disk sleeps.
:return: A string representing the sleep settings for the hard disk
:rtype: str
CLI Example:
..code-block:: bash
salt '*' power.get_harddisk_sleep
'''
ret = salt.utils.mac_utils.execute_... | [
"Display",
"the",
"amount",
"of",
"idle",
"time",
"until",
"the",
"hard",
"disk",
"sleeps",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L220-L235 | [
"def",
"get_harddisk_sleep",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getharddisksleep'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"parse_return",
"(",
"ret",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_harddisk_sleep | Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*'... | salt/modules/mac_power.py | def set_harddisk_sleep(minutes):
'''
Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example... | def set_harddisk_sleep(minutes):
'''
Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off"
to never sleep.
:param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
:ptype: int, str
:return: True if successful, False if not
:rtype: bool
CLI Example... | [
"Set",
"the",
"amount",
"of",
"idle",
"time",
"until",
"the",
"harddisk",
"sleeps",
".",
"Pass",
"Never",
"of",
"Off",
"to",
"never",
"sleep",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L238-L263 | [
"def",
"set_harddisk_sleep",
"(",
"minutes",
")",
":",
"value",
"=",
"_validate_sleep",
"(",
"minutes",
")",
"cmd",
"=",
"'systemsetup -setharddisksleep {0}'",
".",
"format",
"(",
"value",
")",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_success",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_wake_on_modem | Displays whether 'wake on modem' is on or off if supported
:return: A string value representing the "wake on modem" settings
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_modem | salt/modules/mac_power.py | def get_wake_on_modem():
'''
Displays whether 'wake on modem' is on or off if supported
:return: A string value representing the "wake on modem" settings
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_modem
'''
ret = salt.utils.mac_utils.execute_retu... | def get_wake_on_modem():
'''
Displays whether 'wake on modem' is on or off if supported
:return: A string value representing the "wake on modem" settings
:rtype: str
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_modem
'''
ret = salt.utils.mac_utils.execute_retu... | [
"Displays",
"whether",
"wake",
"on",
"modem",
"is",
"on",
"or",
"off",
"if",
"supported"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L266-L282 | [
"def",
"get_wake_on_modem",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getwakeonmodem'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"salt",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_wake_on_modem | Set whether or not the computer will wake from sleep when modem activity is
detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if successful, Fa... | salt/modules/mac_power.py | def set_wake_on_modem(enabled):
'''
Set whether or not the computer will wake from sleep when modem activity is
detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respe... | def set_wake_on_modem(enabled):
'''
Set whether or not the computer will wake from sleep when modem activity is
detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respe... | [
"Set",
"whether",
"or",
"not",
"the",
"computer",
"will",
"wake",
"from",
"sleep",
"when",
"modem",
"activity",
"is",
"detected",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L285-L310 | [
"def",
"set_wake_on_modem",
"(",
"enabled",
")",
":",
"state",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"enabled",
")",
"cmd",
"=",
"'systemsetup -setwakeonmodem {0}'",
".",
"format",
"(",
"state",
")",
"salt",
".",
"utils",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_wake_on_network | Displays whether 'wake on network' is on or off if supported
:return: A string value representing the "wake on network" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_network | salt/modules/mac_power.py | def get_wake_on_network():
'''
Displays whether 'wake on network' is on or off if supported
:return: A string value representing the "wake on network" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_network
'''
ret = salt.utils.mac_utils.e... | def get_wake_on_network():
'''
Displays whether 'wake on network' is on or off if supported
:return: A string value representing the "wake on network" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_wake_on_network
'''
ret = salt.utils.mac_utils.e... | [
"Displays",
"whether",
"wake",
"on",
"network",
"is",
"on",
"or",
"off",
"if",
"supported"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L313-L329 | [
"def",
"get_wake_on_network",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getwakeonnetworkaccess'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"salt"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_wake_on_network | Set whether or not the computer will wake from sleep when network activity
is detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if successful, ... | salt/modules/mac_power.py | def set_wake_on_network(enabled):
'''
Set whether or not the computer will wake from sleep when network activity
is detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False r... | def set_wake_on_network(enabled):
'''
Set whether or not the computer will wake from sleep when network activity
is detected.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False r... | [
"Set",
"whether",
"or",
"not",
"the",
"computer",
"will",
"wake",
"from",
"sleep",
"when",
"network",
"activity",
"is",
"detected",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L332-L357 | [
"def",
"set_wake_on_network",
"(",
"enabled",
")",
":",
"state",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"enabled",
")",
"cmd",
"=",
"'systemsetup -setwakeonnetworkaccess {0}'",
".",
"format",
"(",
"state",
")",
"salt",
".",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_restart_power_failure | Displays whether 'restart on power failure' is on or off if supported
:return: A string value representing the "restart on power failure" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_power_failure | salt/modules/mac_power.py | def get_restart_power_failure():
'''
Displays whether 'restart on power failure' is on or off if supported
:return: A string value representing the "restart on power failure" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_power_failure
'''
... | def get_restart_power_failure():
'''
Displays whether 'restart on power failure' is on or off if supported
:return: A string value representing the "restart on power failure" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_power_failure
'''
... | [
"Displays",
"whether",
"restart",
"on",
"power",
"failure",
"is",
"on",
"or",
"off",
"if",
"supported"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L360-L376 | [
"def",
"get_restart_power_failure",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getrestartpowerfailure'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_restart_power_failure | Set whether or not the computer will automatically restart after a power
failure.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if successful, False ... | salt/modules/mac_power.py | def set_restart_power_failure(enabled):
'''
Set whether or not the computer will automatically restart after a power
failure.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False r... | def set_restart_power_failure(enabled):
'''
Set whether or not the computer will automatically restart after a power
failure.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False r... | [
"Set",
"whether",
"or",
"not",
"the",
"computer",
"will",
"automatically",
"restart",
"after",
"a",
"power",
"failure",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L379-L404 | [
"def",
"set_restart_power_failure",
"(",
"enabled",
")",
":",
"state",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"enabled",
")",
"cmd",
"=",
"'systemsetup -setrestartpowerfailure {0}'",
".",
"format",
"(",
"state",
")",
"salt",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_restart_freeze | Displays whether 'restart on freeze' is on or off if supported
:return: A string value representing the "restart on freeze" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_freeze | salt/modules/mac_power.py | def get_restart_freeze():
'''
Displays whether 'restart on freeze' is on or off if supported
:return: A string value representing the "restart on freeze" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_freeze
'''
ret = salt.utils.mac_utils... | def get_restart_freeze():
'''
Displays whether 'restart on freeze' is on or off if supported
:return: A string value representing the "restart on freeze" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_restart_freeze
'''
ret = salt.utils.mac_utils... | [
"Displays",
"whether",
"restart",
"on",
"freeze",
"is",
"on",
"or",
"off",
"if",
"supported"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L407-L423 | [
"def",
"get_restart_freeze",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getrestartfreeze'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"salt",
"."... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_restart_freeze | Specifies whether the server restarts automatically after a system freeze.
This setting doesn't seem to be editable. The command completes successfully
but the setting isn't actually updated. This is probably a macOS. The
functions remains in case they ever fix the bug.
:param bool enabled: True to ena... | salt/modules/mac_power.py | def set_restart_freeze(enabled):
'''
Specifies whether the server restarts automatically after a system freeze.
This setting doesn't seem to be editable. The command completes successfully
but the setting isn't actually updated. This is probably a macOS. The
functions remains in case they ever fix t... | def set_restart_freeze(enabled):
'''
Specifies whether the server restarts automatically after a system freeze.
This setting doesn't seem to be editable. The command completes successfully
but the setting isn't actually updated. This is probably a macOS. The
functions remains in case they ever fix t... | [
"Specifies",
"whether",
"the",
"server",
"restarts",
"automatically",
"after",
"a",
"system",
"freeze",
".",
"This",
"setting",
"doesn",
"t",
"seem",
"to",
"be",
"editable",
".",
"The",
"command",
"completes",
"successfully",
"but",
"the",
"setting",
"isn",
"t... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L426-L454 | [
"def",
"set_restart_freeze",
"(",
"enabled",
")",
":",
"state",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"enabled",
")",
"cmd",
"=",
"'systemsetup -setrestartfreeze {0}'",
".",
"format",
"(",
"state",
")",
"salt",
".",
"utils"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_sleep_on_power_button | Displays whether 'allow power button to sleep computer' is on or off if
supported
:return: A string value representing the "allow power button to sleep
computer" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power.get_sleep_on_power_button | salt/modules/mac_power.py | def get_sleep_on_power_button():
'''
Displays whether 'allow power button to sleep computer' is on or off if
supported
:return: A string value representing the "allow power button to sleep
computer" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power... | def get_sleep_on_power_button():
'''
Displays whether 'allow power button to sleep computer' is on or off if
supported
:return: A string value representing the "allow power button to sleep
computer" settings
:rtype: string
CLI Example:
.. code-block:: bash
salt '*' power... | [
"Displays",
"whether",
"allow",
"power",
"button",
"to",
"sleep",
"computer",
"is",
"on",
"or",
"off",
"if",
"supported"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L457-L476 | [
"def",
"get_sleep_on_power_button",
"(",
")",
":",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"'systemsetup -getallowpowerbuttontosleepcomputer'",
")",
"return",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_sleep_on_power_button | Set whether or not the power button can sleep the computer.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if successful, False if not
:rtype: bool
... | salt/modules/mac_power.py | def set_sleep_on_power_button(enabled):
'''
Set whether or not the power button can sleep the computer.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: ... | def set_sleep_on_power_button(enabled):
'''
Set whether or not the power button can sleep the computer.
:param bool enabled: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: ... | [
"Set",
"whether",
"or",
"not",
"the",
"power",
"button",
"can",
"sleep",
"the",
"computer",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L479-L503 | [
"def",
"set_sleep_on_power_button",
"(",
"enabled",
")",
":",
"state",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"enabled",
")",
"cmd",
"=",
"'systemsetup -setallowpowerbuttontosleepcomputer {0}'",
".",
"format",
"(",
"state",
")",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_conn | Return a conn object for the passed VM data | salt/cloud/clouds/pyrax.py | def get_conn(conn_type):
'''
Return a conn object for the passed VM data
'''
vm_ = get_configured_provider()
kwargs = vm_.copy() # pylint: disable=E1103
kwargs['username'] = vm_['username']
kwargs['auth_endpoint'] = vm_.get('identity_url', None)
kwargs['region'] = vm_['compute_region'... | def get_conn(conn_type):
'''
Return a conn object for the passed VM data
'''
vm_ = get_configured_provider()
kwargs = vm_.copy() # pylint: disable=E1103
kwargs['username'] = vm_['username']
kwargs['auth_endpoint'] = vm_.get('identity_url', None)
kwargs['region'] = vm_['compute_region'... | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/pyrax.py#L63-L77 | [
"def",
"get_conn",
"(",
"conn_type",
")",
":",
"vm_",
"=",
"get_configured_provider",
"(",
")",
"kwargs",
"=",
"vm_",
".",
"copy",
"(",
")",
"# pylint: disable=E1103",
"kwargs",
"[",
"'username'",
"]",
"=",
"vm_",
"[",
"'username'",
"]",
"kwargs",
"[",
"'a... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | swarm_init | Initalize Docker on Minion as a Swarm Manager
advertise_addr
The ip of the manager
listen_addr
Listen address used for inter-manager communication,
as well as determining the networking interface used
for the VXLAN Tunnel Endpoint (VTEP).
This can either be an address/p... | salt/modules/swarm.py | def swarm_init(advertise_addr=str,
listen_addr=int,
force_new_cluster=bool):
'''
Initalize Docker on Minion as a Swarm Manager
advertise_addr
The ip of the manager
listen_addr
Listen address used for inter-manager communication,
as well as determin... | def swarm_init(advertise_addr=str,
listen_addr=int,
force_new_cluster=bool):
'''
Initalize Docker on Minion as a Swarm Manager
advertise_addr
The ip of the manager
listen_addr
Listen address used for inter-manager communication,
as well as determin... | [
"Initalize",
"Docker",
"on",
"Minion",
"as",
"a",
"Swarm",
"Manager"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L72-L112 | [
"def",
"swarm_init",
"(",
"advertise_addr",
"=",
"str",
",",
"listen_addr",
"=",
"int",
",",
"force_new_cluster",
"=",
"bool",
")",
":",
"try",
":",
"salt_return",
"=",
"{",
"}",
"__context__",
"[",
"'client'",
"]",
".",
"swarm",
".",
"init",
"(",
"adver... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | joinswarm | Join a Swarm Worker to the cluster
remote_addr
The manager node you want to connect to for the swarm
listen_addr
Listen address used for inter-manager communication if the node gets promoted to manager,
as well as determining the networking interface used for the VXLAN Tunnel Endpoint ... | salt/modules/swarm.py | def joinswarm(remote_addr=int,
listen_addr=int,
token=str):
'''
Join a Swarm Worker to the cluster
remote_addr
The manager node you want to connect to for the swarm
listen_addr
Listen address used for inter-manager communication if the node gets promoted to ... | def joinswarm(remote_addr=int,
listen_addr=int,
token=str):
'''
Join a Swarm Worker to the cluster
remote_addr
The manager node you want to connect to for the swarm
listen_addr
Listen address used for inter-manager communication if the node gets promoted to ... | [
"Join",
"a",
"Swarm",
"Worker",
"to",
"the",
"cluster"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L115-L150 | [
"def",
"joinswarm",
"(",
"remote_addr",
"=",
"int",
",",
"listen_addr",
"=",
"int",
",",
"token",
"=",
"str",
")",
":",
"try",
":",
"salt_return",
"=",
"{",
"}",
"__context__",
"[",
"'client'",
"]",
".",
"swarm",
".",
"join",
"(",
"remote_addrs",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | leave_swarm | Force the minion to leave the swarm
force
Will force the minion/worker/manager to leave the swarm
CLI Example:
.. code-block:: bash
salt '*' swarm.leave_swarm force=False | salt/modules/swarm.py | def leave_swarm(force=bool):
'''
Force the minion to leave the swarm
force
Will force the minion/worker/manager to leave the swarm
CLI Example:
.. code-block:: bash
salt '*' swarm.leave_swarm force=False
'''
salt_return = {}
__context__['client'].swarm.leave(force=for... | def leave_swarm(force=bool):
'''
Force the minion to leave the swarm
force
Will force the minion/worker/manager to leave the swarm
CLI Example:
.. code-block:: bash
salt '*' swarm.leave_swarm force=False
'''
salt_return = {}
__context__['client'].swarm.leave(force=for... | [
"Force",
"the",
"minion",
"to",
"leave",
"the",
"swarm"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L153-L170 | [
"def",
"leave_swarm",
"(",
"force",
"=",
"bool",
")",
":",
"salt_return",
"=",
"{",
"}",
"__context__",
"[",
"'client'",
"]",
".",
"swarm",
".",
"leave",
"(",
"force",
"=",
"force",
")",
"output",
"=",
"__context__",
"[",
"'server_name'",
"]",
"+",
"' ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | service_create | Create Docker Swarm Service Create
image
The docker image
name
Is the service name
command
The docker command to run in the container at launch
hostname
The hostname of the containers
replicas
How many replicas you want running in the swarm
target_po... | salt/modules/swarm.py | def service_create(image=str,
name=str,
command=str,
hostname=str,
replicas=int,
target_port=int,
published_port=int):
'''
Create Docker Swarm Service Create
image
The docker image
... | def service_create(image=str,
name=str,
command=str,
hostname=str,
replicas=int,
target_port=int,
published_port=int):
'''
Create Docker Swarm Service Create
image
The docker image
... | [
"Create",
"Docker",
"Swarm",
"Service",
"Create"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L173-L234 | [
"def",
"service_create",
"(",
"image",
"=",
"str",
",",
"name",
"=",
"str",
",",
"command",
"=",
"str",
",",
"hostname",
"=",
"str",
",",
"replicas",
"=",
"int",
",",
"target_port",
"=",
"int",
",",
"published_port",
"=",
"int",
")",
":",
"try",
":",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | swarm_service_info | Swarm Service Information
service_name
The name of the service that you want information on about the service
CLI Example:
.. code-block:: bash
salt '*' swarm.swarm_service_info service_name=Test_Service | salt/modules/swarm.py | def swarm_service_info(service_name=str):
'''
Swarm Service Information
service_name
The name of the service that you want information on about the service
CLI Example:
.. code-block:: bash
salt '*' swarm.swarm_service_info service_name=Test_Service
'''
try:
salt_... | def swarm_service_info(service_name=str):
'''
Swarm Service Information
service_name
The name of the service that you want information on about the service
CLI Example:
.. code-block:: bash
salt '*' swarm.swarm_service_info service_name=Test_Service
'''
try:
salt_... | [
"Swarm",
"Service",
"Information"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L237-L289 | [
"def",
"swarm_service_info",
"(",
"service_name",
"=",
"str",
")",
":",
"try",
":",
"salt_return",
"=",
"{",
"}",
"client",
"=",
"docker",
".",
"APIClient",
"(",
"base_url",
"=",
"'unix://var/run/docker.sock'",
")",
"service",
"=",
"client",
".",
"inspect_serv... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_service | Remove Swarm Service
service
The name of the service
CLI Example:
.. code-block:: bash
salt '*' swarm.remove_service service=Test_Service | salt/modules/swarm.py | def remove_service(service=str):
'''
Remove Swarm Service
service
The name of the service
CLI Example:
.. code-block:: bash
salt '*' swarm.remove_service service=Test_Service
'''
try:
salt_return = {}
client = docker.APIClient(base_url='unix://var/run/dock... | def remove_service(service=str):
'''
Remove Swarm Service
service
The name of the service
CLI Example:
.. code-block:: bash
salt '*' swarm.remove_service service=Test_Service
'''
try:
salt_return = {}
client = docker.APIClient(base_url='unix://var/run/dock... | [
"Remove",
"Swarm",
"Service"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L292-L314 | [
"def",
"remove_service",
"(",
"service",
"=",
"str",
")",
":",
"try",
":",
"salt_return",
"=",
"{",
"}",
"client",
"=",
"docker",
".",
"APIClient",
"(",
"base_url",
"=",
"'unix://var/run/docker.sock'",
")",
"service",
"=",
"client",
".",
"remove_service",
"(... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | node_ls | Displays Information about Swarm Nodes with passing in the server
server
The minion/server name
CLI Example:
.. code-block:: bash
salt '*' swarm.node_ls server=minion1 | salt/modules/swarm.py | def node_ls(server=str):
'''
Displays Information about Swarm Nodes with passing in the server
server
The minion/server name
CLI Example:
.. code-block:: bash
salt '*' swarm.node_ls server=minion1
'''
try:
salt_return = {}
client = docker.APIClient(base_ur... | def node_ls(server=str):
'''
Displays Information about Swarm Nodes with passing in the server
server
The minion/server name
CLI Example:
.. code-block:: bash
salt '*' swarm.node_ls server=minion1
'''
try:
salt_return = {}
client = docker.APIClient(base_ur... | [
"Displays",
"Information",
"about",
"Swarm",
"Nodes",
"with",
"passing",
"in",
"the",
"server"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L317-L356 | [
"def",
"node_ls",
"(",
"server",
"=",
"str",
")",
":",
"try",
":",
"salt_return",
"=",
"{",
"}",
"client",
"=",
"docker",
".",
"APIClient",
"(",
"base_url",
"=",
"'unix://var/run/docker.sock'",
")",
"service",
"=",
"client",
".",
"nodes",
"(",
"filters",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | remove_node | Remove a node from a swarm and the target needs to be a swarm manager
node_id
The node id from the return of swarm.node_ls
force
Forcefully remove the node/minion from the service
CLI Example:
.. code-block:: bash
salt '*' swarm.remove_node node_id=z4gjbe9rwmqahc2a91snvolm5 ... | salt/modules/swarm.py | def remove_node(node_id=str, force=bool):
'''
Remove a node from a swarm and the target needs to be a swarm manager
node_id
The node id from the return of swarm.node_ls
force
Forcefully remove the node/minion from the service
CLI Example:
.. code-block:: bash
salt '*... | def remove_node(node_id=str, force=bool):
'''
Remove a node from a swarm and the target needs to be a swarm manager
node_id
The node id from the return of swarm.node_ls
force
Forcefully remove the node/minion from the service
CLI Example:
.. code-block:: bash
salt '*... | [
"Remove",
"a",
"node",
"from",
"a",
"swarm",
"and",
"the",
"target",
"needs",
"to",
"be",
"a",
"swarm",
"manager"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L359-L386 | [
"def",
"remove_node",
"(",
"node_id",
"=",
"str",
",",
"force",
"=",
"bool",
")",
":",
"client",
"=",
"docker",
".",
"APIClient",
"(",
"base_url",
"=",
"'unix://var/run/docker.sock'",
")",
"try",
":",
"if",
"force",
"==",
"'True'",
":",
"service",
"=",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_node | Updates docker swarm nodes/needs to target a manager node/minion
availability
Drain or Active
node_name
minion/node
role
role of manager or worker
node_id
The Id and that can be obtained via swarm.node_ls
version
Is obtained by swarm.node_ls
CLI Exam... | salt/modules/swarm.py | def update_node(availability=str,
node_name=str,
role=str,
node_id=str,
version=int):
'''
Updates docker swarm nodes/needs to target a manager node/minion
availability
Drain or Active
node_name
minion/node
role
... | def update_node(availability=str,
node_name=str,
role=str,
node_id=str,
version=int):
'''
Updates docker swarm nodes/needs to target a manager node/minion
availability
Drain or Active
node_name
minion/node
role
... | [
"Updates",
"docker",
"swarm",
"nodes",
"/",
"needs",
"to",
"target",
"a",
"manager",
"node",
"/",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/swarm.py#L389-L432 | [
"def",
"update_node",
"(",
"availability",
"=",
"str",
",",
"node_name",
"=",
"str",
",",
"role",
"=",
"str",
",",
"node_id",
"=",
"str",
",",
"version",
"=",
"int",
")",
":",
"client",
"=",
"docker",
".",
"APIClient",
"(",
"base_url",
"=",
"'unix://va... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | present | Ensure the IAM role exists.
name
Name of the IAM role.
policy_document
The policy that grants an entity permission to assume the role.
(See https://boto.readthedocs.io/en/latest/ref/iam.html#boto.iam.connection.IAMConnection.create_role)
policy_document_from_pillars
A pill... | salt/states/boto_iam_role.py | def present(
name,
policy_document=None,
policy_document_from_pillars=None,
path=None,
policies=None,
policies_from_pillars=None,
managed_policies=None,
create_instance_profile=True,
region=None,
key=None,
keyid=None,
profil... | def present(
name,
policy_document=None,
policy_document_from_pillars=None,
path=None,
policies=None,
policies_from_pillars=None,
managed_policies=None,
create_instance_profile=True,
region=None,
key=None,
keyid=None,
profil... | [
"Ensure",
"the",
"IAM",
"role",
"exists",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam_role.py#L106-L240 | [
"def",
"present",
"(",
"name",
",",
"policy_document",
"=",
"None",
",",
"policy_document_from_pillars",
"=",
"None",
",",
"path",
"=",
"None",
",",
"policies",
"=",
"None",
",",
"policies_from_pillars",
"=",
"None",
",",
"managed_policies",
"=",
"None",
",",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sort_policy | List-type sub-items in policies don't happen to be order-sensitive, but
compare operations will render them unequal, leading to non-idempotent
state runs. We'll sort any list-type subitems before comparison to reduce
the likelihood of false negatives. | salt/states/boto_iam_role.py | def _sort_policy(doc):
'''
List-type sub-items in policies don't happen to be order-sensitive, but
compare operations will render them unequal, leading to non-idempotent
state runs. We'll sort any list-type subitems before comparison to reduce
the likelihood of false negatives.
'''
if isins... | def _sort_policy(doc):
'''
List-type sub-items in policies don't happen to be order-sensitive, but
compare operations will render them unequal, leading to non-idempotent
state runs. We'll sort any list-type subitems before comparison to reduce
the likelihood of false negatives.
'''
if isins... | [
"List",
"-",
"type",
"sub",
"-",
"items",
"in",
"policies",
"don",
"t",
"happen",
"to",
"be",
"order",
"-",
"sensitive",
"but",
"compare",
"operations",
"will",
"render",
"them",
"unequal",
"leading",
"to",
"non",
"-",
"idempotent",
"state",
"runs",
".",
... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam_role.py#L355-L366 | [
"def",
"_sort_policy",
"(",
"doc",
")",
":",
"if",
"isinstance",
"(",
"doc",
",",
"list",
")",
":",
"return",
"sorted",
"(",
"[",
"_sort_policy",
"(",
"i",
")",
"for",
"i",
"in",
"doc",
"]",
")",
"elif",
"isinstance",
"(",
"doc",
",",
"(",
"dict",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | absent | Ensure the IAM role is deleted.
name
Name of the IAM role.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
profile
A dict with region, key and keyid, or a pillar key (string)
that contains a dict with region, k... | salt/states/boto_iam_role.py | def absent(
name,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the IAM role is deleted.
name
Name of the IAM role.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
... | def absent(
name,
region=None,
key=None,
keyid=None,
profile=None):
'''
Ensure the IAM role is deleted.
name
Name of the IAM role.
region
Region to connect to.
key
Secret key to be used.
keyid
Access key to be used.
... | [
"Ensure",
"the",
"IAM",
"role",
"is",
"deleted",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_iam_role.py#L511-L570 | [
"def",
"absent",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | beacon | r'''
Monitor the disk usage of the minion
Specify thresholds for each disk and only emit a beacon if any of them are
exceeded.
.. code-block:: yaml
beacons:
diskusage:
- /: 63%
- /mnt/nfs: 50%
Windows drives must be quoted to avoid yaml syntax errors
... | salt/beacons/diskusage.py | def beacon(config):
r'''
Monitor the disk usage of the minion
Specify thresholds for each disk and only emit a beacon if any of them are
exceeded.
.. code-block:: yaml
beacons:
diskusage:
- /: 63%
- /mnt/nfs: 50%
Windows drives must be quoted to avoi... | def beacon(config):
r'''
Monitor the disk usage of the minion
Specify thresholds for each disk and only emit a beacon if any of them are
exceeded.
.. code-block:: yaml
beacons:
diskusage:
- /: 63%
- /mnt/nfs: 50%
Windows drives must be quoted to avoi... | [
"r",
"Monitor",
"the",
"disk",
"usage",
"of",
"the",
"minion"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/diskusage.py#L47-L125 | [
"def",
"beacon",
"(",
"config",
")",
":",
"parts",
"=",
"psutil",
".",
"disk_partitions",
"(",
"all",
"=",
"True",
")",
"ret",
"=",
"[",
"]",
"for",
"mounts",
"in",
"config",
":",
"mount",
"=",
"next",
"(",
"iter",
"(",
"mounts",
")",
")",
"# Becau... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | top | Compile tops | salt/tops/saltclass.py | def top(**kwargs):
'''
Compile tops
'''
# Node definitions path will be retrieved from args (or set to default),
# then added to 'salt_data' dict that is passed to the 'get_pillars'
# function. The dictionary contains:
# - __opts__
# - __salt__
# - __grains__
# - ... | def top(**kwargs):
'''
Compile tops
'''
# Node definitions path will be retrieved from args (or set to default),
# then added to 'salt_data' dict that is passed to the 'get_pillars'
# function. The dictionary contains:
# - __opts__
# - __salt__
# - __grains__
# - ... | [
"Compile",
"tops"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/tops/saltclass.py#L229-L270 | [
"def",
"top",
"(",
"*",
"*",
"kwargs",
")",
":",
"# Node definitions path will be retrieved from args (or set to default),",
"# then added to 'salt_data' dict that is passed to the 'get_pillars'",
"# function. The dictionary contains:",
"# - __opts__",
"# - __salt__",
"# - __gr... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ping | Check to see if the host is responding. Returns False if the host didn't
respond, True otherwise.
CLI Example:
.. code-block:: bash
salt cisco-nso test.ping | salt/proxy/cisconso.py | def ping():
'''
Check to see if the host is responding. Returns False if the host didn't
respond, True otherwise.
CLI Example:
.. code-block:: bash
salt cisco-nso test.ping
'''
try:
client = _get_client()
client.info()
except SaltSystemExit as err:
log.... | def ping():
'''
Check to see if the host is responding. Returns False if the host didn't
respond, True otherwise.
CLI Example:
.. code-block:: bash
salt cisco-nso test.ping
'''
try:
client = _get_client()
client.info()
except SaltSystemExit as err:
log.... | [
"Check",
"to",
"see",
"if",
"the",
"host",
"is",
"responding",
".",
"Returns",
"False",
"if",
"the",
"host",
"didn",
"t",
"respond",
"True",
"otherwise",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cisconso.py#L235-L253 | [
"def",
"ping",
"(",
")",
":",
"try",
":",
"client",
"=",
"_get_client",
"(",
")",
"client",
".",
"info",
"(",
")",
"except",
"SaltSystemExit",
"as",
"err",
":",
"log",
".",
"warning",
"(",
"err",
")",
"return",
"False",
"return",
"True"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_data_value | Get a data entry in a datastore
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the value at,
a list of element names in order, comma separated
:... | salt/proxy/cisconso.py | def set_data_value(datastore, path, data):
'''
Get a data entry in a datastore
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the value at,
... | def set_data_value(datastore, path, data):
'''
Get a data entry in a datastore
:param datastore: The datastore, e.g. running, operational.
One of the NETCONF store IETF types
:type datastore: :class:`DatastoreType` (``str`` enum).
:param path: The device path to set the value at,
... | [
"Get",
"a",
"data",
"entry",
"in",
"a",
"datastore"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cisconso.py#L287-L306 | [
"def",
"set_data_value",
"(",
"datastore",
",",
"path",
",",
"data",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"return",
"client",
".",
"set_data_value",
"(",
"datastore",
",",
"path",
",",
"data",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _grains | Helper function to the grains from the proxied devices. | salt/proxy/cisconso.py | def _grains():
'''
Helper function to the grains from the proxied devices.
'''
client = _get_client()
# This is a collection of the configuration of all running devices under NSO
ret = client.get_datastore(DatastoreType.RUNNING)
GRAINS_CACHE.update(ret)
return GRAINS_CACHE | def _grains():
'''
Helper function to the grains from the proxied devices.
'''
client = _get_client()
# This is a collection of the configuration of all running devices under NSO
ret = client.get_datastore(DatastoreType.RUNNING)
GRAINS_CACHE.update(ret)
return GRAINS_CACHE | [
"Helper",
"function",
"to",
"the",
"grains",
"from",
"the",
"proxied",
"devices",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cisconso.py#L343-L351 | [
"def",
"_grains",
"(",
")",
":",
"client",
"=",
"_get_client",
"(",
")",
"# This is a collection of the configuration of all running devices under NSO",
"ret",
"=",
"client",
".",
"get_datastore",
"(",
"DatastoreType",
".",
"RUNNING",
")",
"GRAINS_CACHE",
".",
"update",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _get_available | Utility function to get all available update packages.
Sample return date:
{ 'updatename': '1.2.3-45', ... } | salt/modules/mac_softwareupdate.py | def _get_available(recommended=False, restart=False):
'''
Utility function to get all available update packages.
Sample return date:
{ 'updatename': '1.2.3-45', ... }
'''
cmd = ['softwareupdate', '--list']
out = salt.utils.mac_utils.execute_return_result(cmd)
# rexp parses lines that l... | def _get_available(recommended=False, restart=False):
'''
Utility function to get all available update packages.
Sample return date:
{ 'updatename': '1.2.3-45', ... }
'''
cmd = ['softwareupdate', '--list']
out = salt.utils.mac_utils.execute_return_result(cmd)
# rexp parses lines that l... | [
"Utility",
"function",
"to",
"get",
"all",
"available",
"update",
"packages",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L34-L85 | [
"def",
"_get_available",
"(",
"recommended",
"=",
"False",
",",
"restart",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--list'",
"]",
"out",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"cmd",
")",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ignore | Ignore a specific program update. When an update is ignored the '-' and
version number at the end will be omitted, so "SecUpd2014-001-1.0" becomes
"SecUpd2014-001". It will be removed automatically if present. An update
is successfully ignored when it no longer shows up after list_updates.
:param name:... | salt/modules/mac_softwareupdate.py | def ignore(name):
'''
Ignore a specific program update. When an update is ignored the '-' and
version number at the end will be omitted, so "SecUpd2014-001-1.0" becomes
"SecUpd2014-001". It will be removed automatically if present. An update
is successfully ignored when it no longer shows up after l... | def ignore(name):
'''
Ignore a specific program update. When an update is ignored the '-' and
version number at the end will be omitted, so "SecUpd2014-001-1.0" becomes
"SecUpd2014-001". It will be removed automatically if present. An update
is successfully ignored when it no longer shows up after l... | [
"Ignore",
"a",
"specific",
"program",
"update",
".",
"When",
"an",
"update",
"is",
"ignored",
"the",
"-",
"and",
"version",
"number",
"at",
"the",
"end",
"will",
"be",
"omitted",
"so",
"SecUpd2014",
"-",
"001",
"-",
"1",
".",
"0",
"becomes",
"SecUpd2014"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L108-L133 | [
"def",
"ignore",
"(",
"name",
")",
":",
"# remove everything after and including the '-' in the updates name.",
"to_ignore",
"=",
"name",
".",
"rsplit",
"(",
"'-'",
",",
"1",
")",
"[",
"0",
"]",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--ignore'",
",",
"to_ig... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_ignored | List all updates that have been ignored. Ignored updates are shown
without the '-' and version number at the end, this is how the
softwareupdate command works.
:return: The list of ignored updates
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.list_ignored | salt/modules/mac_softwareupdate.py | def list_ignored():
'''
List all updates that have been ignored. Ignored updates are shown
without the '-' and version number at the end, this is how the
softwareupdate command works.
:return: The list of ignored updates
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' ... | def list_ignored():
'''
List all updates that have been ignored. Ignored updates are shown
without the '-' and version number at the end, this is how the
softwareupdate command works.
:return: The list of ignored updates
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' ... | [
"List",
"all",
"updates",
"that",
"have",
"been",
"ignored",
".",
"Ignored",
"updates",
"are",
"shown",
"without",
"the",
"-",
"and",
"version",
"number",
"at",
"the",
"end",
"this",
"is",
"how",
"the",
"softwareupdate",
"command",
"works",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L136-L161 | [
"def",
"list_ignored",
"(",
")",
":",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--list'",
",",
"'--ignore'",
"]",
"out",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"cmd",
")",
"# rep parses lines that look like the following:... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | schedule_enabled | Check the status of automatic update scheduling.
:return: True if scheduling is enabled, False if disabled
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.schedule_enabled | salt/modules/mac_softwareupdate.py | def schedule_enabled():
'''
Check the status of automatic update scheduling.
:return: True if scheduling is enabled, False if disabled
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.schedule_enabled
'''
cmd = ['softwareupdate', '--schedule']
ret = ... | def schedule_enabled():
'''
Check the status of automatic update scheduling.
:return: True if scheduling is enabled, False if disabled
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.schedule_enabled
'''
cmd = ['softwareupdate', '--schedule']
ret = ... | [
"Check",
"the",
"status",
"of",
"automatic",
"update",
"scheduling",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L184-L203 | [
"def",
"schedule_enabled",
"(",
")",
":",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--schedule'",
"]",
"ret",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"cmd",
")",
"enabled",
"=",
"ret",
".",
"split",
"(",
")",
"["... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | schedule_enable | Enable/disable automatic update scheduling.
:param enable: True/On/Yes/1 to turn on automatic updates. False/No/Off/0
to turn off automatic updates. If this value is empty, the current
status will be returned.
:type: bool str
:return: True if scheduling is enabled, False if disabled
:... | salt/modules/mac_softwareupdate.py | def schedule_enable(enable):
'''
Enable/disable automatic update scheduling.
:param enable: True/On/Yes/1 to turn on automatic updates. False/No/Off/0
to turn off automatic updates. If this value is empty, the current
status will be returned.
:type: bool str
:return: True if sched... | def schedule_enable(enable):
'''
Enable/disable automatic update scheduling.
:param enable: True/On/Yes/1 to turn on automatic updates. False/No/Off/0
to turn off automatic updates. If this value is empty, the current
status will be returned.
:type: bool str
:return: True if sched... | [
"Enable",
"/",
"disable",
"automatic",
"update",
"scheduling",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L206-L232 | [
"def",
"schedule_enable",
"(",
"enable",
")",
":",
"status",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"validate_enabled",
"(",
"enable",
")",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--schedule'",
",",
"salt",
".",
"utils",
".",
"mac_utils",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update_all | Install all available updates. Returns a dictionary containing the name
of the update and the status of its installation.
:param bool recommended: If set to True, only install the recommended
updates. If set to False (default) all updates are installed.
:param bool restart: Set this to False if yo... | salt/modules/mac_softwareupdate.py | def update_all(recommended=False, restart=True):
'''
Install all available updates. Returns a dictionary containing the name
of the update and the status of its installation.
:param bool recommended: If set to True, only install the recommended
updates. If set to False (default) all updates are... | def update_all(recommended=False, restart=True):
'''
Install all available updates. Returns a dictionary containing the name
of the update and the status of its installation.
:param bool recommended: If set to True, only install the recommended
updates. If set to False (default) all updates are... | [
"Install",
"all",
"available",
"updates",
".",
"Returns",
"a",
"dictionary",
"containing",
"the",
"name",
"of",
"the",
"update",
"and",
"the",
"status",
"of",
"its",
"installation",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L235-L273 | [
"def",
"update_all",
"(",
"recommended",
"=",
"False",
",",
"restart",
"=",
"True",
")",
":",
"to_update",
"=",
"_get_available",
"(",
"recommended",
",",
"restart",
")",
"if",
"not",
"to_update",
":",
"return",
"{",
"}",
"for",
"_update",
"in",
"to_update... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | Install a named update.
:param str name: The name of the of the update to install.
:return: True if successfully updated, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.update <update-name> | salt/modules/mac_softwareupdate.py | def update(name):
'''
Install a named update.
:param str name: The name of the of the update to install.
:return: True if successfully updated, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.update <update-name>
'''
if not update_av... | def update(name):
'''
Install a named update.
:param str name: The name of the of the update to install.
:return: True if successfully updated, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.update <update-name>
'''
if not update_av... | [
"Install",
"a",
"named",
"update",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L276-L297 | [
"def",
"update",
"(",
"name",
")",
":",
"if",
"not",
"update_available",
"(",
"name",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Update not available: {0}'",
".",
"format",
"(",
"name",
")",
")",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--install'",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | list_downloads | Return a list of all updates that have been downloaded locally.
:return: A list of updates that have been downloaded
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.list_downloads | salt/modules/mac_softwareupdate.py | def list_downloads():
'''
Return a list of all updates that have been downloaded locally.
:return: A list of updates that have been downloaded
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.list_downloads
'''
outfiles = []
for root, subFolder, files... | def list_downloads():
'''
Return a list of all updates that have been downloaded locally.
:return: A list of updates that have been downloaded
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.list_downloads
'''
outfiles = []
for root, subFolder, files... | [
"Return",
"a",
"list",
"of",
"all",
"updates",
"that",
"have",
"been",
"downloaded",
"locally",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L319-L349 | [
"def",
"list_downloads",
"(",
")",
":",
"outfiles",
"=",
"[",
"]",
"for",
"root",
",",
"subFolder",
",",
"files",
"in",
"salt",
".",
"utils",
".",
"path",
".",
"os_walk",
"(",
"'/Library/Updates'",
")",
":",
"for",
"f",
"in",
"files",
":",
"outfiles",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | download | Download a named update so that it can be installed later with the
``update`` or ``update_all`` functions
:param str name: The update to download.
:return: True if successful, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdate.download <update name... | salt/modules/mac_softwareupdate.py | def download(name):
'''
Download a named update so that it can be installed later with the
``update`` or ``update_all`` functions
:param str name: The update to download.
:return: True if successful, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' soft... | def download(name):
'''
Download a named update so that it can be installed later with the
``update`` or ``update_all`` functions
:param str name: The update to download.
:return: True if successful, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' soft... | [
"Download",
"a",
"named",
"update",
"so",
"that",
"it",
"can",
"be",
"installed",
"later",
"with",
"the",
"update",
"or",
"update_all",
"functions"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L352-L377 | [
"def",
"download",
"(",
"name",
")",
":",
"if",
"not",
"update_available",
"(",
"name",
")",
":",
"raise",
"SaltInvocationError",
"(",
"'Update not available: {0}'",
".",
"format",
"(",
"name",
")",
")",
"if",
"name",
"in",
"list_downloads",
"(",
")",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | download_all | Download all available updates so that they can be installed later with the
``update`` or ``update_all`` functions. It returns a list of updates that
are now downloaded.
:param bool recommended: If set to True, only install the recommended
updates. If set to False (default) all updates are installe... | salt/modules/mac_softwareupdate.py | def download_all(recommended=False, restart=True):
'''
Download all available updates so that they can be installed later with the
``update`` or ``update_all`` functions. It returns a list of updates that
are now downloaded.
:param bool recommended: If set to True, only install the recommended
... | def download_all(recommended=False, restart=True):
'''
Download all available updates so that they can be installed later with the
``update`` or ``update_all`` functions. It returns a list of updates that
are now downloaded.
:param bool recommended: If set to True, only install the recommended
... | [
"Download",
"all",
"available",
"updates",
"so",
"that",
"they",
"can",
"be",
"installed",
"later",
"with",
"the",
"update",
"or",
"update_all",
"functions",
".",
"It",
"returns",
"a",
"list",
"of",
"updates",
"that",
"are",
"now",
"downloaded",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L380-L406 | [
"def",
"download_all",
"(",
"recommended",
"=",
"False",
",",
"restart",
"=",
"True",
")",
":",
"to_download",
"=",
"_get_available",
"(",
"recommended",
",",
"restart",
")",
"for",
"name",
"in",
"to_download",
":",
"download",
"(",
"name",
")",
"return",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_catalog | .. versionadded:: 2016.3.0
Get the current catalog being used for update lookups. Will return a url if
a custom catalog has been specified. Otherwise the word 'Default' will be
returned
:return: The catalog being used for update lookups
:rtype: str
CLI Example:
.. code-block:: bash
... | salt/modules/mac_softwareupdate.py | def get_catalog():
'''
.. versionadded:: 2016.3.0
Get the current catalog being used for update lookups. Will return a url if
a custom catalog has been specified. Otherwise the word 'Default' will be
returned
:return: The catalog being used for update lookups
:rtype: str
CLI Example:
... | def get_catalog():
'''
.. versionadded:: 2016.3.0
Get the current catalog being used for update lookups. Will return a url if
a custom catalog has been specified. Otherwise the word 'Default' will be
returned
:return: The catalog being used for update lookups
:rtype: str
CLI Example:
... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L409-L440 | [
"def",
"get_catalog",
"(",
")",
":",
"cmd",
"=",
"[",
"'defaults'",
",",
"'read'",
",",
"'/Library/Preferences/com.apple.SoftwareUpdate.plist'",
"]",
"out",
"=",
"salt",
".",
"utils",
".",
"mac_utils",
".",
"execute_return_result",
"(",
"cmd",
")",
"if",
"'Apple... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_catalog | .. versionadded:: 2016.3.0
Set the Software Update Catalog to the URL specified
:param str url: The url to the update catalog
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.set_catalog http://swupd.local:8888/index.... | salt/modules/mac_softwareupdate.py | def set_catalog(url):
'''
.. versionadded:: 2016.3.0
Set the Software Update Catalog to the URL specified
:param str url: The url to the update catalog
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.set_cata... | def set_catalog(url):
'''
.. versionadded:: 2016.3.0
Set the Software Update Catalog to the URL specified
:param str url: The url to the update catalog
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.set_cata... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L443-L470 | [
"def",
"set_catalog",
"(",
"url",
")",
":",
"# This command always returns an error code, though it completes",
"# successfully. Success will be determined by making sure get_catalog",
"# returns the passed url",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--set-catalog'",
",",
"url"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | reset_catalog | .. versionadded:: 2016.3.0
Reset the Software Update Catalog to the default.
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.reset_catalog | salt/modules/mac_softwareupdate.py | def reset_catalog():
'''
.. versionadded:: 2016.3.0
Reset the Software Update Catalog to the default.
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.reset_catalog
'''
# This command always returns an erro... | def reset_catalog():
'''
.. versionadded:: 2016.3.0
Reset the Software Update Catalog to the default.
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' softwareupdates.reset_catalog
'''
# This command always returns an erro... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_softwareupdate.py#L473-L498 | [
"def",
"reset_catalog",
"(",
")",
":",
"# This command always returns an error code, though it completes",
"# successfully. Success will be determined by making sure get_catalog",
"# returns 'Default'",
"cmd",
"=",
"[",
"'softwareupdate'",
",",
"'--clear-catalog'",
"]",
"try",
":",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_ | .. versionadded:: 2014.7.0
Get a value from etcd, by direct path. Returns None on failure.
CLI Examples:
.. code-block:: bash
salt myminion etcd.get /path/to/key
salt myminion etcd.get /path/to/key profile=my_etcd_config
salt myminion etcd.get /path/to/key recurse=True profile=m... | salt/modules/etcd_mod.py | def get_(key, recurse=False, profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Get a value from etcd, by direct path. Returns None on failure.
CLI Examples:
.. code-block:: bash
salt myminion etcd.get /path/to/key
salt myminion etcd.get /path/to/key profile=my_etcd_config
... | def get_(key, recurse=False, profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Get a value from etcd, by direct path. Returns None on failure.
CLI Examples:
.. code-block:: bash
salt myminion etcd.get /path/to/key
salt myminion etcd.get /path/to/key profile=my_etcd_config
... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/etcd_mod.py#L76-L95 | [
"def",
"get_",
"(",
"key",
",",
"recurse",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"__utils__",
"[",
"'etcd_util.get_conn'",
"]",
"(",
"__opts__",
",",
"profile",
",",
"*",
"*",
"kwargs",
")",
"if"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | set_ | .. versionadded:: 2014.7.0
Set a key in etcd by direct path. Optionally, create a directory
or set a TTL on the key. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.set /path/to/key value
salt myminion etcd.set /path/to/key value profile=my_etcd_config
... | salt/modules/etcd_mod.py | def set_(key, value, profile=None, ttl=None, directory=False, **kwargs):
'''
.. versionadded:: 2014.7.0
Set a key in etcd by direct path. Optionally, create a directory
or set a TTL on the key. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.set /path/t... | def set_(key, value, profile=None, ttl=None, directory=False, **kwargs):
'''
.. versionadded:: 2014.7.0
Set a key in etcd by direct path. Optionally, create a directory
or set a TTL on the key. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.set /path/t... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/etcd_mod.py#L98-L117 | [
"def",
"set_",
"(",
"key",
",",
"value",
",",
"profile",
"=",
"None",
",",
"ttl",
"=",
"None",
",",
"directory",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"__utils__",
"[",
"'etcd_util.get_conn'",
"]",
"(",
"__opts__",
",",
"pro... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | update | .. versionadded:: 2016.3.0
Sets a dictionary of values in one call. Useful for large updates
in syndic environments. The dictionary can contain a mix of formats
such as:
.. code-block:: python
{
'/some/example/key': 'bar',
'/another/example/key': 'baz'
}
Or ... | salt/modules/etcd_mod.py | def update(fields, path='', profile=None, **kwargs):
'''
.. versionadded:: 2016.3.0
Sets a dictionary of values in one call. Useful for large updates
in syndic environments. The dictionary can contain a mix of formats
such as:
.. code-block:: python
{
'/some/example/key': ... | def update(fields, path='', profile=None, **kwargs):
'''
.. versionadded:: 2016.3.0
Sets a dictionary of values in one call. Useful for large updates
in syndic environments. The dictionary can contain a mix of formats
such as:
.. code-block:: python
{
'/some/example/key': ... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/etcd_mod.py#L120-L171 | [
"def",
"update",
"(",
"fields",
",",
"path",
"=",
"''",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"__utils__",
"[",
"'etcd_util.get_conn'",
"]",
"(",
"__opts__",
",",
"profile",
",",
"*",
"*",
"kwargs",
")",
"retu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | watch | .. versionadded:: 2016.3.0
Makes a best effort to watch for a key or tree change in etcd.
Returns a dict containing the new key value ( or None if the key was
deleted ), the modifiedIndex of the key, whether the key changed or
not, the path to the key that changed and whether it is a directory or not.
... | salt/modules/etcd_mod.py | def watch(key, recurse=False, profile=None, timeout=0, index=None, **kwargs):
'''
.. versionadded:: 2016.3.0
Makes a best effort to watch for a key or tree change in etcd.
Returns a dict containing the new key value ( or None if the key was
deleted ), the modifiedIndex of the key, whether the key c... | def watch(key, recurse=False, profile=None, timeout=0, index=None, **kwargs):
'''
.. versionadded:: 2016.3.0
Makes a best effort to watch for a key or tree change in etcd.
Returns a dict containing the new key value ( or None if the key was
deleted ), the modifiedIndex of the key, whether the key c... | [
"..",
"versionadded",
"::",
"2016",
".",
"3",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/etcd_mod.py#L174-L196 | [
"def",
"watch",
"(",
"key",
",",
"recurse",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"timeout",
"=",
"0",
",",
"index",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"__utils__",
"[",
"'etcd_util.get_conn'",
"]",
"(",
"__opts_... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | ls_ | .. versionadded:: 2014.7.0
Return all keys and dirs inside a specific path. Returns an empty dict on
failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.ls /path/to/dir/
salt myminion etcd.ls /path/to/dir/ profile=my_etcd_config
salt myminion etcd.ls /path/to/dir/ ... | salt/modules/etcd_mod.py | def ls_(path='/', profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Return all keys and dirs inside a specific path. Returns an empty dict on
failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.ls /path/to/dir/
salt myminion etcd.ls /path/to/dir/ profile=my_e... | def ls_(path='/', profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Return all keys and dirs inside a specific path. Returns an empty dict on
failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.ls /path/to/dir/
salt myminion etcd.ls /path/to/dir/ profile=my_e... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/etcd_mod.py#L199-L216 | [
"def",
"ls_",
"(",
"path",
"=",
"'/'",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"__utils__",
"[",
"'etcd_util.get_conn'",
"]",
"(",
"__opts__",
",",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"client",
".... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | rm_ | .. versionadded:: 2014.7.0
Delete a key from etcd. Returns True if the key was deleted, False if it was
not and None if there was a failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.rm /path/to/key
salt myminion etcd.rm /path/to/key profile=my_etcd_config
salt m... | salt/modules/etcd_mod.py | def rm_(key, recurse=False, profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Delete a key from etcd. Returns True if the key was deleted, False if it was
not and None if there was a failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.rm /path/to/key
salt my... | def rm_(key, recurse=False, profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Delete a key from etcd. Returns True if the key was deleted, False if it was
not and None if there was a failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.rm /path/to/key
salt my... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/etcd_mod.py#L219-L237 | [
"def",
"rm_",
"(",
"key",
",",
"recurse",
"=",
"False",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"__utils__",
"[",
"'etcd_util.get_conn'",
"]",
"(",
"__opts__",
",",
"profile",
",",
"*",
"*",
"kwargs",
")",
"retu... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | tree | .. versionadded:: 2014.7.0
Recurse through etcd and return all values. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.tree
salt myminion etcd.tree profile=my_etcd_config
salt myminion etcd.tree host=127.0.0.1 port=2379
salt myminion etcd.t... | salt/modules/etcd_mod.py | def tree(path='/', profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Recurse through etcd and return all values. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.tree
salt myminion etcd.tree profile=my_etcd_config
salt myminion etcd.tr... | def tree(path='/', profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Recurse through etcd and return all values. Returns None on failure.
CLI Example:
.. code-block:: bash
salt myminion etcd.tree
salt myminion etcd.tree profile=my_etcd_config
salt myminion etcd.tr... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/etcd_mod.py#L240-L257 | [
"def",
"tree",
"(",
"path",
"=",
"'/'",
",",
"profile",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"__utils__",
"[",
"'etcd_util.get_conn'",
"]",
"(",
"__opts__",
",",
"profile",
",",
"*",
"*",
"kwargs",
")",
"return",
"client",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | creds | Return the credentials for AWS signing. This could be just the id and key
specified in the provider configuration, or if the id or key is set to the
literal string 'use-instance-role-credentials' creds will pull the instance
role credentials from the meta data, cache them, and provide them instead. | salt/utils/aws.py | def creds(provider):
'''
Return the credentials for AWS signing. This could be just the id and key
specified in the provider configuration, or if the id or key is set to the
literal string 'use-instance-role-credentials' creds will pull the instance
role credentials from the meta data, cache them, ... | def creds(provider):
'''
Return the credentials for AWS signing. This could be just the id and key
specified in the provider configuration, or if the id or key is set to the
literal string 'use-instance-role-credentials' creds will pull the instance
role credentials from the meta data, cache them, ... | [
"Return",
"the",
"credentials",
"for",
"AWS",
"signing",
".",
"This",
"could",
"be",
"just",
"the",
"id",
"and",
"key",
"specified",
"in",
"the",
"provider",
"configuration",
"or",
"if",
"the",
"id",
"or",
"key",
"is",
"set",
"to",
"the",
"literal",
"str... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L81-L141 | [
"def",
"creds",
"(",
"provider",
")",
":",
"# Declare globals",
"global",
"__AccessKeyId__",
",",
"__SecretAccessKey__",
",",
"__Token__",
",",
"__Expiration__",
"ret_credentials",
"=",
"(",
")",
"# if id or key is 'use-instance-role-credentials', pull them from meta-data",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sig2 | Sign a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html | salt/utils/aws.py | def sig2(method, endpoint, params, provider, aws_api_version):
'''
Sign a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html
'''
timenow = datetime.utcnow()
timestamp = timenow.st... | def sig2(method, endpoint, params, provider, aws_api_version):
'''
Sign a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html
'''
timenow = datetime.utcnow()
timestamp = timenow.st... | [
"Sign",
"a",
"query",
"against",
"AWS",
"services",
"using",
"Signature",
"Version",
"2",
"Signing",
"Process",
".",
"This",
"is",
"documented",
"at",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L144-L181 | [
"def",
"sig2",
"(",
"method",
",",
"endpoint",
",",
"params",
",",
"provider",
",",
"aws_api_version",
")",
":",
"timenow",
"=",
"datetime",
".",
"utcnow",
"(",
")",
"timestamp",
"=",
"timenow",
".",
"strftime",
"(",
"'%Y-%m-%dT%H:%M:%SZ'",
")",
"# Retrieve ... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | sig4 | Sign a query against AWS services using Signature Version 4 Signing
Process. This is documented at:
http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
http://docs.aws.amazon.com/general/latest/gr/sigv4-create-c... | salt/utils/aws.py | def sig4(method, endpoint, params, prov_dict,
aws_api_version=DEFAULT_AWS_API_VERSION, location=None,
product='ec2', uri='/', requesturl=None, data='', headers=None,
role_arn=None, payload_hash=None):
'''
Sign a query against AWS services using Signature Version 4 Signing
Process.... | def sig4(method, endpoint, params, prov_dict,
aws_api_version=DEFAULT_AWS_API_VERSION, location=None,
product='ec2', uri='/', requesturl=None, data='', headers=None,
role_arn=None, payload_hash=None):
'''
Sign a query against AWS services using Signature Version 4 Signing
Process.... | [
"Sign",
"a",
"query",
"against",
"AWS",
"services",
"using",
"Signature",
"Version",
"4",
"Signing",
"Process",
".",
"This",
"is",
"documented",
"at",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L235-L343 | [
"def",
"sig4",
"(",
"method",
",",
"endpoint",
",",
"params",
",",
"prov_dict",
",",
"aws_api_version",
"=",
"DEFAULT_AWS_API_VERSION",
",",
"location",
"=",
"None",
",",
"product",
"=",
"'ec2'",
",",
"uri",
"=",
"'/'",
",",
"requesturl",
"=",
"None",
",",... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | _sig_key | Get a signature key. See:
http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-python | salt/utils/aws.py | def _sig_key(key, date_stamp, regionName, serviceName):
'''
Get a signature key. See:
http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-python
'''
kDate = _sign(('AWS4' + key).encode('utf-8'), date_stamp)
if regionName:
kRegion = _sign(kDate, ... | def _sig_key(key, date_stamp, regionName, serviceName):
'''
Get a signature key. See:
http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-python
'''
kDate = _sign(('AWS4' + key).encode('utf-8'), date_stamp)
if regionName:
kRegion = _sign(kDate, ... | [
"Get",
"a",
"signature",
"key",
".",
"See",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L355-L368 | [
"def",
"_sig_key",
"(",
"key",
",",
"date_stamp",
",",
"regionName",
",",
"serviceName",
")",
":",
"kDate",
"=",
"_sign",
"(",
"(",
"'AWS4'",
"+",
"key",
")",
".",
"encode",
"(",
"'utf-8'",
")",
",",
"date_stamp",
")",
"if",
"regionName",
":",
"kRegion... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | query | Perform a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html
Regions and endpoints are documented at:
http://docs.aws.amazon.com/general/latest/gr/rande.html
Default ``product`` is ``e... | salt/utils/aws.py | def query(params=None, setname=None, requesturl=None, location=None,
return_url=False, return_root=False, opts=None, provider=None,
endpoint=None, product='ec2', sigver='2'):
'''
Perform a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
h... | def query(params=None, setname=None, requesturl=None, location=None,
return_url=False, return_root=False, opts=None, provider=None,
endpoint=None, product='ec2', sigver='2'):
'''
Perform a query against AWS services using Signature Version 2 Signing
Process. This is documented at:
h... | [
"Perform",
"a",
"query",
"against",
"AWS",
"services",
"using",
"Signature",
"Version",
"2",
"Signing",
"Process",
".",
"This",
"is",
"documented",
"at",
":"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L371-L540 | [
"def",
"query",
"(",
"params",
"=",
"None",
",",
"setname",
"=",
"None",
",",
"requesturl",
"=",
"None",
",",
"location",
"=",
"None",
",",
"return_url",
"=",
"False",
",",
"return_root",
"=",
"False",
",",
"opts",
"=",
"None",
",",
"provider",
"=",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_region_from_metadata | Try to get region from instance identity document and cache it
.. versionadded:: 2015.5.6 | salt/utils/aws.py | def get_region_from_metadata():
'''
Try to get region from instance identity document and cache it
.. versionadded:: 2015.5.6
'''
global __Location__
if __Location__ == 'do-not-get-from-metadata':
log.debug('Previously failed to get AWS region from metadata. Not trying again.')
... | def get_region_from_metadata():
'''
Try to get region from instance identity document and cache it
.. versionadded:: 2015.5.6
'''
global __Location__
if __Location__ == 'do-not-get-from-metadata':
log.debug('Previously failed to get AWS region from metadata. Not trying again.')
... | [
"Try",
"to",
"get",
"region",
"from",
"instance",
"identity",
"document",
"and",
"cache",
"it"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L543-L579 | [
"def",
"get_region_from_metadata",
"(",
")",
":",
"global",
"__Location__",
"if",
"__Location__",
"==",
"'do-not-get-from-metadata'",
":",
"log",
".",
"debug",
"(",
"'Previously failed to get AWS region from metadata. Not trying again.'",
")",
"return",
"None",
"# Cached regi... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | get_location | Return the region to use, in this order:
opts['location']
provider['location']
get_region_from_metadata()
DEFAULT_LOCATION | salt/utils/aws.py | def get_location(opts=None, provider=None):
'''
Return the region to use, in this order:
opts['location']
provider['location']
get_region_from_metadata()
DEFAULT_LOCATION
'''
if opts is None:
opts = {}
ret = opts.get('location')
if ret is None and provider... | def get_location(opts=None, provider=None):
'''
Return the region to use, in this order:
opts['location']
provider['location']
get_region_from_metadata()
DEFAULT_LOCATION
'''
if opts is None:
opts = {}
ret = opts.get('location')
if ret is None and provider... | [
"Return",
"the",
"region",
"to",
"use",
"in",
"this",
"order",
":",
"opts",
"[",
"location",
"]",
"provider",
"[",
"location",
"]",
"get_region_from_metadata",
"()",
"DEFAULT_LOCATION"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/aws.py#L582-L599 | [
"def",
"get_location",
"(",
"opts",
"=",
"None",
",",
"provider",
"=",
"None",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"{",
"}",
"ret",
"=",
"opts",
".",
"get",
"(",
"'location'",
")",
"if",
"ret",
"is",
"None",
"and",
"provider",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | extract_masters | Parses opts and generates a list of master (host,port) addresses.
By default looks for list of masters in opts['master'] and uses
opts['master_port'] as the default port when otherwise not provided.
Use the opts key given by masters for the masters list, default is 'master'
If parameter port is not Non... | salt/daemons/__init__.py | def extract_masters(opts, masters='master', port=None, raise_if_empty=True):
'''
Parses opts and generates a list of master (host,port) addresses.
By default looks for list of masters in opts['master'] and uses
opts['master_port'] as the default port when otherwise not provided.
Use the opts key gi... | def extract_masters(opts, masters='master', port=None, raise_if_empty=True):
'''
Parses opts and generates a list of master (host,port) addresses.
By default looks for list of masters in opts['master'] and uses
opts['master_port'] as the default port when otherwise not provided.
Use the opts key gi... | [
"Parses",
"opts",
"and",
"generates",
"a",
"list",
"of",
"master",
"(",
"host",
"port",
")",
"addresses",
".",
"By",
"default",
"looks",
"for",
"list",
"of",
"masters",
"in",
"opts",
"[",
"master",
"]",
"and",
"uses",
"opts",
"[",
"master_port",
"]",
"... | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/__init__.py#L48-L197 | [
"def",
"extract_masters",
"(",
"opts",
",",
"masters",
"=",
"'master'",
",",
"port",
"=",
"None",
",",
"raise_if_empty",
"=",
"True",
")",
":",
"if",
"port",
"is",
"not",
"None",
":",
"master_port",
"=",
"opts",
".",
"get",
"(",
"port",
")",
"else",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | parse_hostname | Parse hostname string and return a tuple of (host, port)
If port missing in hostname string then use default_port
If anything is not a valid then return None
hostname should contain a host and an option space delimited port
host port
As an attempt to prevent foolish mistakes the parser also tries ... | salt/daemons/__init__.py | def parse_hostname(hostname, default_port):
'''
Parse hostname string and return a tuple of (host, port)
If port missing in hostname string then use default_port
If anything is not a valid then return None
hostname should contain a host and an option space delimited port
host port
As an at... | def parse_hostname(hostname, default_port):
'''
Parse hostname string and return a tuple of (host, port)
If port missing in hostname string then use default_port
If anything is not a valid then return None
hostname should contain a host and an option space delimited port
host port
As an at... | [
"Parse",
"hostname",
"string",
"and",
"return",
"a",
"tuple",
"of",
"(",
"host",
"port",
")",
"If",
"port",
"missing",
"in",
"hostname",
"string",
"then",
"use",
"default_port",
"If",
"anything",
"is",
"not",
"a",
"valid",
"then",
"return",
"None"
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/daemons/__init__.py#L200-L240 | [
"def",
"parse_hostname",
"(",
"hostname",
",",
"default_port",
")",
":",
"try",
":",
"host",
",",
"sep",
",",
"port",
"=",
"hostname",
".",
"strip",
"(",
")",
".",
"rpartition",
"(",
"' '",
")",
"if",
"not",
"port",
":",
"# invalid nothing there",
"retur... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
train | find_objects | Return all the line objects that match the expression in the ``regex``
argument.
.. warning::
This function is mostly valuable when invoked from other Salt
components (i.e., execution modules, states, templates etc.). For CLI
usage, please consider using
:py:func:`ciscoconfparse... | salt/modules/ciscoconfparse_mod.py | def find_objects(config=None, config_path=None, regex=None, saltenv='base'):
'''
Return all the line objects that match the expression in the ``regex``
argument.
.. warning::
This function is mostly valuable when invoked from other Salt
components (i.e., execution modules, states, templ... | def find_objects(config=None, config_path=None, regex=None, saltenv='base'):
'''
Return all the line objects that match the expression in the ``regex``
argument.
.. warning::
This function is mostly valuable when invoked from other Salt
components (i.e., execution modules, states, templ... | [
"Return",
"all",
"the",
"line",
"objects",
"that",
"match",
"the",
"expression",
"in",
"the",
"regex",
"argument",
"."
] | saltstack/salt | python | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ciscoconfparse_mod.py#L71-L111 | [
"def",
"find_objects",
"(",
"config",
"=",
"None",
",",
"config_path",
"=",
"None",
",",
"regex",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
")",
":",
"ccp",
"=",
"_get_ccp",
"(",
"config",
"=",
"config",
",",
"config_path",
"=",
"config_path",
",",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.