repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/mac_service.py | enabled | def enabled(name, runas=None):
'''
Check if the specified service is enabled
:param str name: The name of the service to look up
:param str runas: User to run launchctl commands
:return: True if the specified service enabled, otherwise False
:rtype: bool
CLI Example:
.. code-block::... | python | def enabled(name, runas=None):
'''
Check if the specified service is enabled
:param str name: The name of the service to look up
:param str runas: User to run launchctl commands
:return: True if the specified service enabled, otherwise False
:rtype: bool
CLI Example:
.. code-block::... | [
"def",
"enabled",
"(",
"name",
",",
"runas",
"=",
"None",
")",
":",
"# Try to list the service. If it can't be listed, it's not enabled",
"try",
":",
"list_",
"(",
"name",
"=",
"name",
",",
"runas",
"=",
"runas",
")",
"return",
"True",
"except",
"CommandExecution... | Check if the specified service is enabled
:param str name: The name of the service to look up
:param str runas: User to run launchctl commands
:return: True if the specified service enabled, otherwise False
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' service.enabled org... | [
"Check",
"if",
"the",
"specified",
"service",
"is",
"enabled"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L571-L593 | train |
saltstack/salt | salt/modules/mac_service.py | disabled | def disabled(name, runas=None, domain='system'):
'''
Check if the specified service is not enabled. This is the opposite of
``service.enabled``
:param str name: The name to look up
:param str runas: User to run launchctl commands
:param str domain: domain to check for disabled services. Defau... | python | def disabled(name, runas=None, domain='system'):
'''
Check if the specified service is not enabled. This is the opposite of
``service.enabled``
:param str name: The name to look up
:param str runas: User to run launchctl commands
:param str domain: domain to check for disabled services. Defau... | [
"def",
"disabled",
"(",
"name",
",",
"runas",
"=",
"None",
",",
"domain",
"=",
"'system'",
")",
":",
"disabled",
"=",
"launchctl",
"(",
"'print-disabled'",
",",
"domain",
",",
"return_stdout",
"=",
"True",
",",
"runas",
"=",
"runas",
")",
"for",
"service... | Check if the specified service is not enabled. This is the opposite of
``service.enabled``
:param str name: The name to look up
:param str runas: User to run launchctl commands
:param str domain: domain to check for disabled services. Default is system.
:return: True if the specified service is ... | [
"Check",
"if",
"the",
"specified",
"service",
"is",
"not",
"enabled",
".",
"This",
"is",
"the",
"opposite",
"of",
"service",
".",
"enabled"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L596-L630 | train |
saltstack/salt | salt/modules/mac_service.py | get_all | def get_all(runas=None):
'''
Return a list of services that are enabled or available. Can be used to
find the name of a service.
:param str runas: User to run launchctl commands
:return: A list of all the services available or enabled
:rtype: list
CLI Example:
.. code-block:: bash
... | python | def get_all(runas=None):
'''
Return a list of services that are enabled or available. Can be used to
find the name of a service.
:param str runas: User to run launchctl commands
:return: A list of all the services available or enabled
:rtype: list
CLI Example:
.. code-block:: bash
... | [
"def",
"get_all",
"(",
"runas",
"=",
"None",
")",
":",
"# Get list of enabled services",
"enabled",
"=",
"get_enabled",
"(",
"runas",
"=",
"runas",
")",
"# Get list of all services",
"available",
"=",
"list",
"(",
"__utils__",
"[",
"'mac_utils.available_services'",
... | Return a list of services that are enabled or available. Can be used to
find the name of a service.
:param str runas: User to run launchctl commands
:return: A list of all the services available or enabled
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' service.get_all | [
"Return",
"a",
"list",
"of",
"services",
"that",
"are",
"enabled",
"or",
"available",
".",
"Can",
"be",
"used",
"to",
"find",
"the",
"name",
"of",
"a",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L633-L656 | train |
saltstack/salt | salt/modules/mac_service.py | get_enabled | def get_enabled(runas=None):
'''
Return a list of all services that are enabled. Can be used to find the
name of a service.
:param str runas: User to run launchctl commands
:return: A list of all the services enabled on the system
:rtype: list
CLI Example:
.. code-block:: bash
... | python | def get_enabled(runas=None):
'''
Return a list of all services that are enabled. Can be used to find the
name of a service.
:param str runas: User to run launchctl commands
:return: A list of all the services enabled on the system
:rtype: list
CLI Example:
.. code-block:: bash
... | [
"def",
"get_enabled",
"(",
"runas",
"=",
"None",
")",
":",
"# Collect list of enabled services",
"stdout",
"=",
"list_",
"(",
"runas",
"=",
"runas",
")",
"service_lines",
"=",
"[",
"line",
"for",
"line",
"in",
"stdout",
".",
"splitlines",
"(",
")",
"]",
"#... | Return a list of all services that are enabled. Can be used to find the
name of a service.
:param str runas: User to run launchctl commands
:return: A list of all the services enabled on the system
:rtype: list
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled | [
"Return",
"a",
"list",
"of",
"all",
"services",
"that",
"are",
"enabled",
".",
"Can",
"be",
"used",
"to",
"find",
"the",
"name",
"of",
"a",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L659-L689 | train |
saltstack/salt | salt/cloud/clouds/nova.py | get_conn | def get_conn():
'''
Return a conn object for the passed VM data
'''
vm_ = get_configured_provider()
kwargs = vm_.copy() # pylint: disable=E1103
kwargs['username'] = vm_['user']
kwargs['project_id'] = vm_['tenant']
kwargs['auth_url'] = vm_['identity_url']
kwargs['region_name'] = vm... | python | def get_conn():
'''
Return a conn object for the passed VM data
'''
vm_ = get_configured_provider()
kwargs = vm_.copy() # pylint: disable=E1103
kwargs['username'] = vm_['user']
kwargs['project_id'] = vm_['tenant']
kwargs['auth_url'] = vm_['identity_url']
kwargs['region_name'] = vm... | [
"def",
"get_conn",
"(",
")",
":",
"vm_",
"=",
"get_configured_provider",
"(",
")",
"kwargs",
"=",
"vm_",
".",
"copy",
"(",
")",
"# pylint: disable=E1103",
"kwargs",
"[",
"'username'",
"]",
"=",
"vm_",
"[",
"'user'",
"]",
"kwargs",
"[",
"'project_id'",
"]",... | Return a conn object for the passed VM data | [
"Return",
"a",
"conn",
"object",
"for",
"the",
"passed",
"VM",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L301-L324 | train |
saltstack/salt | salt/cloud/clouds/nova.py | avail_locations | def avail_locations(conn=None, call=None):
'''
Return a list of locations
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
if conn is None:
... | python | def avail_locations(conn=None, call=None):
'''
Return a list of locations
'''
if call == 'action':
raise SaltCloudSystemExit(
'The avail_locations function must be called with '
'-f or --function, or with the --list-locations option'
)
if conn is None:
... | [
"def",
"avail_locations",
"(",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The avail_locations function must be called with '",
"'-f or --function, or with the --list-locations option'"... | Return a list of locations | [
"Return",
"a",
"list",
"of",
"locations"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L327-L345 | train |
saltstack/salt | salt/cloud/clouds/nova.py | get_image | def get_image(conn, vm_):
'''
Return the image object to use
'''
vm_image = config.get_cloud_config_value('image', vm_, __opts__, default='').encode(
'ascii', 'salt-cloud-force-ascii'
)
if not vm_image:
log.debug('No image set, must be boot from volume')
return None
... | python | def get_image(conn, vm_):
'''
Return the image object to use
'''
vm_image = config.get_cloud_config_value('image', vm_, __opts__, default='').encode(
'ascii', 'salt-cloud-force-ascii'
)
if not vm_image:
log.debug('No image set, must be boot from volume')
return None
... | [
"def",
"get_image",
"(",
"conn",
",",
"vm_",
")",
":",
"vm_image",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'image'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"''",
")",
".",
"encode",
"(",
"'ascii'",
",",
"'salt-cloud-force-ascii'",
")... | Return the image object to use | [
"Return",
"the",
"image",
"object",
"to",
"use"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L348-L374 | train |
saltstack/salt | salt/cloud/clouds/nova.py | show_instance | def show_instance(name, call=None):
'''
Show the details from the provider concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
conn = get_conn()
node = conn.show_instance(name).__... | python | def show_instance(name, call=None):
'''
Show the details from the provider concerning an instance
'''
if call != 'action':
raise SaltCloudSystemExit(
'The show_instance action must be called with -a or --action.'
)
conn = get_conn()
node = conn.show_instance(name).__... | [
"def",
"show_instance",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The show_instance action must be called with -a or --action.'",
")",
"conn",
"=",
"get_conn",
"(",
")",
"node",
"="... | Show the details from the provider concerning an instance | [
"Show",
"the",
"details",
"from",
"the",
"provider",
"concerning",
"an",
"instance"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L388-L400 | train |
saltstack/salt | salt/cloud/clouds/nova.py | get_size | def get_size(conn, vm_):
'''
Return the VM's size object
'''
sizes = conn.list_sizes()
vm_size = config.get_cloud_config_value('size', vm_, __opts__)
if not vm_size:
return sizes[0]
for size in sizes:
if vm_size and six.text_type(vm_size) in (six.text_type(sizes[size]['id'])... | python | def get_size(conn, vm_):
'''
Return the VM's size object
'''
sizes = conn.list_sizes()
vm_size = config.get_cloud_config_value('size', vm_, __opts__)
if not vm_size:
return sizes[0]
for size in sizes:
if vm_size and six.text_type(vm_size) in (six.text_type(sizes[size]['id'])... | [
"def",
"get_size",
"(",
"conn",
",",
"vm_",
")",
":",
"sizes",
"=",
"conn",
".",
"list_sizes",
"(",
")",
"vm_size",
"=",
"config",
".",
"get_cloud_config_value",
"(",
"'size'",
",",
"vm_",
",",
"__opts__",
")",
"if",
"not",
"vm_size",
":",
"return",
"s... | Return the VM's size object | [
"Return",
"the",
"VM",
"s",
"size",
"object"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L403-L417 | train |
saltstack/salt | salt/cloud/clouds/nova.py | ignore_cidr | def ignore_cidr(vm_, ip):
'''
Return True if we are to ignore the specified IP. Compatible with IPv4.
'''
if HAS_NETADDR is False:
log.error('Error: netaddr is not installed')
return 'Error: netaddr is not installed'
cidr = config.get_cloud_config_value(
'ignore_cidr', vm_, ... | python | def ignore_cidr(vm_, ip):
'''
Return True if we are to ignore the specified IP. Compatible with IPv4.
'''
if HAS_NETADDR is False:
log.error('Error: netaddr is not installed')
return 'Error: netaddr is not installed'
cidr = config.get_cloud_config_value(
'ignore_cidr', vm_, ... | [
"def",
"ignore_cidr",
"(",
"vm_",
",",
"ip",
")",
":",
"if",
"HAS_NETADDR",
"is",
"False",
":",
"log",
".",
"error",
"(",
"'Error: netaddr is not installed'",
")",
"return",
"'Error: netaddr is not installed'",
"cidr",
"=",
"config",
".",
"get_cloud_config_value",
... | Return True if we are to ignore the specified IP. Compatible with IPv4. | [
"Return",
"True",
"if",
"we",
"are",
"to",
"ignore",
"the",
"specified",
"IP",
".",
"Compatible",
"with",
"IPv4",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L441-L456 | train |
saltstack/salt | salt/cloud/clouds/nova.py | rackconnect | def rackconnect(vm_):
'''
Determine if we should wait for rackconnect automation before running.
Either 'False' (default) or 'True'.
'''
return config.get_cloud_config_value(
'rackconnect', vm_, __opts__, default=False,
search_global=False
) | python | def rackconnect(vm_):
'''
Determine if we should wait for rackconnect automation before running.
Either 'False' (default) or 'True'.
'''
return config.get_cloud_config_value(
'rackconnect', vm_, __opts__, default=False,
search_global=False
) | [
"def",
"rackconnect",
"(",
"vm_",
")",
":",
"return",
"config",
".",
"get_cloud_config_value",
"(",
"'rackconnect'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"False",
",",
"search_global",
"=",
"False",
")"
] | Determine if we should wait for rackconnect automation before running.
Either 'False' (default) or 'True'. | [
"Determine",
"if",
"we",
"should",
"wait",
"for",
"rackconnect",
"automation",
"before",
"running",
".",
"Either",
"False",
"(",
"default",
")",
"or",
"True",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L470-L478 | train |
saltstack/salt | salt/cloud/clouds/nova.py | rackconnectv3 | def rackconnectv3(vm_):
'''
Determine if server is using rackconnectv3 or not
Return the rackconnect network name or False
'''
return config.get_cloud_config_value(
'rackconnectv3', vm_, __opts__, default=False,
search_global=False
) | python | def rackconnectv3(vm_):
'''
Determine if server is using rackconnectv3 or not
Return the rackconnect network name or False
'''
return config.get_cloud_config_value(
'rackconnectv3', vm_, __opts__, default=False,
search_global=False
) | [
"def",
"rackconnectv3",
"(",
"vm_",
")",
":",
"return",
"config",
".",
"get_cloud_config_value",
"(",
"'rackconnectv3'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"False",
",",
"search_global",
"=",
"False",
")"
] | Determine if server is using rackconnectv3 or not
Return the rackconnect network name or False | [
"Determine",
"if",
"server",
"is",
"using",
"rackconnectv3",
"or",
"not",
"Return",
"the",
"rackconnect",
"network",
"name",
"or",
"False"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L481-L489 | train |
saltstack/salt | salt/cloud/clouds/nova.py | cloudnetwork | def cloudnetwork(vm_):
'''
Determine if we should use an extra network to bootstrap
Either 'False' (default) or 'True'.
'''
return config.get_cloud_config_value(
'cloudnetwork', vm_, __opts__, default=False,
search_global=False
) | python | def cloudnetwork(vm_):
'''
Determine if we should use an extra network to bootstrap
Either 'False' (default) or 'True'.
'''
return config.get_cloud_config_value(
'cloudnetwork', vm_, __opts__, default=False,
search_global=False
) | [
"def",
"cloudnetwork",
"(",
"vm_",
")",
":",
"return",
"config",
".",
"get_cloud_config_value",
"(",
"'cloudnetwork'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"False",
",",
"search_global",
"=",
"False",
")"
] | Determine if we should use an extra network to bootstrap
Either 'False' (default) or 'True'. | [
"Determine",
"if",
"we",
"should",
"use",
"an",
"extra",
"network",
"to",
"bootstrap",
"Either",
"False",
"(",
"default",
")",
"or",
"True",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L492-L500 | train |
saltstack/salt | salt/cloud/clouds/nova.py | managedcloud | def managedcloud(vm_):
'''
Determine if we should wait for the managed cloud automation before
running. Either 'False' (default) or 'True'.
'''
return config.get_cloud_config_value(
'managedcloud', vm_, __opts__, default=False,
search_global=False
) | python | def managedcloud(vm_):
'''
Determine if we should wait for the managed cloud automation before
running. Either 'False' (default) or 'True'.
'''
return config.get_cloud_config_value(
'managedcloud', vm_, __opts__, default=False,
search_global=False
) | [
"def",
"managedcloud",
"(",
"vm_",
")",
":",
"return",
"config",
".",
"get_cloud_config_value",
"(",
"'managedcloud'",
",",
"vm_",
",",
"__opts__",
",",
"default",
"=",
"False",
",",
"search_global",
"=",
"False",
")"
] | Determine if we should wait for the managed cloud automation before
running. Either 'False' (default) or 'True'. | [
"Determine",
"if",
"we",
"should",
"wait",
"for",
"the",
"managed",
"cloud",
"automation",
"before",
"running",
".",
"Either",
"False",
"(",
"default",
")",
"or",
"True",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L503-L511 | train |
saltstack/salt | salt/cloud/clouds/nova.py | destroy | def destroy(name, conn=None, call=None):
'''
Delete a single VM
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'event',
'destroy... | python | def destroy(name, conn=None, call=None):
'''
Delete a single VM
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
)
__utils__['cloud.fire_event'](
'event',
'destroy... | [
"def",
"destroy",
"(",
"name",
",",
"conn",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__"... | Delete a single VM | [
"Delete",
"a",
"single",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L514-L575 | train |
saltstack/salt | salt/cloud/clouds/nova.py | request_instance | def request_instance(vm_=None, call=None):
'''
Put together all of the information necessary to request an instance
through Novaclient and then fire off the request the instance.
Returns data about the instance
'''
if call == 'function':
# Technically this function may be called other w... | python | def request_instance(vm_=None, call=None):
'''
Put together all of the information necessary to request an instance
through Novaclient and then fire off the request the instance.
Returns data about the instance
'''
if call == 'function':
# Technically this function may be called other w... | [
"def",
"request_instance",
"(",
"vm_",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"# Technically this function may be called other ways too, but it",
"# definitely cannot be called with --function.",
"raise",
"SaltCloudSystemExit",... | Put together all of the information necessary to request an instance
through Novaclient and then fire off the request the instance.
Returns data about the instance | [
"Put",
"together",
"all",
"of",
"the",
"information",
"necessary",
"to",
"request",
"an",
"instance",
"through",
"Novaclient",
"and",
"then",
"fire",
"off",
"the",
"request",
"the",
"instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L578-L791 | train |
saltstack/salt | salt/cloud/clouds/nova.py | create | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'nov... | python | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'nov... | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"'nova'... | Create a single VM from a data dict | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L934-L1077 | train |
saltstack/salt | salt/cloud/clouds/nova.py | list_nodes | def list_nodes(call=None, **kwargs):
'''
Return a list of the VMs that in this location
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
conn = get_conn()
server_list = conn.server_list... | python | def list_nodes(call=None, **kwargs):
'''
Return a list of the VMs that in this location
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
ret = {}
conn = get_conn()
server_list = conn.server_list... | [
"def",
"list_nodes",
"(",
"call",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"conn",
"=",... | Return a list of the VMs that in this location | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"in",
"this",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1096-L1147 | train |
saltstack/salt | salt/cloud/clouds/nova.py | list_nodes_full | def list_nodes_full(call=None, **kwargs):
'''
Return a list of the VMs that in this location
'''
if call == 'action':
raise SaltCloudSystemExit(
(
'The list_nodes_full function must be called with'
' -f or --function.'
)
)
ret ... | python | def list_nodes_full(call=None, **kwargs):
'''
Return a list of the VMs that in this location
'''
if call == 'action':
raise SaltCloudSystemExit(
(
'The list_nodes_full function must be called with'
' -f or --function.'
)
)
ret ... | [
"def",
"list_nodes_full",
"(",
"call",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"(",
"'The list_nodes_full function must be called with'",
"' -f or --function.'",
")",
")",
"ret",
"="... | Return a list of the VMs that in this location | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"in",
"this",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1150-L1177 | train |
saltstack/salt | salt/cloud/clouds/nova.py | list_nodes_min | def list_nodes_min(call=None, **kwargs):
'''
Return a list of the VMs that in this location
'''
if call == 'action':
raise SaltCloudSystemExit(
(
'The list_nodes_min function must be called with'
' -f or --function.'
)
)
conn =... | python | def list_nodes_min(call=None, **kwargs):
'''
Return a list of the VMs that in this location
'''
if call == 'action':
raise SaltCloudSystemExit(
(
'The list_nodes_min function must be called with'
' -f or --function.'
)
)
conn =... | [
"def",
"list_nodes_min",
"(",
"call",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"(",
"'The list_nodes_min function must be called with'",
"' -f or --function.'",
")",
")",
"conn",
"=",... | Return a list of the VMs that in this location | [
"Return",
"a",
"list",
"of",
"the",
"VMs",
"that",
"in",
"this",
"location"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1180-L1197 | train |
saltstack/salt | salt/cloud/clouds/nova.py | volume_create | def volume_create(name, size=100, snapshot=None, voltype=None, **kwargs):
'''
Create block storage device
'''
conn = get_conn()
create_kwargs = {'name': name,
'size': size,
'snapshot': snapshot,
'voltype': voltype}
create_kwargs['ava... | python | def volume_create(name, size=100, snapshot=None, voltype=None, **kwargs):
'''
Create block storage device
'''
conn = get_conn()
create_kwargs = {'name': name,
'size': size,
'snapshot': snapshot,
'voltype': voltype}
create_kwargs['ava... | [
"def",
"volume_create",
"(",
"name",
",",
"size",
"=",
"100",
",",
"snapshot",
"=",
"None",
",",
"voltype",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"create_kwargs",
"=",
"{",
"'name'",
":",
"name",
",",
"'... | Create block storage device | [
"Create",
"block",
"storage",
"device"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1209-L1219 | train |
saltstack/salt | salt/cloud/clouds/nova.py | volume_attach | def volume_attach(name, server_name, device='/dev/xvdb', **kwargs):
'''
Attach block volume
'''
conn = get_conn()
return conn.volume_attach(
name,
server_name,
device,
timeout=300
) | python | def volume_attach(name, server_name, device='/dev/xvdb', **kwargs):
'''
Attach block volume
'''
conn = get_conn()
return conn.volume_attach(
name,
server_name,
device,
timeout=300
) | [
"def",
"volume_attach",
"(",
"name",
",",
"server_name",
",",
"device",
"=",
"'/dev/xvdb'",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"return",
"conn",
".",
"volume_attach",
"(",
"name",
",",
"server_name",
",",
"device",
",",... | Attach block volume | [
"Attach",
"block",
"volume"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1245-L1255 | train |
saltstack/salt | salt/cloud/clouds/nova.py | volume_create_attach | def volume_create_attach(name, call=None, **kwargs):
'''
Create and attach volumes to created node
'''
if call == 'function':
raise SaltCloudSystemExit(
'The create_attach_volumes action must be called with '
'-a or --action.'
)
if type(kwargs['volumes']) is ... | python | def volume_create_attach(name, call=None, **kwargs):
'''
Create and attach volumes to created node
'''
if call == 'function':
raise SaltCloudSystemExit(
'The create_attach_volumes action must be called with '
'-a or --action.'
)
if type(kwargs['volumes']) is ... | [
"def",
"volume_create_attach",
"(",
"name",
",",
"call",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The create_attach_volumes action must be called with '",
"'-a or --action.'",
")",
... | Create and attach volumes to created node | [
"Create",
"and",
"attach",
"volumes",
"to",
"created",
"node"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1262-L1318 | train |
saltstack/salt | salt/cloud/clouds/nova.py | virtual_interface_create | def virtual_interface_create(name, net_name, **kwargs):
'''
Create private networks
'''
conn = get_conn()
return conn.virtual_interface_create(name, net_name) | python | def virtual_interface_create(name, net_name, **kwargs):
'''
Create private networks
'''
conn = get_conn()
return conn.virtual_interface_create(name, net_name) | [
"def",
"virtual_interface_create",
"(",
"name",
",",
"net_name",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"get_conn",
"(",
")",
"return",
"conn",
".",
"virtual_interface_create",
"(",
"name",
",",
"net_name",
")"
] | Create private networks | [
"Create",
"private",
"networks"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1357-L1362 | train |
saltstack/salt | salt/cloud/clouds/nova.py | floating_ip_create | def floating_ip_create(kwargs, call=None):
'''
Allocate a floating IP
.. versionadded:: 2016.3.0
'''
if call != 'function':
raise SaltCloudSystemExit(
'The floating_ip_create action must be called with -f or --function'
)
if 'pool' not in kwargs:
log.error('... | python | def floating_ip_create(kwargs, call=None):
'''
Allocate a floating IP
.. versionadded:: 2016.3.0
'''
if call != 'function':
raise SaltCloudSystemExit(
'The floating_ip_create action must be called with -f or --function'
)
if 'pool' not in kwargs:
log.error('... | [
"def",
"floating_ip_create",
"(",
"kwargs",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The floating_ip_create action must be called with -f or --function'",
")",
"if",
"'pool'",
"not",
"in",
"kwarg... | Allocate a floating IP
.. versionadded:: 2016.3.0 | [
"Allocate",
"a",
"floating",
"IP"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1395-L1411 | train |
saltstack/salt | salt/cloud/clouds/nova.py | floating_ip_associate | def floating_ip_associate(name, kwargs, call=None):
'''
Associate a floating IP address to a server
.. versionadded:: 2016.3.0
'''
if call != 'action':
raise SaltCloudSystemExit(
'The floating_ip_associate action must be called with -a of --action.'
)
if 'floating_i... | python | def floating_ip_associate(name, kwargs, call=None):
'''
Associate a floating IP address to a server
.. versionadded:: 2016.3.0
'''
if call != 'action':
raise SaltCloudSystemExit(
'The floating_ip_associate action must be called with -a of --action.'
)
if 'floating_i... | [
"def",
"floating_ip_associate",
"(",
"name",
",",
"kwargs",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"!=",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The floating_ip_associate action must be called with -a of --action.'",
")",
"if",
"'floating_ip'"... | Associate a floating IP address to a server
.. versionadded:: 2016.3.0 | [
"Associate",
"a",
"floating",
"IP",
"address",
"to",
"a",
"server"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/nova.py#L1433-L1450 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | create | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'gog... | python | def create(vm_):
'''
Create a single VM from a data dict
'''
try:
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'gog... | [
"def",
"create",
"(",
"vm_",
")",
":",
"try",
":",
"# Check for required profile parameters before sending any API calls.",
"if",
"vm_",
"[",
"'profile'",
"]",
"and",
"config",
".",
"is_profile_configured",
"(",
"__opts__",
",",
"__active_provider_name__",
"or",
"'gogri... | Create a single VM from a data dict | [
"Create",
"a",
"single",
"VM",
"from",
"a",
"data",
"dict"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L82-L189 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | list_nodes | def list_nodes(full=False, call=None):
'''
List of nodes, keeping only a brief listing
CLI Example:
.. code-block:: bash
salt-cloud -Q
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
... | python | def list_nodes(full=False, call=None):
'''
List of nodes, keeping only a brief listing
CLI Example:
.. code-block:: bash
salt-cloud -Q
'''
if call == 'action':
raise SaltCloudSystemExit(
'The list_nodes function must be called with -f or --function.'
)
... | [
"def",
"list_nodes",
"(",
"full",
"=",
"False",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'action'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The list_nodes function must be called with -f or --function.'",
")",
"ret",
"=",
"{",
"}",
"nodes",
"... | List of nodes, keeping only a brief listing
CLI Example:
.. code-block:: bash
salt-cloud -Q | [
"List",
"of",
"nodes",
"keeping",
"only",
"a",
"brief",
"listing"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L192-L217 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | list_nodes_full | def list_nodes_full(call=None):
'''
List nodes, with all available information
CLI Example:
.. code-block:: bash
salt-cloud -F
'''
response = _query('grid', 'server/list')
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
ret... | python | def list_nodes_full(call=None):
'''
List nodes, with all available information
CLI Example:
.. code-block:: bash
salt-cloud -F
'''
response = _query('grid', 'server/list')
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
ret... | [
"def",
"list_nodes_full",
"(",
"call",
"=",
"None",
")",
":",
"response",
"=",
"_query",
"(",
"'grid'",
",",
"'server/list'",
")",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"response",
"[",
"'list'",
"]",
":",
"name",
"=",
"item",
"[",
"'name'",
"]"... | List nodes, with all available information
CLI Example:
.. code-block:: bash
salt-cloud -F | [
"List",
"nodes",
"with",
"all",
"available",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L220-L246 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | avail_locations | def avail_locations():
'''
Available locations
'''
response = list_common_lookups(kwargs={'lookup': 'ip.datacenter'})
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
return ret | python | def avail_locations():
'''
Available locations
'''
response = list_common_lookups(kwargs={'lookup': 'ip.datacenter'})
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
return ret | [
"def",
"avail_locations",
"(",
")",
":",
"response",
"=",
"list_common_lookups",
"(",
"kwargs",
"=",
"{",
"'lookup'",
":",
"'ip.datacenter'",
"}",
")",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"response",
"[",
"'list'",
"]",
":",
"name",
"=",
"item",
... | Available locations | [
"Available",
"locations"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L264-L275 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | avail_sizes | def avail_sizes():
'''
Available sizes
'''
response = list_common_lookups(kwargs={'lookup': 'server.ram'})
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
return ret | python | def avail_sizes():
'''
Available sizes
'''
response = list_common_lookups(kwargs={'lookup': 'server.ram'})
ret = {}
for item in response['list']:
name = item['name']
ret[name] = item
return ret | [
"def",
"avail_sizes",
"(",
")",
":",
"response",
"=",
"list_common_lookups",
"(",
"kwargs",
"=",
"{",
"'lookup'",
":",
"'server.ram'",
"}",
")",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"response",
"[",
"'list'",
"]",
":",
"name",
"=",
"item",
"[",
... | Available sizes | [
"Available",
"sizes"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L278-L289 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | avail_images | def avail_images():
'''
Available images
'''
response = _query('grid', 'image/list')
ret = {}
for item in response['list']:
name = item['friendlyName']
ret[name] = item
return ret | python | def avail_images():
'''
Available images
'''
response = _query('grid', 'image/list')
ret = {}
for item in response['list']:
name = item['friendlyName']
ret[name] = item
return ret | [
"def",
"avail_images",
"(",
")",
":",
"response",
"=",
"_query",
"(",
"'grid'",
",",
"'image/list'",
")",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"response",
"[",
"'list'",
"]",
":",
"name",
"=",
"item",
"[",
"'friendlyName'",
"]",
"ret",
"[",
"na... | Available images | [
"Available",
"images"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L292-L303 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | list_passwords | def list_passwords(kwargs=None, call=None):
'''
List all password on the account
.. versionadded:: 2015.8.0
'''
response = _query('support', 'password/list')
ret = {}
for item in response['list']:
if 'server' in item:
server = item['server']['name']
if serve... | python | def list_passwords(kwargs=None, call=None):
'''
List all password on the account
.. versionadded:: 2015.8.0
'''
response = _query('support', 'password/list')
ret = {}
for item in response['list']:
if 'server' in item:
server = item['server']['name']
if serve... | [
"def",
"list_passwords",
"(",
"kwargs",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"response",
"=",
"_query",
"(",
"'support'",
",",
"'password/list'",
")",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"response",
"[",
"'list'",
"]",
":",
"if",
"... | List all password on the account
.. versionadded:: 2015.8.0 | [
"List",
"all",
"password",
"on",
"the",
"account"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L306-L322 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | list_public_ips | def list_public_ips(kwargs=None, call=None):
'''
List all available public IPs.
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider>
To list unavailable (assigned) IPs, use:
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider> ... | python | def list_public_ips(kwargs=None, call=None):
'''
List all available public IPs.
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider>
To list unavailable (assigned) IPs, use:
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider> ... | [
"def",
"list_public_ips",
"(",
"kwargs",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"args",
"=",
"{",
"}",
"if",
"'state'",
"in",
"kwargs",
":",
"if",
"kwargs",
"[",
"'state'",
"]",
... | List all available public IPs.
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider>
To list unavailable (assigned) IPs, use:
CLI Example:
.. code-block:: bash
salt-cloud -f list_public_ips <provider> state=assigned
.. versionadded:: 2015.8.0 | [
"List",
"all",
"available",
"public",
"IPs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L325-L364 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | list_common_lookups | def list_common_lookups(kwargs=None, call=None):
'''
List common lookups for a particular type of item
.. versionadded:: 2015.8.0
'''
if kwargs is None:
kwargs = {}
args = {}
if 'lookup' in kwargs:
args['lookup'] = kwargs['lookup']
response = _query('common', 'lookup/l... | python | def list_common_lookups(kwargs=None, call=None):
'''
List common lookups for a particular type of item
.. versionadded:: 2015.8.0
'''
if kwargs is None:
kwargs = {}
args = {}
if 'lookup' in kwargs:
args['lookup'] = kwargs['lookup']
response = _query('common', 'lookup/l... | [
"def",
"list_common_lookups",
"(",
"kwargs",
"=",
"None",
",",
"call",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"args",
"=",
"{",
"}",
"if",
"'lookup'",
"in",
"kwargs",
":",
"args",
"[",
"'lookup'",
"]",
"=... | List common lookups for a particular type of item
.. versionadded:: 2015.8.0 | [
"List",
"common",
"lookups",
"for",
"a",
"particular",
"type",
"of",
"item"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L367-L382 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | destroy | def destroy(name, call=None):
'''
Destroy a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -d vm_name
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
... | python | def destroy(name, call=None):
'''
Destroy a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -d vm_name
'''
if call == 'function':
raise SaltCloudSystemExit(
'The destroy action must be called with -d, --destroy, '
'-a or --action.'
... | [
"def",
"destroy",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"if",
"call",
"==",
"'function'",
":",
"raise",
"SaltCloudSystemExit",
"(",
"'The destroy action must be called with -d, --destroy, '",
"'-a or --action.'",
")",
"__utils__",
"[",
"'cloud.fire_event'",
... | Destroy a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -d vm_name | [
"Destroy",
"a",
"machine",
"by",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L385-L424 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | show_instance | def show_instance(name, call=None):
'''
Start a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -a show_instance vm_name
.. versionadded:: 2015.8.0
'''
response = _query('grid', 'server/get', args={'name': name})
ret = {}
for item in response['list']:
... | python | def show_instance(name, call=None):
'''
Start a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -a show_instance vm_name
.. versionadded:: 2015.8.0
'''
response = _query('grid', 'server/get', args={'name': name})
ret = {}
for item in response['list']:
... | [
"def",
"show_instance",
"(",
"name",
",",
"call",
"=",
"None",
")",
":",
"response",
"=",
"_query",
"(",
"'grid'",
",",
"'server/get'",
",",
"args",
"=",
"{",
"'name'",
":",
"name",
"}",
")",
"ret",
"=",
"{",
"}",
"for",
"item",
"in",
"response",
"... | Start a machine by name
CLI Example:
.. code-block:: bash
salt-cloud -a show_instance vm_name
.. versionadded:: 2015.8.0 | [
"Start",
"a",
"machine",
"by",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L472-L498 | train |
saltstack/salt | salt/cloud/clouds/gogrid.py | _query | def _query(action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None):
'''
Make a web call to GoGrid
.. versionadded:: 2015.8.0
'''
vm_ = get_configured_provider()
apikey = config.get_cloud_config_value(
'apike... | python | def _query(action=None,
command=None,
args=None,
method='GET',
header_dict=None,
data=None):
'''
Make a web call to GoGrid
.. versionadded:: 2015.8.0
'''
vm_ = get_configured_provider()
apikey = config.get_cloud_config_value(
'apike... | [
"def",
"_query",
"(",
"action",
"=",
"None",
",",
"command",
"=",
"None",
",",
"args",
"=",
"None",
",",
"method",
"=",
"'GET'",
",",
"header_dict",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"vm_",
"=",
"get_configured_provider",
"(",
")",
"ap... | Make a web call to GoGrid
.. versionadded:: 2015.8.0 | [
"Make",
"a",
"web",
"call",
"to",
"GoGrid"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/gogrid.py#L501-L565 | train |
saltstack/salt | salt/states/reg.py | _parse_key | def _parse_key(key):
'''
split the hive from the key
'''
splt = key.split("\\")
hive = splt.pop(0)
key = '\\'.join(splt)
return hive, key | python | def _parse_key(key):
'''
split the hive from the key
'''
splt = key.split("\\")
hive = splt.pop(0)
key = '\\'.join(splt)
return hive, key | [
"def",
"_parse_key",
"(",
"key",
")",
":",
"splt",
"=",
"key",
".",
"split",
"(",
"\"\\\\\"",
")",
"hive",
"=",
"splt",
".",
"pop",
"(",
"0",
")",
"key",
"=",
"'\\\\'",
".",
"join",
"(",
"splt",
")",
"return",
"hive",
",",
"key"
] | split the hive from the key | [
"split",
"the",
"hive",
"from",
"the",
"key"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/reg.py#L104-L111 | train |
saltstack/salt | salt/states/reg.py | present | def present(name,
vname=None,
vdata=None,
vtype='REG_SZ',
use_32bit_registry=False,
win_owner=None,
win_perms=None,
win_deny_perms=None,
win_inheritance=True,
win_perms_reset=False):
r'''
Ensure a registr... | python | def present(name,
vname=None,
vdata=None,
vtype='REG_SZ',
use_32bit_registry=False,
win_owner=None,
win_perms=None,
win_deny_perms=None,
win_inheritance=True,
win_perms_reset=False):
r'''
Ensure a registr... | [
"def",
"present",
"(",
"name",
",",
"vname",
"=",
"None",
",",
"vdata",
"=",
"None",
",",
"vtype",
"=",
"'REG_SZ'",
",",
"use_32bit_registry",
"=",
"False",
",",
"win_owner",
"=",
"None",
",",
"win_perms",
"=",
"None",
",",
"win_deny_perms",
"=",
"None",... | r'''
Ensure a registry key or value is present.
Args:
name (str):
A string value representing the full path of the key to include the
HIVE, Key, and all Subkeys. For example:
``HKEY_LOCAL_MACHINE\\SOFTWARE\\Salt``
Valid hive values include:
... | [
"r",
"Ensure",
"a",
"registry",
"key",
"or",
"value",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/reg.py#L114-L458 | train |
saltstack/salt | salt/states/reg.py | absent | def absent(name, vname=None, use_32bit_registry=False):
r'''
Ensure a registry value is removed. To remove a key use key_absent.
Args:
name (str):
A string value representing the full path of the key to include the
HIVE, Key, and all Subkeys. For example:
``HKEY... | python | def absent(name, vname=None, use_32bit_registry=False):
r'''
Ensure a registry value is removed. To remove a key use key_absent.
Args:
name (str):
A string value representing the full path of the key to include the
HIVE, Key, and all Subkeys. For example:
``HKEY... | [
"def",
"absent",
"(",
"name",
",",
"vname",
"=",
"None",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"hi... | r'''
Ensure a registry value is removed. To remove a key use key_absent.
Args:
name (str):
A string value representing the full path of the key to include the
HIVE, Key, and all Subkeys. For example:
``HKEY_LOCAL_MACHINE\\SOFTWARE\\Salt``
Valid hive val... | [
"r",
"Ensure",
"a",
"registry",
"value",
"is",
"removed",
".",
"To",
"remove",
"a",
"key",
"use",
"key_absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/reg.py#L461-L539 | train |
saltstack/salt | salt/states/reg.py | key_absent | def key_absent(name, use_32bit_registry=False):
r'''
.. versionadded:: 2015.5.4
Ensure a registry key is removed. This will remove the key, subkeys, and all
value entries.
Args:
name (str):
A string representing the full path to the key to be removed to
include the... | python | def key_absent(name, use_32bit_registry=False):
r'''
.. versionadded:: 2015.5.4
Ensure a registry key is removed. This will remove the key, subkeys, and all
value entries.
Args:
name (str):
A string representing the full path to the key to be removed to
include the... | [
"def",
"key_absent",
"(",
"name",
",",
"use_32bit_registry",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"True",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
"}",
"hive",
",",
"key",
"=",
"... | r'''
.. versionadded:: 2015.5.4
Ensure a registry key is removed. This will remove the key, subkeys, and all
value entries.
Args:
name (str):
A string representing the full path to the key to be removed to
include the hive and the keypath. The hive can be any of the
... | [
"r",
"..",
"versionadded",
"::",
"2015",
".",
"5",
".",
"4"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/reg.py#L542-L619 | train |
saltstack/salt | salt/utils/thin.py | _get_salt_call | def _get_salt_call(*dirs, **namespaces):
'''
Return salt-call source, based on configuration.
This will include additional namespaces for another versions of Salt,
if needed (e.g. older interpreters etc).
:dirs: List of directories to include in the system path
:namespaces: Dictionary of namesp... | python | def _get_salt_call(*dirs, **namespaces):
'''
Return salt-call source, based on configuration.
This will include additional namespaces for another versions of Salt,
if needed (e.g. older interpreters etc).
:dirs: List of directories to include in the system path
:namespaces: Dictionary of namesp... | [
"def",
"_get_salt_call",
"(",
"*",
"dirs",
",",
"*",
"*",
"namespaces",
")",
":",
"template",
"=",
"'''# -*- coding: utf-8 -*-\nimport os\nimport sys\n\n# Namespaces is a map: {namespace: major/minor version}, like {'2016.11.4': [2, 6]}\n# Appears only when configured in Master configurati... | Return salt-call source, based on configuration.
This will include additional namespaces for another versions of Salt,
if needed (e.g. older interpreters etc).
:dirs: List of directories to include in the system path
:namespaces: Dictionary of namespace
:return: | [
"Return",
"salt",
"-",
"call",
"source",
"based",
"on",
"configuration",
".",
"This",
"will",
"include",
"additional",
"namespaces",
"for",
"another",
"versions",
"of",
"Salt",
"if",
"needed",
"(",
"e",
".",
"g",
".",
"older",
"interpreters",
"etc",
")",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L89-L131 | train |
saltstack/salt | salt/utils/thin.py | _add_dependency | def _add_dependency(container, obj):
'''
Add a dependency to the top list.
:param obj:
:param is_file:
:return:
'''
if os.path.basename(obj.__file__).split('.')[0] == '__init__':
container.append(os.path.dirname(obj.__file__))
else:
container.append(obj.__file__.replace(... | python | def _add_dependency(container, obj):
'''
Add a dependency to the top list.
:param obj:
:param is_file:
:return:
'''
if os.path.basename(obj.__file__).split('.')[0] == '__init__':
container.append(os.path.dirname(obj.__file__))
else:
container.append(obj.__file__.replace(... | [
"def",
"_add_dependency",
"(",
"container",
",",
"obj",
")",
":",
"if",
"os",
".",
"path",
".",
"basename",
"(",
"obj",
".",
"__file__",
")",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
"==",
"'__init__'",
":",
"container",
".",
"append",
"(",
"o... | Add a dependency to the top list.
:param obj:
:param is_file:
:return: | [
"Add",
"a",
"dependency",
"to",
"the",
"top",
"list",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L155-L166 | train |
saltstack/salt | salt/utils/thin.py | gte | def gte():
'''
This function is called externally from the alternative
Python interpreter from within _get_tops function.
:param extra_mods:
:param so_mods:
:return:
'''
extra = salt.utils.json.loads(sys.argv[1])
tops = get_tops(**extra)
return salt.utils.json.dumps(tops, ensur... | python | def gte():
'''
This function is called externally from the alternative
Python interpreter from within _get_tops function.
:param extra_mods:
:param so_mods:
:return:
'''
extra = salt.utils.json.loads(sys.argv[1])
tops = get_tops(**extra)
return salt.utils.json.dumps(tops, ensur... | [
"def",
"gte",
"(",
")",
":",
"extra",
"=",
"salt",
".",
"utils",
".",
"json",
".",
"loads",
"(",
"sys",
".",
"argv",
"[",
"1",
"]",
")",
"tops",
"=",
"get_tops",
"(",
"*",
"*",
"extra",
")",
"return",
"salt",
".",
"utils",
".",
"json",
".",
"... | This function is called externally from the alternative
Python interpreter from within _get_tops function.
:param extra_mods:
:param so_mods:
:return: | [
"This",
"function",
"is",
"called",
"externally",
"from",
"the",
"alternative",
"Python",
"interpreter",
"from",
"within",
"_get_tops",
"function",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L169-L181 | train |
saltstack/salt | salt/utils/thin.py | get_ext_tops | def get_ext_tops(config):
'''
Get top directories for the dependencies, based on external configuration.
:return:
'''
config = copy.deepcopy(config)
alternatives = {}
required = ['jinja2', 'yaml', 'tornado', 'msgpack']
tops = []
for ns, cfg in salt.ext.six.iteritems(config or {}):
... | python | def get_ext_tops(config):
'''
Get top directories for the dependencies, based on external configuration.
:return:
'''
config = copy.deepcopy(config)
alternatives = {}
required = ['jinja2', 'yaml', 'tornado', 'msgpack']
tops = []
for ns, cfg in salt.ext.six.iteritems(config or {}):
... | [
"def",
"get_ext_tops",
"(",
"config",
")",
":",
"config",
"=",
"copy",
".",
"deepcopy",
"(",
"config",
")",
"alternatives",
"=",
"{",
"}",
"required",
"=",
"[",
"'jinja2'",
",",
"'yaml'",
",",
"'tornado'",
",",
"'msgpack'",
"]",
"tops",
"=",
"[",
"]",
... | Get top directories for the dependencies, based on external configuration.
:return: | [
"Get",
"top",
"directories",
"for",
"the",
"dependencies",
"based",
"on",
"external",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L184-L233 | train |
saltstack/salt | salt/utils/thin.py | _get_ext_namespaces | def _get_ext_namespaces(config):
'''
Get namespaces from the existing configuration.
:param config:
:return:
'''
namespaces = {}
if not config:
return namespaces
for ns in config:
constraint_version = tuple(config[ns].get('py-version', []))
if not constraint_ver... | python | def _get_ext_namespaces(config):
'''
Get namespaces from the existing configuration.
:param config:
:return:
'''
namespaces = {}
if not config:
return namespaces
for ns in config:
constraint_version = tuple(config[ns].get('py-version', []))
if not constraint_ver... | [
"def",
"_get_ext_namespaces",
"(",
"config",
")",
":",
"namespaces",
"=",
"{",
"}",
"if",
"not",
"config",
":",
"return",
"namespaces",
"for",
"ns",
"in",
"config",
":",
"constraint_version",
"=",
"tuple",
"(",
"config",
"[",
"ns",
"]",
".",
"get",
"(",
... | Get namespaces from the existing configuration.
:param config:
:return: | [
"Get",
"namespaces",
"from",
"the",
"existing",
"configuration",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L236-L255 | train |
saltstack/salt | salt/utils/thin.py | get_tops | def get_tops(extra_mods='', so_mods=''):
'''
Get top directories for the dependencies, based on Python interpreter.
:param extra_mods:
:param so_mods:
:return:
'''
tops = []
for mod in [salt, jinja2, yaml, tornado, msgpack, certifi, singledispatch, concurrent,
singledisp... | python | def get_tops(extra_mods='', so_mods=''):
'''
Get top directories for the dependencies, based on Python interpreter.
:param extra_mods:
:param so_mods:
:return:
'''
tops = []
for mod in [salt, jinja2, yaml, tornado, msgpack, certifi, singledispatch, concurrent,
singledisp... | [
"def",
"get_tops",
"(",
"extra_mods",
"=",
"''",
",",
"so_mods",
"=",
"''",
")",
":",
"tops",
"=",
"[",
"]",
"for",
"mod",
"in",
"[",
"salt",
",",
"jinja2",
",",
"yaml",
",",
"tornado",
",",
"msgpack",
",",
"certifi",
",",
"singledispatch",
",",
"c... | Get top directories for the dependencies, based on Python interpreter.
:param extra_mods:
:param so_mods:
:return: | [
"Get",
"top",
"directories",
"for",
"the",
"dependencies",
"based",
"on",
"Python",
"interpreter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L258-L295 | train |
saltstack/salt | salt/utils/thin.py | _get_supported_py_config | def _get_supported_py_config(tops, extended_cfg):
'''
Based on the Salt SSH configuration, create a YAML configuration
for the supported Python interpreter versions. This is then written into the thin.tgz
archive and then verified by salt.client.ssh.ssh_py_shim.get_executable()
Note: Minimum defaul... | python | def _get_supported_py_config(tops, extended_cfg):
'''
Based on the Salt SSH configuration, create a YAML configuration
for the supported Python interpreter versions. This is then written into the thin.tgz
archive and then verified by salt.client.ssh.ssh_py_shim.get_executable()
Note: Minimum defaul... | [
"def",
"_get_supported_py_config",
"(",
"tops",
",",
"extended_cfg",
")",
":",
"pymap",
"=",
"[",
"]",
"for",
"py_ver",
",",
"tops",
"in",
"_six",
".",
"iteritems",
"(",
"copy",
".",
"deepcopy",
"(",
"tops",
")",
")",
":",
"py_ver",
"=",
"int",
"(",
... | Based on the Salt SSH configuration, create a YAML configuration
for the supported Python interpreter versions. This is then written into the thin.tgz
archive and then verified by salt.client.ssh.ssh_py_shim.get_executable()
Note: Minimum default of 2.x versions is 2.7 and 3.x is 3.0, unless specified in n... | [
"Based",
"on",
"the",
"Salt",
"SSH",
"configuration",
"create",
"a",
"YAML",
"configuration",
"for",
"the",
"supported",
"Python",
"interpreter",
"versions",
".",
"This",
"is",
"then",
"written",
"into",
"the",
"thin",
".",
"tgz",
"archive",
"and",
"then",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L298-L320 | train |
saltstack/salt | salt/utils/thin.py | _get_thintar_prefix | def _get_thintar_prefix(tarname):
'''
Make sure thintar temporary name is concurrent and secure.
:param tarname: name of the chosen tarball
:return: prefixed tarname
'''
tfd, tmp_tarname = tempfile.mkstemp(dir=os.path.dirname(tarname), prefix=".thin-",
su... | python | def _get_thintar_prefix(tarname):
'''
Make sure thintar temporary name is concurrent and secure.
:param tarname: name of the chosen tarball
:return: prefixed tarname
'''
tfd, tmp_tarname = tempfile.mkstemp(dir=os.path.dirname(tarname), prefix=".thin-",
su... | [
"def",
"_get_thintar_prefix",
"(",
"tarname",
")",
":",
"tfd",
",",
"tmp_tarname",
"=",
"tempfile",
".",
"mkstemp",
"(",
"dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"tarname",
")",
",",
"prefix",
"=",
"\".thin-\"",
",",
"suffix",
"=",
"\".\"",
... | Make sure thintar temporary name is concurrent and secure.
:param tarname: name of the chosen tarball
:return: prefixed tarname | [
"Make",
"sure",
"thintar",
"temporary",
"name",
"is",
"concurrent",
"and",
"secure",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L323-L334 | train |
saltstack/salt | salt/utils/thin.py | gen_thin | def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods='',
python2_bin='python2', python3_bin='python3', absonly=True,
compress='gzip', extended_cfg=None):
'''
Generate the salt-thin tarball and print the location of the tarball
Optional additional mods to include (e.g. mak... | python | def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods='',
python2_bin='python2', python3_bin='python3', absonly=True,
compress='gzip', extended_cfg=None):
'''
Generate the salt-thin tarball and print the location of the tarball
Optional additional mods to include (e.g. mak... | [
"def",
"gen_thin",
"(",
"cachedir",
",",
"extra_mods",
"=",
"''",
",",
"overwrite",
"=",
"False",
",",
"so_mods",
"=",
"''",
",",
"python2_bin",
"=",
"'python2'",
",",
"python3_bin",
"=",
"'python3'",
",",
"absonly",
"=",
"True",
",",
"compress",
"=",
"'... | Generate the salt-thin tarball and print the location of the tarball
Optional additional mods to include (e.g. mako) can be supplied as a comma
delimited string. Permits forcing an overwrite of the output file as well.
CLI Example:
.. code-block:: bash
salt-run thin.generate
salt-run... | [
"Generate",
"the",
"salt",
"-",
"thin",
"tarball",
"and",
"print",
"the",
"location",
"of",
"the",
"tarball",
"Optional",
"additional",
"mods",
"to",
"include",
"(",
"e",
".",
"g",
".",
"mako",
")",
"can",
"be",
"supplied",
"as",
"a",
"comma",
"delimited... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L337-L563 | train |
saltstack/salt | salt/utils/thin.py | thin_sum | def thin_sum(cachedir, form='sha1'):
'''
Return the checksum of the current thin tarball
'''
thintar = gen_thin(cachedir)
code_checksum_path = os.path.join(cachedir, 'thin', 'code-checksum')
if os.path.isfile(code_checksum_path):
with salt.utils.files.fopen(code_checksum_path, 'r') as fh... | python | def thin_sum(cachedir, form='sha1'):
'''
Return the checksum of the current thin tarball
'''
thintar = gen_thin(cachedir)
code_checksum_path = os.path.join(cachedir, 'thin', 'code-checksum')
if os.path.isfile(code_checksum_path):
with salt.utils.files.fopen(code_checksum_path, 'r') as fh... | [
"def",
"thin_sum",
"(",
"cachedir",
",",
"form",
"=",
"'sha1'",
")",
":",
"thintar",
"=",
"gen_thin",
"(",
"cachedir",
")",
"code_checksum_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cachedir",
",",
"'thin'",
",",
"'code-checksum'",
")",
"if",
"os"... | Return the checksum of the current thin tarball | [
"Return",
"the",
"checksum",
"of",
"the",
"current",
"thin",
"tarball"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L566-L578 | train |
saltstack/salt | salt/utils/thin.py | gen_min | def gen_min(cachedir, extra_mods='', overwrite=False, so_mods='',
python2_bin='python2', python3_bin='python3'):
'''
Generate the salt-min tarball and print the location of the tarball
Optional additional mods to include (e.g. mako) can be supplied as a comma
delimited string. Permits forci... | python | def gen_min(cachedir, extra_mods='', overwrite=False, so_mods='',
python2_bin='python2', python3_bin='python3'):
'''
Generate the salt-min tarball and print the location of the tarball
Optional additional mods to include (e.g. mako) can be supplied as a comma
delimited string. Permits forci... | [
"def",
"gen_min",
"(",
"cachedir",
",",
"extra_mods",
"=",
"''",
",",
"overwrite",
"=",
"False",
",",
"so_mods",
"=",
"''",
",",
"python2_bin",
"=",
"'python2'",
",",
"python3_bin",
"=",
"'python3'",
")",
":",
"mindir",
"=",
"os",
".",
"path",
".",
"jo... | Generate the salt-min tarball and print the location of the tarball
Optional additional mods to include (e.g. mako) can be supplied as a comma
delimited string. Permits forcing an overwrite of the output file as well.
CLI Example:
.. code-block:: bash
salt-run min.generate
salt-run m... | [
"Generate",
"the",
"salt",
"-",
"min",
"tarball",
"and",
"print",
"the",
"location",
"of",
"the",
"tarball",
"Optional",
"additional",
"mods",
"to",
"include",
"(",
"e",
".",
"g",
".",
"mako",
")",
"can",
"be",
"supplied",
"as",
"a",
"comma",
"delimited"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L581-L859 | train |
saltstack/salt | salt/utils/thin.py | min_sum | def min_sum(cachedir, form='sha1'):
'''
Return the checksum of the current thin tarball
'''
mintar = gen_min(cachedir)
return salt.utils.hashutils.get_hash(mintar, form) | python | def min_sum(cachedir, form='sha1'):
'''
Return the checksum of the current thin tarball
'''
mintar = gen_min(cachedir)
return salt.utils.hashutils.get_hash(mintar, form) | [
"def",
"min_sum",
"(",
"cachedir",
",",
"form",
"=",
"'sha1'",
")",
":",
"mintar",
"=",
"gen_min",
"(",
"cachedir",
")",
"return",
"salt",
".",
"utils",
".",
"hashutils",
".",
"get_hash",
"(",
"mintar",
",",
"form",
")"
] | Return the checksum of the current thin tarball | [
"Return",
"the",
"checksum",
"of",
"the",
"current",
"thin",
"tarball"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/thin.py#L862-L867 | train |
saltstack/salt | salt/modules/solarisipspkg.py | refresh_db | def refresh_db(full=False, **kwargs):
'''
Updates the remote repos database.
full : False
Set to ``True`` to force a refresh of the pkg DB from all publishers,
regardless of the last refresh time.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
salt '*'... | python | def refresh_db(full=False, **kwargs):
'''
Updates the remote repos database.
full : False
Set to ``True`` to force a refresh of the pkg DB from all publishers,
regardless of the last refresh time.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
salt '*'... | [
"def",
"refresh_db",
"(",
"full",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Remove rtag file to keep multiple refreshes from happening in pkg states",
"salt",
".",
"utils",
".",
"pkg",
".",
"clear_rtag",
"(",
"__opts__",
")",
"if",
"full",
":",
"return",... | Updates the remote repos database.
full : False
Set to ``True`` to force a refresh of the pkg DB from all publishers,
regardless of the last refresh time.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
salt '*' pkg.refresh_db full=True | [
"Updates",
"the",
"remote",
"repos",
"database",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L112-L133 | train |
saltstack/salt | salt/modules/solarisipspkg.py | upgrade_available | def upgrade_available(name, **kwargs):
'''
Check if there is an upgrade available for a certain package
Accepts full or partial FMRI. Returns all matches found.
CLI Example:
.. code-block:: bash
salt '*' pkg.upgrade_available apache-22
'''
version = None
cmd = ['pkg', 'list', ... | python | def upgrade_available(name, **kwargs):
'''
Check if there is an upgrade available for a certain package
Accepts full or partial FMRI. Returns all matches found.
CLI Example:
.. code-block:: bash
salt '*' pkg.upgrade_available apache-22
'''
version = None
cmd = ['pkg', 'list', ... | [
"def",
"upgrade_available",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"version",
"=",
"None",
"cmd",
"=",
"[",
"'pkg'",
",",
"'list'",
",",
"'-Huv'",
",",
"name",
"]",
"lines",
"=",
"__salt__",
"[",
"'cmd.run_stdout'",
"]",
"(",
"cmd",
")",
"."... | Check if there is an upgrade available for a certain package
Accepts full or partial FMRI. Returns all matches found.
CLI Example:
.. code-block:: bash
salt '*' pkg.upgrade_available apache-22 | [
"Check",
"if",
"there",
"is",
"an",
"upgrade",
"available",
"for",
"a",
"certain",
"package",
"Accepts",
"full",
"or",
"partial",
"FMRI",
".",
"Returns",
"all",
"matches",
"found",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L136-L155 | train |
saltstack/salt | salt/modules/solarisipspkg.py | list_upgrades | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
Lists all packages available for update.
When run in global zone, it reports only upgradable packages for the global
zone.
When run in non-global zone, it can report more upgradable packages than
``pkg update -vn``, becaus... | python | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
Lists all packages available for update.
When run in global zone, it reports only upgradable packages for the global
zone.
When run in non-global zone, it can report more upgradable packages than
``pkg update -vn``, becaus... | [
"def",
"list_upgrades",
"(",
"refresh",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
"full",
"=",
"True",
")",
"upgrades",... | Lists all packages available for update.
When run in global zone, it reports only upgradable packages for the global
zone.
When run in non-global zone, it can report more upgradable packages than
``pkg update -vn``, because ``pkg update`` hides packages that require
newer version of ``pkg://solari... | [
"Lists",
"all",
"packages",
"available",
"for",
"update",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L158-L196 | train |
saltstack/salt | salt/modules/solarisipspkg.py | upgrade | def upgrade(refresh=False, **kwargs):
'''
Upgrade all packages to the latest possible version.
When run in global zone, it updates also all non-global zones.
In non-global zones upgrade is limited by dependency constrains linked to
the version of pkg://solaris/entire.
Returns a dictionary conta... | python | def upgrade(refresh=False, **kwargs):
'''
Upgrade all packages to the latest possible version.
When run in global zone, it updates also all non-global zones.
In non-global zones upgrade is limited by dependency constrains linked to
the version of pkg://solaris/entire.
Returns a dictionary conta... | [
"def",
"upgrade",
"(",
"refresh",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"refresh",
")",
":",
"refresh_db",
"(",
")",
"# Get a list of the packages before install so we can diff after to see... | Upgrade all packages to the latest possible version.
When run in global zone, it updates also all non-global zones.
In non-global zones upgrade is limited by dependency constrains linked to
the version of pkg://solaris/entire.
Returns a dictionary containing the changes:
.. code-block:: python
... | [
"Upgrade",
"all",
"packages",
"to",
"the",
"latest",
"possible",
"version",
".",
"When",
"run",
"in",
"global",
"zone",
"it",
"updates",
"also",
"all",
"non",
"-",
"global",
"zones",
".",
"In",
"non",
"-",
"global",
"zones",
"upgrade",
"is",
"limited",
"... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L199-L248 | train |
saltstack/salt | salt/modules/solarisipspkg.py | list_pkgs | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the currently installed packages as a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
# not yet implemented or not applicable
if any([salt.utils.data.is_true(kwar... | python | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the currently installed packages as a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
# not yet implemented or not applicable
if any([salt.utils.data.is_true(kwar... | [
"def",
"list_pkgs",
"(",
"versions_as_list",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# not yet implemented or not applicable",
"if",
"any",
"(",
"[",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"kwargs",
".",
"get",
"(",
"x",
")",
"... | List the currently installed packages as a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs | [
"List",
"the",
"currently",
"installed",
"packages",
"as",
"a",
"dict",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L251-L289 | train |
saltstack/salt | salt/modules/solarisipspkg.py | version | def version(*names, **kwargs):
'''
Common interface for obtaining the version of installed packages.
Accepts full or partial FMRI. If called using pkg_resource, full FMRI is required.
Partial FMRI is returned if the package is not installed.
CLI Example:
.. code-block:: bash
salt '*' ... | python | def version(*names, **kwargs):
'''
Common interface for obtaining the version of installed packages.
Accepts full or partial FMRI. If called using pkg_resource, full FMRI is required.
Partial FMRI is returned if the package is not installed.
CLI Example:
.. code-block:: bash
salt '*' ... | [
"def",
"version",
"(",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"names",
":",
"return",
"''",
"cmd",
"=",
"[",
"'/bin/pkg'",
",",
"'list'",
",",
"'-Hv'",
"]",
"cmd",
".",
"extend",
"(",
"names",
")",
"lines",
"=",
"__salt__",
... | Common interface for obtaining the version of installed packages.
Accepts full or partial FMRI. If called using pkg_resource, full FMRI is required.
Partial FMRI is returned if the package is not installed.
CLI Example:
.. code-block:: bash
salt '*' pkg.version vim
salt '*' pkg.versio... | [
"Common",
"interface",
"for",
"obtaining",
"the",
"version",
"of",
"installed",
"packages",
".",
"Accepts",
"full",
"or",
"partial",
"FMRI",
".",
"If",
"called",
"using",
"pkg_resource",
"full",
"FMRI",
"is",
"required",
".",
"Partial",
"FMRI",
"is",
"returned... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L292-L328 | train |
saltstack/salt | salt/modules/solarisipspkg.py | get_fmri | def get_fmri(name, **kwargs):
'''
Returns FMRI from partial name. Returns empty string ('') if not found.
In case of multiple match, the function returns list of all matched packages.
CLI Example:
.. code-block:: bash
salt '*' pkg.get_fmri bash
'''
if name.startswith('pkg://'):
... | python | def get_fmri(name, **kwargs):
'''
Returns FMRI from partial name. Returns empty string ('') if not found.
In case of multiple match, the function returns list of all matched packages.
CLI Example:
.. code-block:: bash
salt '*' pkg.get_fmri bash
'''
if name.startswith('pkg://'):
... | [
"def",
"get_fmri",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'pkg://'",
")",
":",
"# already full fmri",
"return",
"name",
"cmd",
"=",
"[",
"'/bin/pkg'",
",",
"'list'",
",",
"'-aHv'",
",",
"name",
"]",
"# th... | Returns FMRI from partial name. Returns empty string ('') if not found.
In case of multiple match, the function returns list of all matched packages.
CLI Example:
.. code-block:: bash
salt '*' pkg.get_fmri bash | [
"Returns",
"FMRI",
"from",
"partial",
"name",
".",
"Returns",
"empty",
"string",
"(",
")",
"if",
"not",
"found",
".",
"In",
"case",
"of",
"multiple",
"match",
"the",
"function",
"returns",
"list",
"of",
"all",
"matched",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L394-L418 | train |
saltstack/salt | salt/modules/solarisipspkg.py | normalize_name | def normalize_name(name, **kwargs):
'''
Internal function. Normalizes pkg name to full FMRI before running
pkg.install. In case of multiple matches or no match, it returns the name
without modifications.
CLI Example:
.. code-block:: bash
salt '*' pkg.normalize_name vim
'''
if ... | python | def normalize_name(name, **kwargs):
'''
Internal function. Normalizes pkg name to full FMRI before running
pkg.install. In case of multiple matches or no match, it returns the name
without modifications.
CLI Example:
.. code-block:: bash
salt '*' pkg.normalize_name vim
'''
if ... | [
"def",
"normalize_name",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'pkg://'",
")",
":",
"# already full fmri",
"return",
"name",
"cmd",
"=",
"[",
"'/bin/pkg'",
",",
"'list'",
",",
"'-aHv'",
",",
"name",
"]",
... | Internal function. Normalizes pkg name to full FMRI before running
pkg.install. In case of multiple matches or no match, it returns the name
without modifications.
CLI Example:
.. code-block:: bash
salt '*' pkg.normalize_name vim | [
"Internal",
"function",
".",
"Normalizes",
"pkg",
"name",
"to",
"full",
"FMRI",
"before",
"running",
"pkg",
".",
"install",
".",
"In",
"case",
"of",
"multiple",
"matches",
"or",
"no",
"match",
"it",
"returns",
"the",
"name",
"without",
"modifications",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L421-L445 | train |
saltstack/salt | salt/modules/solarisipspkg.py | search | def search(name, versions_as_list=False, **kwargs):
'''
Searches the repository for given pkg name.
The name can be full or partial FMRI. All matches are printed. Globs are
also supported.
CLI Example:
.. code-block:: bash
salt '*' pkg.search bash
'''
ret = {}
cmd = ['/bi... | python | def search(name, versions_as_list=False, **kwargs):
'''
Searches the repository for given pkg name.
The name can be full or partial FMRI. All matches are printed. Globs are
also supported.
CLI Example:
.. code-block:: bash
salt '*' pkg.search bash
'''
ret = {}
cmd = ['/bi... | [
"def",
"search",
"(",
"name",
",",
"versions_as_list",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"cmd",
"=",
"[",
"'/bin/pkg'",
",",
"'list'",
",",
"'-aHv'",
",",
"name",
"]",
"out",
"=",
"__salt__",
"[",
"'cmd.run_all'",... | Searches the repository for given pkg name.
The name can be full or partial FMRI. All matches are printed. Globs are
also supported.
CLI Example:
.. code-block:: bash
salt '*' pkg.search bash | [
"Searches",
"the",
"repository",
"for",
"given",
"pkg",
"name",
".",
"The",
"name",
"can",
"be",
"full",
"or",
"partial",
"FMRI",
".",
"All",
"matches",
"are",
"printed",
".",
"Globs",
"are",
"also",
"supported",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L465-L493 | train |
saltstack/salt | salt/modules/solarisipspkg.py | install | def install(name=None, refresh=False, pkgs=None, version=None, test=False, **kwargs):
'''
Install the named package using the IPS pkg command.
Accepts full or partial FMRI.
Returns a dict containing the new package names and versions::
{'<package>': {'old': '<old-version>',
... | python | def install(name=None, refresh=False, pkgs=None, version=None, test=False, **kwargs):
'''
Install the named package using the IPS pkg command.
Accepts full or partial FMRI.
Returns a dict containing the new package names and versions::
{'<package>': {'old': '<old-version>',
... | [
"def",
"install",
"(",
"name",
"=",
"None",
",",
"refresh",
"=",
"False",
",",
"pkgs",
"=",
"None",
",",
"version",
"=",
"None",
",",
"test",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"pkgs",
":",
"if",
"is_installed",
"(",
"n... | Install the named package using the IPS pkg command.
Accepts full or partial FMRI.
Returns a dict containing the new package names and versions::
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
Multiple Package Installation Options:
pkgs
A list... | [
"Install",
"the",
"named",
"package",
"using",
"the",
"IPS",
"pkg",
"command",
".",
"Accepts",
"full",
"or",
"partial",
"FMRI",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L496-L586 | train |
saltstack/salt | salt/modules/solarisipspkg.py | remove | def remove(name=None, pkgs=None, **kwargs):
'''
Remove specified package. Accepts full or partial FMRI.
In case of multiple match, the command fails and won't modify the OS.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delet... | python | def remove(name=None, pkgs=None, **kwargs):
'''
Remove specified package. Accepts full or partial FMRI.
In case of multiple match, the command fails and won't modify the OS.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delet... | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"targets",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"split_input",
"(",
"pkgs",
")",
"if",
"pkgs",
"else",
"[",
"name",
"]",
"if",
"not",
... | Remove specified package. Accepts full or partial FMRI.
In case of multiple match, the command fails and won't modify the OS.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name``... | [
"Remove",
"specified",
"package",
".",
"Accepts",
"full",
"or",
"partial",
"FMRI",
".",
"In",
"case",
"of",
"multiple",
"match",
"the",
"command",
"fails",
"and",
"won",
"t",
"modify",
"the",
"OS",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L589-L645 | train |
saltstack/salt | salt/pillar/cmd_json.py | ext_pillar | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
command):
'''
Execute a command and read the output as JSON
'''
try:
command = command.replace('%s', minion_id)
return salt.utils.json.loads(__salt__['cmd.run'](command))
... | python | def ext_pillar(minion_id, # pylint: disable=W0613
pillar, # pylint: disable=W0613
command):
'''
Execute a command and read the output as JSON
'''
try:
command = command.replace('%s', minion_id)
return salt.utils.json.loads(__salt__['cmd.run'](command))
... | [
"def",
"ext_pillar",
"(",
"minion_id",
",",
"# pylint: disable=W0613",
"pillar",
",",
"# pylint: disable=W0613",
"command",
")",
":",
"try",
":",
"command",
"=",
"command",
".",
"replace",
"(",
"'%s'",
",",
"minion_id",
")",
"return",
"salt",
".",
"utils",
"."... | Execute a command and read the output as JSON | [
"Execute",
"a",
"command",
"and",
"read",
"the",
"output",
"as",
"JSON"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/cmd_json.py#L20-L31 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | _tap | def _tap(tap, runas=None):
'''
Add unofficial GitHub repos to the list of formulas that brew tracks,
updates, and installs from.
'''
if tap in _list_taps():
return True
cmd = 'tap {0}'.format(tap)
try:
_call_brew(cmd)
except CommandExecutionError:
log.error('Fail... | python | def _tap(tap, runas=None):
'''
Add unofficial GitHub repos to the list of formulas that brew tracks,
updates, and installs from.
'''
if tap in _list_taps():
return True
cmd = 'tap {0}'.format(tap)
try:
_call_brew(cmd)
except CommandExecutionError:
log.error('Fail... | [
"def",
"_tap",
"(",
"tap",
",",
"runas",
"=",
"None",
")",
":",
"if",
"tap",
"in",
"_list_taps",
"(",
")",
":",
"return",
"True",
"cmd",
"=",
"'tap {0}'",
".",
"format",
"(",
"tap",
")",
"try",
":",
"_call_brew",
"(",
"cmd",
")",
"except",
"Command... | Add unofficial GitHub repos to the list of formulas that brew tracks,
updates, and installs from. | [
"Add",
"unofficial",
"GitHub",
"repos",
"to",
"the",
"list",
"of",
"formulas",
"that",
"brew",
"tracks",
"updates",
"and",
"installs",
"from",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L55-L70 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | _call_brew | def _call_brew(cmd, failhard=True):
'''
Calls the brew command with the user account of brew
'''
user = __salt__['file.get_user'](_homebrew_bin())
runas = user if user != __opts__['user'] else None
cmd = '{} {}'.format(salt.utils.path.which('brew'), cmd)
result = __salt__['cmd.run_all'](cmd,... | python | def _call_brew(cmd, failhard=True):
'''
Calls the brew command with the user account of brew
'''
user = __salt__['file.get_user'](_homebrew_bin())
runas = user if user != __opts__['user'] else None
cmd = '{} {}'.format(salt.utils.path.which('brew'), cmd)
result = __salt__['cmd.run_all'](cmd,... | [
"def",
"_call_brew",
"(",
"cmd",
",",
"failhard",
"=",
"True",
")",
":",
"user",
"=",
"__salt__",
"[",
"'file.get_user'",
"]",
"(",
"_homebrew_bin",
"(",
")",
")",
"runas",
"=",
"user",
"if",
"user",
"!=",
"__opts__",
"[",
"'user'",
"]",
"else",
"None"... | Calls the brew command with the user account of brew | [
"Calls",
"the",
"brew",
"command",
"with",
"the",
"user",
"account",
"of",
"brew"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L82-L96 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | list_pkgs | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... | python | def list_pkgs(versions_as_list=False, **kwargs):
'''
List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs
'''
versions_as_list = salt.utils.data.is_true(versions_as_list)
# not yet imple... | [
"def",
"list_pkgs",
"(",
"versions_as_list",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"versions_as_list",
"=",
"salt",
".",
"utils",
".",
"data",
".",
"is_true",
"(",
"versions_as_list",
")",
"# not yet implemented or not applicable",
"if",
"any",
"(",
... | List the packages currently installed in a dict::
{'<package_name>': '<version>'}
CLI Example:
.. code-block:: bash
salt '*' pkg.list_pkgs | [
"List",
"the",
"packages",
"currently",
"installed",
"in",
"a",
"dict",
"::"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L99-L166 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | remove | def remove(name=None, pkgs=None, **kwargs):
'''
Removes packages with ``brew uninstall``.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if th... | python | def remove(name=None, pkgs=None, **kwargs):
'''
Removes packages with ``brew uninstall``.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if th... | [
"def",
"remove",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
"=",
"__salt__",
"[",
"'pkg_resource.parse_targets'",
"]",
"(",
"name",
",",
"pkgs",
",",
"*",
"*",
"kwargs",
")",
"[",
... | Removes packages with ``brew uninstall``.
name
The name of the package to be deleted.
Multiple Package Options:
pkgs
A list of packages to delete. Must be passed as a python list. The
``name`` parameter will be ignored if this option is passed.
.. versionadded:: 0.16.0
... | [
"Removes",
"packages",
"with",
"brew",
"uninstall",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L220-L276 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | refresh_db | def refresh_db(**kwargs):
'''
Update the homebrew package repository.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple refreshes from happening in pkg states
salt.utils.pkg.clear_rtag(__opts__)
cmd = 'update'
if _call_brew(c... | python | def refresh_db(**kwargs):
'''
Update the homebrew package repository.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db
'''
# Remove rtag file to keep multiple refreshes from happening in pkg states
salt.utils.pkg.clear_rtag(__opts__)
cmd = 'update'
if _call_brew(c... | [
"def",
"refresh_db",
"(",
"*",
"*",
"kwargs",
")",
":",
"# Remove rtag file to keep multiple refreshes from happening in pkg states",
"salt",
".",
"utils",
".",
"pkg",
".",
"clear_rtag",
"(",
"__opts__",
")",
"cmd",
"=",
"'update'",
"if",
"_call_brew",
"(",
"cmd",
... | Update the homebrew package repository.
CLI Example:
.. code-block:: bash
salt '*' pkg.refresh_db | [
"Update",
"the",
"homebrew",
"package",
"repository",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L279-L296 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | _info | def _info(*pkgs):
'''
Get all info brew can provide about a list of packages.
Does not do any kind of processing, so the format depends entirely on
the output brew gives. This may change if a new version of the format is
requested.
On failure, returns an empty dict and logs failure.
On suc... | python | def _info(*pkgs):
'''
Get all info brew can provide about a list of packages.
Does not do any kind of processing, so the format depends entirely on
the output brew gives. This may change if a new version of the format is
requested.
On failure, returns an empty dict and logs failure.
On suc... | [
"def",
"_info",
"(",
"*",
"pkgs",
")",
":",
"cmd",
"=",
"'info --json=v1 {0}'",
".",
"format",
"(",
"' '",
".",
"join",
"(",
"pkgs",
")",
")",
"brew_result",
"=",
"_call_brew",
"(",
"cmd",
")",
"if",
"brew_result",
"[",
"'retcode'",
"]",
":",
"log",
... | Get all info brew can provide about a list of packages.
Does not do any kind of processing, so the format depends entirely on
the output brew gives. This may change if a new version of the format is
requested.
On failure, returns an empty dict and logs failure.
On success, returns a dict mapping e... | [
"Get",
"all",
"info",
"brew",
"can",
"provide",
"about",
"a",
"list",
"of",
"packages",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L299-L321 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | install | def install(name=None, pkgs=None, taps=None, options=None, **kwargs):
'''
Install the passed package(s) with ``brew install``
name
The name of the formula to be installed. Note that this parameter is
ignored if "pkgs" is passed.
CLI Example:
.. code-block:: bash
... | python | def install(name=None, pkgs=None, taps=None, options=None, **kwargs):
'''
Install the passed package(s) with ``brew install``
name
The name of the formula to be installed. Note that this parameter is
ignored if "pkgs" is passed.
CLI Example:
.. code-block:: bash
... | [
"def",
"install",
"(",
"name",
"=",
"None",
",",
"pkgs",
"=",
"None",
",",
"taps",
"=",
"None",
",",
"options",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"pkg_params",
",",
"pkg_type",
"=",
"__salt__",
"[",
"'pkg_resource.parse_target... | Install the passed package(s) with ``brew install``
name
The name of the formula to be installed. Note that this parameter is
ignored if "pkgs" is passed.
CLI Example:
.. code-block:: bash
salt '*' pkg.install <package name>
taps
Unofficial GitHub repos t... | [
"Install",
"the",
"passed",
"package",
"(",
"s",
")",
"with",
"brew",
"install"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L324-L430 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | list_upgrades | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
Check whether or not an upgrade is available for all packages
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
'''
if refresh:
refresh_db()
res = _call_brew('outdated --json=v1')
ret =... | python | def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613
'''
Check whether or not an upgrade is available for all packages
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades
'''
if refresh:
refresh_db()
res = _call_brew('outdated --json=v1')
ret =... | [
"def",
"list_upgrades",
"(",
"refresh",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0613",
"if",
"refresh",
":",
"refresh_db",
"(",
")",
"res",
"=",
"_call_brew",
"(",
"'outdated --json=v1'",
")",
"ret",
"=",
"{",
"}",
"try",
":",
... | Check whether or not an upgrade is available for all packages
CLI Example:
.. code-block:: bash
salt '*' pkg.list_upgrades | [
"Check",
"whether",
"or",
"not",
"an",
"upgrade",
"is",
"available",
"for",
"all",
"packages"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L433-L459 | train |
saltstack/salt | salt/modules/mac_brew_pkg.py | upgrade | def upgrade(refresh=True, **kwargs):
'''
Upgrade outdated, unpinned brews.
refresh
Fetch the newest version of Homebrew and all formulae from GitHub before installing.
Returns a dictionary containing the changes:
.. code-block:: python
{'<package>': {'old': '<old-version>',
... | python | def upgrade(refresh=True, **kwargs):
'''
Upgrade outdated, unpinned brews.
refresh
Fetch the newest version of Homebrew and all formulae from GitHub before installing.
Returns a dictionary containing the changes:
.. code-block:: python
{'<package>': {'old': '<old-version>',
... | [
"def",
"upgrade",
"(",
"refresh",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"''",
",",
"}",
"old",
"=",
"list_pkgs",
"(",
")",
"if",
"salt",
... | Upgrade outdated, unpinned brews.
refresh
Fetch the newest version of Homebrew and all formulae from GitHub before installing.
Returns a dictionary containing the changes:
.. code-block:: python
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
... | [
"Upgrade",
"outdated",
"unpinned",
"brews",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_brew_pkg.py#L475-L517 | train |
saltstack/salt | salt/states/chronos_job.py | config | def config(name, config):
'''
Ensure that the chronos job with the given name is present and is configured
to match the given config values.
:param name: The job name
:param config: The configuration to apply (dict)
:return: A standard Salt changes dictionary
'''
# setup return structur... | python | def config(name, config):
'''
Ensure that the chronos job with the given name is present and is configured
to match the given config values.
:param name: The job name
:param config: The configuration to apply (dict)
:return: A standard Salt changes dictionary
'''
# setup return structur... | [
"def",
"config",
"(",
"name",
",",
"config",
")",
":",
"# setup return structure",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"False",
",",
"'comment'",
":",
"''",
",",
"}",
"# get existing config if job ... | Ensure that the chronos job with the given name is present and is configured
to match the given config values.
:param name: The job name
:param config: The configuration to apply (dict)
:return: A standard Salt changes dictionary | [
"Ensure",
"that",
"the",
"chronos",
"job",
"with",
"the",
"given",
"name",
"is",
"present",
"and",
"is",
"configured",
"to",
"match",
"the",
"given",
"config",
"values",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/chronos_job.py#L27-L113 | train |
saltstack/salt | salt/states/infoblox_range.py | present | def present(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
'''
Ensure range record is present.
infoblox_range.present:
start_addr: '129.97.150.160',
end_addr: '129.97.150.170',
Verbose state example:
.. code-block:: yaml
infoblox_range.present:
... | python | def present(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
'''
Ensure range record is present.
infoblox_range.present:
start_addr: '129.97.150.160',
end_addr: '129.97.150.170',
Verbose state example:
.. code-block:: yaml
infoblox_range.present:
... | [
"def",
"present",
"(",
"name",
"=",
"None",
",",
"start_addr",
"=",
"None",
",",
"end_addr",
"=",
"None",
",",
"data",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"... | Ensure range record is present.
infoblox_range.present:
start_addr: '129.97.150.160',
end_addr: '129.97.150.170',
Verbose state example:
.. code-block:: yaml
infoblox_range.present:
data: {
'always_update_dns': False,
'authority': False... | [
"Ensure",
"range",
"record",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/infoblox_range.py#L17-L140 | train |
saltstack/salt | salt/states/infoblox_range.py | absent | def absent(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
'''
Ensure the range is removed
Supplying the end of the range is optional.
State example:
.. code-block:: yaml
infoblox_range.absent:
- name: 'vlan10'
infoblox_range.absent:
- ... | python | def absent(name=None, start_addr=None, end_addr=None, data=None, **api_opts):
'''
Ensure the range is removed
Supplying the end of the range is optional.
State example:
.. code-block:: yaml
infoblox_range.absent:
- name: 'vlan10'
infoblox_range.absent:
- ... | [
"def",
"absent",
"(",
"name",
"=",
"None",
",",
"start_addr",
"=",
"None",
",",
"end_addr",
"=",
"None",
",",
"data",
"=",
"None",
",",
"*",
"*",
"api_opts",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'result'",
":",
"False",
",",
"'... | Ensure the range is removed
Supplying the end of the range is optional.
State example:
.. code-block:: yaml
infoblox_range.absent:
- name: 'vlan10'
infoblox_range.absent:
- name:
- start_addr: 127.0.1.20 | [
"Ensure",
"the",
"range",
"is",
"removed"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/infoblox_range.py#L143-L191 | train |
saltstack/salt | salt/utils/vt_helper.py | SSHConnection.sendline | def sendline(self, cmd):
'''
Send this command to the server and
return a tuple of the output and the stderr.
The format for parameters is:
cmd (string): The command to send to the sever.
'''
self.conn.sendline(cmd, self.linesep)
# saw_prompt = False
... | python | def sendline(self, cmd):
'''
Send this command to the server and
return a tuple of the output and the stderr.
The format for parameters is:
cmd (string): The command to send to the sever.
'''
self.conn.sendline(cmd, self.linesep)
# saw_prompt = False
... | [
"def",
"sendline",
"(",
"self",
",",
"cmd",
")",
":",
"self",
".",
"conn",
".",
"sendline",
"(",
"cmd",
",",
"self",
".",
"linesep",
")",
"# saw_prompt = False",
"ret_stdout",
"=",
"[",
"]",
"ret_stderr",
"=",
"[",
"]",
"while",
"self",
".",
"conn",
... | Send this command to the server and
return a tuple of the output and the stderr.
The format for parameters is:
cmd (string): The command to send to the sever. | [
"Send",
"this",
"command",
"to",
"the",
"server",
"and",
"return",
"a",
"tuple",
"of",
"the",
"output",
"and",
"the",
"stderr",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vt_helper.py#L107-L133 | train |
saltstack/salt | salt/utils/vmware.py | esxcli | def esxcli(host, user, pwd, cmd, protocol=None, port=None, esxi_host=None, credstore=None):
'''
Shell out and call the specified esxcli commmand, parse the result
and return something sane.
:param host: ESXi or vCenter host to connect to
:param user: User to connect as, usually root
:param pwd:... | python | def esxcli(host, user, pwd, cmd, protocol=None, port=None, esxi_host=None, credstore=None):
'''
Shell out and call the specified esxcli commmand, parse the result
and return something sane.
:param host: ESXi or vCenter host to connect to
:param user: User to connect as, usually root
:param pwd:... | [
"def",
"esxcli",
"(",
"host",
",",
"user",
",",
"pwd",
",",
"cmd",
",",
"protocol",
"=",
"None",
",",
"port",
"=",
"None",
",",
"esxi_host",
"=",
"None",
",",
"credstore",
"=",
"None",
")",
":",
"esx_cmd",
"=",
"salt",
".",
"utils",
".",
"path",
... | Shell out and call the specified esxcli commmand, parse the result
and return something sane.
:param host: ESXi or vCenter host to connect to
:param user: User to connect as, usually root
:param pwd: Password to connect with
:param port: TCP port
:param cmd: esxcli command and arguments
:pa... | [
"Shell",
"out",
"and",
"call",
"the",
"specified",
"esxcli",
"commmand",
"parse",
"the",
"result",
"and",
"return",
"something",
"sane",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L125-L179 | train |
saltstack/salt | salt/utils/vmware.py | _get_service_instance | def _get_service_instance(host, username, password, protocol,
port, mechanism, principal, domain):
'''
Internal method to authenticate with a vCenter server or ESX/ESXi host
and return the service instance object.
'''
log.trace('Retrieving new service instance')
token =... | python | def _get_service_instance(host, username, password, protocol,
port, mechanism, principal, domain):
'''
Internal method to authenticate with a vCenter server or ESX/ESXi host
and return the service instance object.
'''
log.trace('Retrieving new service instance')
token =... | [
"def",
"_get_service_instance",
"(",
"host",
",",
"username",
",",
"password",
",",
"protocol",
",",
"port",
",",
"mechanism",
",",
"principal",
",",
"domain",
")",
":",
"log",
".",
"trace",
"(",
"'Retrieving new service instance'",
")",
"token",
"=",
"None",
... | Internal method to authenticate with a vCenter server or ESX/ESXi host
and return the service instance object. | [
"Internal",
"method",
"to",
"authenticate",
"with",
"a",
"vCenter",
"server",
"or",
"ESX",
"/",
"ESXi",
"host",
"and",
"return",
"the",
"service",
"instance",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L182-L278 | train |
saltstack/salt | salt/utils/vmware.py | get_customizationspec_ref | def get_customizationspec_ref(si, customization_spec_name):
'''
Get a reference to a VMware customization spec for the purposes of customizing a clone
si
ServiceInstance for the vSphere or ESXi server (see get_service_instance)
customization_spec_name
Name of the customization spec
... | python | def get_customizationspec_ref(si, customization_spec_name):
'''
Get a reference to a VMware customization spec for the purposes of customizing a clone
si
ServiceInstance for the vSphere or ESXi server (see get_service_instance)
customization_spec_name
Name of the customization spec
... | [
"def",
"get_customizationspec_ref",
"(",
"si",
",",
"customization_spec_name",
")",
":",
"customization_spec_name",
"=",
"si",
".",
"content",
".",
"customizationSpecManager",
".",
"GetCustomizationSpec",
"(",
"name",
"=",
"customization_spec_name",
")",
"return",
"cust... | Get a reference to a VMware customization spec for the purposes of customizing a clone
si
ServiceInstance for the vSphere or ESXi server (see get_service_instance)
customization_spec_name
Name of the customization spec | [
"Get",
"a",
"reference",
"to",
"a",
"VMware",
"customization",
"spec",
"for",
"the",
"purposes",
"of",
"customizing",
"a",
"clone"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L281-L293 | train |
saltstack/salt | salt/utils/vmware.py | get_service_instance | def get_service_instance(host, username=None, password=None, protocol=None,
port=None, mechanism='userpass', principal=None,
domain=None):
'''
Authenticate with a vCenter server or ESX/ESXi host and return the service instance object.
host
The locat... | python | def get_service_instance(host, username=None, password=None, protocol=None,
port=None, mechanism='userpass', principal=None,
domain=None):
'''
Authenticate with a vCenter server or ESX/ESXi host and return the service instance object.
host
The locat... | [
"def",
"get_service_instance",
"(",
"host",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"port",
"=",
"None",
",",
"mechanism",
"=",
"'userpass'",
",",
"principal",
"=",
"None",
",",
"domain",
"=",
"None"... | Authenticate with a vCenter server or ESX/ESXi host and return the service instance object.
host
The location of the vCenter server or ESX/ESXi host.
username
The username used to login to the vCenter server or ESX/ESXi host.
Required if mechanism is ``userpass``
password
... | [
"Authenticate",
"with",
"a",
"vCenter",
"server",
"or",
"ESX",
"/",
"ESXi",
"host",
"and",
"return",
"the",
"service",
"instance",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L318-L411 | train |
saltstack/salt | salt/utils/vmware.py | get_new_service_instance_stub | def get_new_service_instance_stub(service_instance, path, ns=None,
version=None):
'''
Returns a stub that points to a different path,
created from an existing connection.
service_instance
The Service Instance.
path
Path of the new stub.
ns
... | python | def get_new_service_instance_stub(service_instance, path, ns=None,
version=None):
'''
Returns a stub that points to a different path,
created from an existing connection.
service_instance
The Service Instance.
path
Path of the new stub.
ns
... | [
"def",
"get_new_service_instance_stub",
"(",
"service_instance",
",",
"path",
",",
"ns",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"# For python 2.7.9 and later, the default SSL context has more strict",
"# connection handshaking rule. We may need turn off the hostname ch... | Returns a stub that points to a different path,
created from an existing connection.
service_instance
The Service Instance.
path
Path of the new stub.
ns
Namespace of the new stub.
Default value is None
version
Version of the new stub.
Default valu... | [
"Returns",
"a",
"stub",
"that",
"points",
"to",
"a",
"different",
"path",
"created",
"from",
"an",
"existing",
"connection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L414-L454 | train |
saltstack/salt | salt/utils/vmware.py | get_service_instance_from_managed_object | def get_service_instance_from_managed_object(mo_ref, name='<unnamed>'):
'''
Retrieves the service instance from a managed object.
me_ref
Reference to a managed object (of type vim.ManagedEntity).
name
Name of managed object. This field is optional.
'''
if not name:
name... | python | def get_service_instance_from_managed_object(mo_ref, name='<unnamed>'):
'''
Retrieves the service instance from a managed object.
me_ref
Reference to a managed object (of type vim.ManagedEntity).
name
Name of managed object. This field is optional.
'''
if not name:
name... | [
"def",
"get_service_instance_from_managed_object",
"(",
"mo_ref",
",",
"name",
"=",
"'<unnamed>'",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"mo_ref",
".",
"name",
"log",
".",
"trace",
"(",
"'[%s] Retrieving service instance from managed object'",
",",
"name"... | Retrieves the service instance from a managed object.
me_ref
Reference to a managed object (of type vim.ManagedEntity).
name
Name of managed object. This field is optional. | [
"Retrieves",
"the",
"service",
"instance",
"from",
"a",
"managed",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L457-L472 | train |
saltstack/salt | salt/utils/vmware.py | disconnect | def disconnect(service_instance):
'''
Function that disconnects from the vCenter server or ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
log.trace('Disconnecting')
try:
Disconnect(service_instance)
except vim.fault.NoPerm... | python | def disconnect(service_instance):
'''
Function that disconnects from the vCenter server or ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
log.trace('Disconnecting')
try:
Disconnect(service_instance)
except vim.fault.NoPerm... | [
"def",
"disconnect",
"(",
"service_instance",
")",
":",
"log",
".",
"trace",
"(",
"'Disconnecting'",
")",
"try",
":",
"Disconnect",
"(",
"service_instance",
")",
"except",
"vim",
".",
"fault",
".",
"NoPermission",
"as",
"exc",
":",
"log",
".",
"exception",
... | Function that disconnects from the vCenter server or ESXi host
service_instance
The Service Instance from which to obtain managed object references. | [
"Function",
"that",
"disconnects",
"from",
"the",
"vCenter",
"server",
"or",
"ESXi",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L475-L495 | train |
saltstack/salt | salt/utils/vmware.py | is_connection_to_a_vcenter | def is_connection_to_a_vcenter(service_instance):
'''
Function that returns True if the connection is made to a vCenter Server and
False if the connection is made to an ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
try:
api_t... | python | def is_connection_to_a_vcenter(service_instance):
'''
Function that returns True if the connection is made to a vCenter Server and
False if the connection is made to an ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
try:
api_t... | [
"def",
"is_connection_to_a_vcenter",
"(",
"service_instance",
")",
":",
"try",
":",
"api_type",
"=",
"service_instance",
".",
"content",
".",
"about",
".",
"apiType",
"except",
"vim",
".",
"fault",
".",
"NoPermission",
"as",
"exc",
":",
"log",
".",
"exception"... | Function that returns True if the connection is made to a vCenter Server and
False if the connection is made to an ESXi host
service_instance
The Service Instance from which to obtain managed object references. | [
"Function",
"that",
"returns",
"True",
"if",
"the",
"connection",
"is",
"made",
"to",
"a",
"vCenter",
"Server",
"and",
"False",
"if",
"the",
"connection",
"is",
"made",
"to",
"an",
"ESXi",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L498-L527 | train |
saltstack/salt | salt/utils/vmware.py | get_service_info | def get_service_info(service_instance):
'''
Returns information of the vCenter or ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
try:
return service_instance.content.about
except vim.fault.NoPermission as exc:
log.exce... | python | def get_service_info(service_instance):
'''
Returns information of the vCenter or ESXi host
service_instance
The Service Instance from which to obtain managed object references.
'''
try:
return service_instance.content.about
except vim.fault.NoPermission as exc:
log.exce... | [
"def",
"get_service_info",
"(",
"service_instance",
")",
":",
"try",
":",
"return",
"service_instance",
".",
"content",
".",
"about",
"except",
"vim",
".",
"fault",
".",
"NoPermission",
"as",
"exc",
":",
"log",
".",
"exception",
"(",
"exc",
")",
"raise",
"... | Returns information of the vCenter or ESXi host
service_instance
The Service Instance from which to obtain managed object references. | [
"Returns",
"information",
"of",
"the",
"vCenter",
"or",
"ESXi",
"host"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L530-L549 | train |
saltstack/salt | salt/utils/vmware.py | _get_dvs | def _get_dvs(service_instance, dvs_name):
'''
Return a reference to a Distributed Virtual Switch object.
:param service_instance: PyVmomi service instance
:param dvs_name: Name of DVS to return
:return: A PyVmomi DVS object
'''
switches = list_dvs(service_instance)
if dvs_name in switch... | python | def _get_dvs(service_instance, dvs_name):
'''
Return a reference to a Distributed Virtual Switch object.
:param service_instance: PyVmomi service instance
:param dvs_name: Name of DVS to return
:return: A PyVmomi DVS object
'''
switches = list_dvs(service_instance)
if dvs_name in switch... | [
"def",
"_get_dvs",
"(",
"service_instance",
",",
"dvs_name",
")",
":",
"switches",
"=",
"list_dvs",
"(",
"service_instance",
")",
"if",
"dvs_name",
"in",
"switches",
":",
"inventory",
"=",
"get_inventory",
"(",
"service_instance",
")",
"container",
"=",
"invento... | Return a reference to a Distributed Virtual Switch object.
:param service_instance: PyVmomi service instance
:param dvs_name: Name of DVS to return
:return: A PyVmomi DVS object | [
"Return",
"a",
"reference",
"to",
"a",
"Distributed",
"Virtual",
"Switch",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L552-L568 | train |
saltstack/salt | salt/utils/vmware.py | _get_dvs_portgroup | def _get_dvs_portgroup(dvs, portgroup_name):
'''
Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object
'''
for portgroup in dvs.portgroup:
if portgroup.name == port... | python | def _get_dvs_portgroup(dvs, portgroup_name):
'''
Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object
'''
for portgroup in dvs.portgroup:
if portgroup.name == port... | [
"def",
"_get_dvs_portgroup",
"(",
"dvs",
",",
"portgroup_name",
")",
":",
"for",
"portgroup",
"in",
"dvs",
".",
"portgroup",
":",
"if",
"portgroup",
".",
"name",
"==",
"portgroup_name",
":",
"return",
"portgroup",
"return",
"None"
] | Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object | [
"Return",
"a",
"portgroup",
"object",
"corresponding",
"to",
"the",
"portgroup",
"name",
"on",
"the",
"dvs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L593-L605 | train |
saltstack/salt | salt/utils/vmware.py | _get_dvs_uplink_portgroup | def _get_dvs_uplink_portgroup(dvs, portgroup_name):
'''
Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object
'''
for portgroup in dvs.portgroup:
if portgroup.name ... | python | def _get_dvs_uplink_portgroup(dvs, portgroup_name):
'''
Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object
'''
for portgroup in dvs.portgroup:
if portgroup.name ... | [
"def",
"_get_dvs_uplink_portgroup",
"(",
"dvs",
",",
"portgroup_name",
")",
":",
"for",
"portgroup",
"in",
"dvs",
".",
"portgroup",
":",
"if",
"portgroup",
".",
"name",
"==",
"portgroup_name",
":",
"return",
"portgroup",
"return",
"None"
] | Return a portgroup object corresponding to the portgroup name on the dvs
:param dvs: DVS object
:param portgroup_name: Name of portgroup to return
:return: Portgroup object | [
"Return",
"a",
"portgroup",
"object",
"corresponding",
"to",
"the",
"portgroup",
"name",
"on",
"the",
"dvs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L608-L620 | train |
saltstack/salt | salt/utils/vmware.py | get_gssapi_token | def get_gssapi_token(principal, host, domain):
'''
Get the gssapi token for Kerberos connection
principal
The service principal
host
Host url where we would like to authenticate
domain
Kerberos user domain
'''
if not HAS_GSSAPI:
raise ImportError('The gssapi li... | python | def get_gssapi_token(principal, host, domain):
'''
Get the gssapi token for Kerberos connection
principal
The service principal
host
Host url where we would like to authenticate
domain
Kerberos user domain
'''
if not HAS_GSSAPI:
raise ImportError('The gssapi li... | [
"def",
"get_gssapi_token",
"(",
"principal",
",",
"host",
",",
"domain",
")",
":",
"if",
"not",
"HAS_GSSAPI",
":",
"raise",
"ImportError",
"(",
"'The gssapi library is not imported.'",
")",
"service",
"=",
"'{0}/{1}@{2}'",
".",
"format",
"(",
"principal",
",",
"... | Get the gssapi token for Kerberos connection
principal
The service principal
host
Host url where we would like to authenticate
domain
Kerberos user domain | [
"Get",
"the",
"gssapi",
"token",
"for",
"Kerberos",
"connection"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L623-L655 | train |
saltstack/salt | salt/utils/vmware.py | get_hardware_grains | def get_hardware_grains(service_instance):
'''
Return hardware info for standard minion grains if the service_instance is a HostAgent type
service_instance
The service instance object to get hardware info for
.. versionadded:: 2016.11.0
'''
hw_grain_data = {}
if get_inventory(servi... | python | def get_hardware_grains(service_instance):
'''
Return hardware info for standard minion grains if the service_instance is a HostAgent type
service_instance
The service instance object to get hardware info for
.. versionadded:: 2016.11.0
'''
hw_grain_data = {}
if get_inventory(servi... | [
"def",
"get_hardware_grains",
"(",
"service_instance",
")",
":",
"hw_grain_data",
"=",
"{",
"}",
"if",
"get_inventory",
"(",
"service_instance",
")",
".",
"about",
".",
"apiType",
"==",
"'HostAgent'",
":",
"view",
"=",
"service_instance",
".",
"content",
".",
... | Return hardware info for standard minion grains if the service_instance is a HostAgent type
service_instance
The service instance object to get hardware info for
.. versionadded:: 2016.11.0 | [
"Return",
"hardware",
"info",
"for",
"standard",
"minion",
"grains",
"if",
"the",
"service_instance",
"is",
"a",
"HostAgent",
"type"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L658-L719 | train |
saltstack/salt | salt/utils/vmware.py | get_root_folder | def get_root_folder(service_instance):
'''
Returns the root folder of a vCenter.
service_instance
The Service Instance Object for which to obtain the root folder.
'''
try:
log.trace('Retrieving root folder')
return service_instance.RetrieveContent().rootFolder
except vim... | python | def get_root_folder(service_instance):
'''
Returns the root folder of a vCenter.
service_instance
The Service Instance Object for which to obtain the root folder.
'''
try:
log.trace('Retrieving root folder')
return service_instance.RetrieveContent().rootFolder
except vim... | [
"def",
"get_root_folder",
"(",
"service_instance",
")",
":",
"try",
":",
"log",
".",
"trace",
"(",
"'Retrieving root folder'",
")",
"return",
"service_instance",
".",
"RetrieveContent",
"(",
")",
".",
"rootFolder",
"except",
"vim",
".",
"fault",
".",
"NoPermissi... | Returns the root folder of a vCenter.
service_instance
The Service Instance Object for which to obtain the root folder. | [
"Returns",
"the",
"root",
"folder",
"of",
"a",
"vCenter",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L732-L752 | train |
saltstack/salt | salt/utils/vmware.py | get_content | def get_content(service_instance, obj_type, property_list=None,
container_ref=None, traversal_spec=None,
local_properties=False):
'''
Returns the content of the specified type of object for a Service Instance.
For more information, please see:
http://pubs.vmware.com/vsph... | python | def get_content(service_instance, obj_type, property_list=None,
container_ref=None, traversal_spec=None,
local_properties=False):
'''
Returns the content of the specified type of object for a Service Instance.
For more information, please see:
http://pubs.vmware.com/vsph... | [
"def",
"get_content",
"(",
"service_instance",
",",
"obj_type",
",",
"property_list",
"=",
"None",
",",
"container_ref",
"=",
"None",
",",
"traversal_spec",
"=",
"None",
",",
"local_properties",
"=",
"False",
")",
":",
"# Start at the rootFolder if container starting ... | Returns the content of the specified type of object for a Service Instance.
For more information, please see:
http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.pg.doc_50%2FPG_Ch5_PropertyCollector.7.6.html
service_instance
The Service Instance from which to obtain content.
... | [
"Returns",
"the",
"content",
"of",
"the",
"specified",
"type",
"of",
"object",
"for",
"a",
"Service",
"Instance",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L755-L874 | train |
saltstack/salt | salt/utils/vmware.py | get_mor_by_property | def get_mor_by_property(service_instance, object_type, property_value, property_name='name', container_ref=None):
'''
Returns the first managed object reference having the specified property value.
service_instance
The Service Instance from which to obtain managed object references.
object_typ... | python | def get_mor_by_property(service_instance, object_type, property_value, property_name='name', container_ref=None):
'''
Returns the first managed object reference having the specified property value.
service_instance
The Service Instance from which to obtain managed object references.
object_typ... | [
"def",
"get_mor_by_property",
"(",
"service_instance",
",",
"object_type",
",",
"property_value",
",",
"property_name",
"=",
"'name'",
",",
"container_ref",
"=",
"None",
")",
":",
"# Get list of all managed object references with specified property",
"object_list",
"=",
"ge... | Returns the first managed object reference having the specified property value.
service_instance
The Service Instance from which to obtain managed object references.
object_type
The type of content for which to obtain managed object references.
property_value
The name of the prope... | [
"Returns",
"the",
"first",
"managed",
"object",
"reference",
"having",
"the",
"specified",
"property",
"value",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L877-L906 | train |
saltstack/salt | salt/utils/vmware.py | get_mors_with_properties | def get_mors_with_properties(service_instance, object_type, property_list=None,
container_ref=None, traversal_spec=None,
local_properties=False):
'''
Returns a list containing properties and managed object references for the managed object.
service_... | python | def get_mors_with_properties(service_instance, object_type, property_list=None,
container_ref=None, traversal_spec=None,
local_properties=False):
'''
Returns a list containing properties and managed object references for the managed object.
service_... | [
"def",
"get_mors_with_properties",
"(",
"service_instance",
",",
"object_type",
",",
"property_list",
"=",
"None",
",",
"container_ref",
"=",
"None",
",",
"traversal_spec",
"=",
"None",
",",
"local_properties",
"=",
"False",
")",
":",
"# Get all the content",
"conte... | Returns a list containing properties and managed object references for the managed object.
service_instance
The Service Instance from which to obtain managed object references.
object_type
The type of content for which to obtain managed object references.
property_list
An optional... | [
"Returns",
"a",
"list",
"containing",
"properties",
"and",
"managed",
"object",
"references",
"for",
"the",
"managed",
"object",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L909-L960 | train |
saltstack/salt | salt/utils/vmware.py | get_properties_of_managed_object | def get_properties_of_managed_object(mo_ref, properties):
'''
Returns specific properties of a managed object, retrieved in an
optimally.
mo_ref
The managed object reference.
properties
List of properties of the managed object to retrieve.
'''
service_instance = get_service... | python | def get_properties_of_managed_object(mo_ref, properties):
'''
Returns specific properties of a managed object, retrieved in an
optimally.
mo_ref
The managed object reference.
properties
List of properties of the managed object to retrieve.
'''
service_instance = get_service... | [
"def",
"get_properties_of_managed_object",
"(",
"mo_ref",
",",
"properties",
")",
":",
"service_instance",
"=",
"get_service_instance_from_managed_object",
"(",
"mo_ref",
")",
"log",
".",
"trace",
"(",
"'Retrieving name of %s'",
",",
"type",
"(",
"mo_ref",
")",
".",
... | Returns specific properties of a managed object, retrieved in an
optimally.
mo_ref
The managed object reference.
properties
List of properties of the managed object to retrieve. | [
"Returns",
"specific",
"properties",
"of",
"a",
"managed",
"object",
"retrieved",
"in",
"an",
"optimally",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L963-L996 | train |
saltstack/salt | salt/utils/vmware.py | get_network_adapter_type | def get_network_adapter_type(adapter_type):
'''
Return the network adapter type.
adpater_type
The adapter type from which to obtain the network adapter type.
'''
if adapter_type == 'vmxnet':
return vim.vm.device.VirtualVmxnet()
elif adapter_type == 'vmxnet2':
return vim.... | python | def get_network_adapter_type(adapter_type):
'''
Return the network adapter type.
adpater_type
The adapter type from which to obtain the network adapter type.
'''
if adapter_type == 'vmxnet':
return vim.vm.device.VirtualVmxnet()
elif adapter_type == 'vmxnet2':
return vim.... | [
"def",
"get_network_adapter_type",
"(",
"adapter_type",
")",
":",
"if",
"adapter_type",
"==",
"'vmxnet'",
":",
"return",
"vim",
".",
"vm",
".",
"device",
".",
"VirtualVmxnet",
"(",
")",
"elif",
"adapter_type",
"==",
"'vmxnet2'",
":",
"return",
"vim",
".",
"v... | Return the network adapter type.
adpater_type
The adapter type from which to obtain the network adapter type. | [
"Return",
"the",
"network",
"adapter",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L1011-L1029 | train |
saltstack/salt | salt/utils/vmware.py | get_network_adapter_object_type | def get_network_adapter_object_type(adapter_object):
'''
Returns the network adapter type.
adapter_object
The adapter object from which to obtain the network adapter type.
'''
if isinstance(adapter_object, vim.vm.device.VirtualVmxnet2):
return 'vmxnet2'
if isinstance(adapter_obj... | python | def get_network_adapter_object_type(adapter_object):
'''
Returns the network adapter type.
adapter_object
The adapter object from which to obtain the network adapter type.
'''
if isinstance(adapter_object, vim.vm.device.VirtualVmxnet2):
return 'vmxnet2'
if isinstance(adapter_obj... | [
"def",
"get_network_adapter_object_type",
"(",
"adapter_object",
")",
":",
"if",
"isinstance",
"(",
"adapter_object",
",",
"vim",
".",
"vm",
".",
"device",
".",
"VirtualVmxnet2",
")",
":",
"return",
"'vmxnet2'",
"if",
"isinstance",
"(",
"adapter_object",
",",
"v... | Returns the network adapter type.
adapter_object
The adapter object from which to obtain the network adapter type. | [
"Returns",
"the",
"network",
"adapter",
"type",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L1032-L1050 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.