repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
saltstack/salt
salt/modules/boto_efs.py
_get_conn
def _get_conn(key=None, keyid=None, profile=None, region=None, **kwargs): ''' Create a boto3 client connection to EFS ''' client = None if profile: if isinstance(profile, six.string_types): if profile in __pillar__: ...
python
def _get_conn(key=None, keyid=None, profile=None, region=None, **kwargs): ''' Create a boto3 client connection to EFS ''' client = None if profile: if isinstance(profile, six.string_types): if profile in __pillar__: ...
[ "def", "_get_conn", "(", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "None", "if", "profile", ":", "if", "isinstance", "(", "profile", ","...
Create a boto3 client connection to EFS
[ "Create", "a", "boto3", "client", "connection", "to", "EFS" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L82-L121
train
saltstack/salt
salt/modules/boto_efs.py
create_file_system
def create_file_system(name, performance_mode='generalPurpose', keyid=None, key=None, profile=None, region=None, creation_token=None, **kwargs): ''' Cr...
python
def create_file_system(name, performance_mode='generalPurpose', keyid=None, key=None, profile=None, region=None, creation_token=None, **kwargs): ''' Cr...
[ "def", "create_file_system", "(", "name", ",", "performance_mode", "=", "'generalPurpose'", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "creation_token", "=", "None", ",", "*", "*", "k...
Creates a new, empty file system. name (string) - The name for the new file system performance_mode (string) - The PerformanceMode of the file system. Can be either generalPurpose or maxIO creation_token (string) - A unique name to be used as reference when creating an EFS...
[ "Creates", "a", "new", "empty", "file", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L124-L172
train
saltstack/salt
salt/modules/boto_efs.py
create_mount_target
def create_mount_target(filesystemid, subnetid, ipaddress=None, securitygroups=None, keyid=None, key=None, profile=None, region=None, ...
python
def create_mount_target(filesystemid, subnetid, ipaddress=None, securitygroups=None, keyid=None, key=None, profile=None, region=None, ...
[ "def", "create_mount_target", "(", "filesystemid", ",", "subnetid", ",", "ipaddress", "=", "None", ",", "securitygroups", "=", "None", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", ...
Creates a mount target for a file system. You can then mount the file system on EC2 instances via the mount target. You can create one mount target in each Availability Zone in your VPC. All EC2 instances in a VPC within a given Availability Zone share a single mount target for a given file system. ...
[ "Creates", "a", "mount", "target", "for", "a", "file", "system", ".", "You", "can", "then", "mount", "the", "file", "system", "on", "EC2", "instances", "via", "the", "mount", "target", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L175-L240
train
saltstack/salt
salt/modules/boto_efs.py
create_tags
def create_tags(filesystemid, tags, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Creates or overwrites tags associated with a file system. Each tag is a key-value pair. If a tag key specified i...
python
def create_tags(filesystemid, tags, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Creates or overwrites tags associated with a file system. Each tag is a key-value pair. If a tag key specified i...
[ "def", "create_tags", "(", "filesystemid", ",", "tags", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_conn", "(", "key", "=", "ke...
Creates or overwrites tags associated with a file system. Each tag is a key-value pair. If a tag key specified in the request already exists on the file system, this operation overwrites its value with the value provided in the request. filesystemid (string) - ID of the file system for whose ta...
[ "Creates", "or", "overwrites", "tags", "associated", "with", "a", "file", "system", ".", "Each", "tag", "is", "a", "key", "-", "value", "pair", ".", "If", "a", "tag", "key", "specified", "in", "the", "request", "already", "exists", "on", "the", "file", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L243-L275
train
saltstack/salt
salt/modules/boto_efs.py
delete_file_system
def delete_file_system(filesystemid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes a file system, permanently severing access to its contents. Upon return, the file sy...
python
def delete_file_system(filesystemid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes a file system, permanently severing access to its contents. Upon return, the file sy...
[ "def", "delete_file_system", "(", "filesystemid", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_conn", "(", "key", "=", "key", ",",...
Deletes a file system, permanently severing access to its contents. Upon return, the file system no longer exists and you can't access any contents of the deleted file system. You can't delete a file system that is in use. That is, if the file system has any mount targets, you must first delete them. ...
[ "Deletes", "a", "file", "system", "permanently", "severing", "access", "to", "its", "contents", ".", "Upon", "return", "the", "file", "system", "no", "longer", "exists", "and", "you", "can", "t", "access", "any", "contents", "of", "the", "deleted", "file", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L278-L303
train
saltstack/salt
salt/modules/boto_efs.py
delete_mount_target
def delete_mount_target(mounttargetid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes the specified mount target. This operation forcibly breaks any mounts of the file...
python
def delete_mount_target(mounttargetid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes the specified mount target. This operation forcibly breaks any mounts of the file...
[ "def", "delete_mount_target", "(", "mounttargetid", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_conn", "(", "key", "=", "key", ",...
Deletes the specified mount target. This operation forcibly breaks any mounts of the file system via the mount target that is being deleted, which might disrupt instances or applications using those mounts. To avoid applications getting cut off abruptly, you might consider unmounting any mounts of the ...
[ "Deletes", "the", "specified", "mount", "target", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L306-L337
train
saltstack/salt
salt/modules/boto_efs.py
delete_tags
def delete_tags(filesystemid, tags, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes the specified tags from a file system. filesystemid (string) - ID of the file system for whose ...
python
def delete_tags(filesystemid, tags, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Deletes the specified tags from a file system. filesystemid (string) - ID of the file system for whose ...
[ "def", "delete_tags", "(", "filesystemid", ",", "tags", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_conn", "(", "key", "=", "ke...
Deletes the specified tags from a file system. filesystemid (string) - ID of the file system for whose tags will be removed. tags (list[string]) - The tag keys to delete to the file system CLI Example: .. code-block:: bash salt 'my-minion' boto_efs.delete_tags
[ "Deletes", "the", "specified", "tags", "from", "a", "file", "system", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L340-L365
train
saltstack/salt
salt/modules/boto_efs.py
get_file_systems
def get_file_systems(filesystemid=None, keyid=None, key=None, profile=None, region=None, creation_token=None, **kwargs): ''' Get all EFS properties or a specific instance property if...
python
def get_file_systems(filesystemid=None, keyid=None, key=None, profile=None, region=None, creation_token=None, **kwargs): ''' Get all EFS properties or a specific instance property if...
[ "def", "get_file_systems", "(", "filesystemid", "=", "None", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "creation_token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", ...
Get all EFS properties or a specific instance property if filesystemid is specified filesystemid (string) - ID of the file system to retrieve properties creation_token (string) - A unique token that identifies an EFS. If fileysystem created via create_file_system this would ...
[ "Get", "all", "EFS", "properties", "or", "a", "specific", "instance", "property", "if", "filesystemid", "is", "specified" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L368-L421
train
saltstack/salt
salt/modules/boto_efs.py
get_mount_targets
def get_mount_targets(filesystemid=None, mounttargetid=None, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Get all the EFS mount point properties for a specific f...
python
def get_mount_targets(filesystemid=None, mounttargetid=None, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Get all the EFS mount point properties for a specific f...
[ "def", "get_mount_targets", "(", "filesystemid", "=", "None", ",", "mounttargetid", "=", "None", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", ...
Get all the EFS mount point properties for a specific filesystemid or the properties for a specific mounttargetid. One or the other must be specified filesystemid (string) - ID of the file system whose mount targets to list Must be specified if mounttargetid is not mounttarg...
[ "Get", "all", "the", "EFS", "mount", "point", "properties", "for", "a", "specific", "filesystemid", "or", "the", "properties", "for", "a", "specific", "mounttargetid", ".", "One", "or", "the", "other", "must", "be", "specified" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L424-L468
train
saltstack/salt
salt/modules/boto_efs.py
get_tags
def get_tags(filesystemid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Return the tags associated with an EFS instance. filesystemid (string) - ID of the file system whose tags to list returns (list) -...
python
def get_tags(filesystemid, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Return the tags associated with an EFS instance. filesystemid (string) - ID of the file system whose tags to list returns (list) -...
[ "def", "get_tags", "(", "filesystemid", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_conn", "(", "key", "=", "key", ",", "keyid"...
Return the tags associated with an EFS instance. filesystemid (string) - ID of the file system whose tags to list returns (list) - list of tags as key/value pairs CLI Example: .. code-block:: bash salt 'my-minion' boto_efs.get_tags efs-id
[ "Return", "the", "tags", "associated", "with", "an", "EFS", "instance", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L471-L501
train
saltstack/salt
salt/modules/boto_efs.py
set_security_groups
def set_security_groups(mounttargetid, securitygroup, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Modifies the set of security groups in effect for ...
python
def set_security_groups(mounttargetid, securitygroup, keyid=None, key=None, profile=None, region=None, **kwargs): ''' Modifies the set of security groups in effect for ...
[ "def", "set_security_groups", "(", "mounttargetid", ",", "securitygroup", ",", "keyid", "=", "None", ",", "key", "=", "None", ",", "profile", "=", "None", ",", "region", "=", "None", ",", "*", "*", "kwargs", ")", ":", "client", "=", "_get_conn", "(", "...
Modifies the set of security groups in effect for a mount target mounttargetid (string) - ID of the mount target whose security groups will be modified securitygroups (list[string]) - list of no more than 5 VPC security group IDs. CLI Example: .. code-block:: bash salt 'my-m...
[ "Modifies", "the", "set", "of", "security", "groups", "in", "effect", "for", "a", "mount", "target" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_efs.py#L504-L529
train
saltstack/salt
salt/states/win_wusa.py
installed
def installed(name, source): ''' Ensure an update is installed on the minion Args: name(str): Name of the Windows KB ("KB123456") source (str): Source of .msu file corresponding to the KB Example: .. code-block:: yaml KB123456: wusa.ins...
python
def installed(name, source): ''' Ensure an update is installed on the minion Args: name(str): Name of the Windows KB ("KB123456") source (str): Source of .msu file corresponding to the KB Example: .. code-block:: yaml KB123456: wusa.ins...
[ "def", "installed", "(", "name", ",", "source", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "# Input validation", "if", "not", "name", ":", "raise...
Ensure an update is installed on the minion Args: name(str): Name of the Windows KB ("KB123456") source (str): Source of .msu file corresponding to the KB Example: .. code-block:: yaml KB123456: wusa.installed: - source: salt://kb12...
[ "Ensure", "an", "update", "is", "installed", "on", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_wusa.py#L37-L100
train
saltstack/salt
salt/states/win_wusa.py
uninstalled
def uninstalled(name): ''' Ensure an update is uninstalled from the minion Args: name(str): Name of the Windows KB ("KB123456") Example: .. code-block:: yaml KB123456: wusa.uninstalled ''' ret = {'name': name, 'changes': {}, 'r...
python
def uninstalled(name): ''' Ensure an update is uninstalled from the minion Args: name(str): Name of the Windows KB ("KB123456") Example: .. code-block:: yaml KB123456: wusa.uninstalled ''' ret = {'name': name, 'changes': {}, 'r...
[ "def", "uninstalled", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "False", ",", "'comment'", ":", "''", "}", "# Is the KB already uninstalled", "if", "not", "__salt__", "[", "'wusa...
Ensure an update is uninstalled from the minion Args: name(str): Name of the Windows KB ("KB123456") Example: .. code-block:: yaml KB123456: wusa.uninstalled
[ "Ensure", "an", "update", "is", "uninstalled", "from", "the", "minion" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_wusa.py#L103-L148
train
saltstack/salt
salt/utils/smtp.py
send
def send(kwargs, opts): ''' Send an email with the data ''' opt_keys = ( 'smtp.to', 'smtp.from', 'smtp.host', 'smtp.port', 'smtp.tls', 'smtp.username', 'smtp.password', 'smtp.subject', 'smtp.gpgowner', 'smtp.content', ) ...
python
def send(kwargs, opts): ''' Send an email with the data ''' opt_keys = ( 'smtp.to', 'smtp.from', 'smtp.host', 'smtp.port', 'smtp.tls', 'smtp.username', 'smtp.password', 'smtp.subject', 'smtp.gpgowner', 'smtp.content', ) ...
[ "def", "send", "(", "kwargs", ",", "opts", ")", ":", "opt_keys", "=", "(", "'smtp.to'", ",", "'smtp.from'", ",", "'smtp.host'", ",", "'smtp.port'", ",", "'smtp.tls'", ",", "'smtp.username'", ",", "'smtp.password'", ",", "'smtp.subject'", ",", "'smtp.gpgowner'", ...
Send an email with the data
[ "Send", "an", "email", "with", "the", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/smtp.py#L50-L127
train
saltstack/salt
salt/modules/netaddress.py
list_cidr_ips
def list_cidr_ips(cidr): ''' Get a list of IP addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return [six.text_type(ip) for ip in list(ips)]
python
def list_cidr_ips(cidr): ''' Get a list of IP addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return [six.text_type(ip) for ip in list(ips)]
[ "def", "list_cidr_ips", "(", "cidr", ")", ":", "ips", "=", "netaddr", ".", "IPNetwork", "(", "cidr", ")", "return", "[", "six", ".", "text_type", "(", "ip", ")", "for", "ip", "in", "list", "(", "ips", ")", "]" ]
Get a list of IP addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips 192.168.0.0/20
[ "Get", "a", "list", "of", "IP", "addresses", "from", "a", "CIDR", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netaddress.py#L35-L44
train
saltstack/salt
salt/modules/netaddress.py
list_cidr_ips_ipv6
def list_cidr_ips_ipv6(cidr): ''' Get a list of IPv6 addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips_ipv6 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return [six.text_type(ip.ipv6()) for ip in list(ips)]
python
def list_cidr_ips_ipv6(cidr): ''' Get a list of IPv6 addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips_ipv6 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return [six.text_type(ip.ipv6()) for ip in list(ips)]
[ "def", "list_cidr_ips_ipv6", "(", "cidr", ")", ":", "ips", "=", "netaddr", ".", "IPNetwork", "(", "cidr", ")", "return", "[", "six", ".", "text_type", "(", "ip", ".", "ipv6", "(", ")", ")", "for", "ip", "in", "list", "(", "ips", ")", "]" ]
Get a list of IPv6 addresses from a CIDR. CLI example:: salt myminion netaddress.list_cidr_ips_ipv6 192.168.0.0/20
[ "Get", "a", "list", "of", "IPv6", "addresses", "from", "a", "CIDR", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netaddress.py#L47-L56
train
saltstack/salt
salt/modules/netaddress.py
cidr_netmask
def cidr_netmask(cidr): ''' Get the netmask address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return six.text_type(ips.netmask)
python
def cidr_netmask(cidr): ''' Get the netmask address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return six.text_type(ips.netmask)
[ "def", "cidr_netmask", "(", "cidr", ")", ":", "ips", "=", "netaddr", ".", "IPNetwork", "(", "cidr", ")", "return", "six", ".", "text_type", "(", "ips", ".", "netmask", ")" ]
Get the netmask address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20
[ "Get", "the", "netmask", "address", "associated", "with", "a", "CIDR", "address", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netaddress.py#L59-L68
train
saltstack/salt
salt/modules/netaddress.py
cidr_broadcast
def cidr_broadcast(cidr): ''' Get the broadcast address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return six.text_type(ips.broadcast)
python
def cidr_broadcast(cidr): ''' Get the broadcast address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20 ''' ips = netaddr.IPNetwork(cidr) return six.text_type(ips.broadcast)
[ "def", "cidr_broadcast", "(", "cidr", ")", ":", "ips", "=", "netaddr", ".", "IPNetwork", "(", "cidr", ")", "return", "six", ".", "text_type", "(", "ips", ".", "broadcast", ")" ]
Get the broadcast address associated with a CIDR address. CLI example:: salt myminion netaddress.cidr_netmask 192.168.0.0/20
[ "Get", "the", "broadcast", "address", "associated", "with", "a", "CIDR", "address", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netaddress.py#L71-L80
train
saltstack/salt
salt/modules/openstack_mng.py
restart_service
def restart_service(service_name, minimum_running_time=None): ''' Restart OpenStack service immediately, or only if it's running longer than specified value CLI Example: .. code-block:: bash salt '*' openstack_mng.restart_service neutron salt '*' openstack_mng.restart_service neut...
python
def restart_service(service_name, minimum_running_time=None): ''' Restart OpenStack service immediately, or only if it's running longer than specified value CLI Example: .. code-block:: bash salt '*' openstack_mng.restart_service neutron salt '*' openstack_mng.restart_service neut...
[ "def", "restart_service", "(", "service_name", ",", "minimum_running_time", "=", "None", ")", ":", "if", "minimum_running_time", ":", "ret_code", "=", "False", "# get system services list for interesting openstack service", "services", "=", "__salt__", "[", "'cmd.run'", "...
Restart OpenStack service immediately, or only if it's running longer than specified value CLI Example: .. code-block:: bash salt '*' openstack_mng.restart_service neutron salt '*' openstack_mng.restart_service neutron minimum_running_time=600
[ "Restart", "OpenStack", "service", "immediately", "or", "only", "if", "it", "s", "running", "longer", "than", "specified", "value" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/openstack_mng.py#L65-L104
train
saltstack/salt
salt/returners/mysql.py
_get_options
def _get_options(ret=None): ''' Returns options used for the MySQL connection. ''' defaults = {'host': 'salt', 'user': 'salt', 'pass': 'salt', 'db': 'salt', 'port': 3306, 'ssl_ca': None, 'ssl_cert': None, ...
python
def _get_options(ret=None): ''' Returns options used for the MySQL connection. ''' defaults = {'host': 'salt', 'user': 'salt', 'pass': 'salt', 'db': 'salt', 'port': 3306, 'ssl_ca': None, 'ssl_cert': None, ...
[ "def", "_get_options", "(", "ret", "=", "None", ")", ":", "defaults", "=", "{", "'host'", ":", "'salt'", ",", "'user'", ":", "'salt'", ",", "'pass'", ":", "'salt'", ",", "'db'", ":", "'salt'", ",", "'port'", ":", "3306", ",", "'ssl_ca'", ":", "None",...
Returns options used for the MySQL connection.
[ "Returns", "options", "used", "for", "the", "MySQL", "connection", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L190-L227
train
saltstack/salt
salt/returners/mysql.py
_get_serv
def _get_serv(ret=None, commit=False): ''' Return a mysql cursor ''' _options = _get_options(ret) connect = True if __context__ and 'mysql_returner_conn' in __context__: try: log.debug('Trying to reuse MySQL connection pool') conn = __context__['mysql_returner_co...
python
def _get_serv(ret=None, commit=False): ''' Return a mysql cursor ''' _options = _get_options(ret) connect = True if __context__ and 'mysql_returner_conn' in __context__: try: log.debug('Trying to reuse MySQL connection pool') conn = __context__['mysql_returner_co...
[ "def", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "False", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "connect", "=", "True", "if", "__context__", "and", "'mysql_returner_conn'", "in", "__context__", ":", "try", ":", "log", ...
Return a mysql cursor
[ "Return", "a", "mysql", "cursor" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L231-L286
train
saltstack/salt
salt/returners/mysql.py
returner
def returner(ret): ''' Return data to a mysql server ''' # if a minion is returning a standalone job, get a jobid if ret['jid'] == 'req': ret['jid'] = prep_jid(nocache=ret.get('nocache', False)) save_load(ret['jid'], ret) try: with _get_serv(ret, commit=True) as cur: ...
python
def returner(ret): ''' Return data to a mysql server ''' # if a minion is returning a standalone job, get a jobid if ret['jid'] == 'req': ret['jid'] = prep_jid(nocache=ret.get('nocache', False)) save_load(ret['jid'], ret) try: with _get_serv(ret, commit=True) as cur: ...
[ "def", "returner", "(", "ret", ")", ":", "# if a minion is returning a standalone job, get a jobid", "if", "ret", "[", "'jid'", "]", "==", "'req'", ":", "ret", "[", "'jid'", "]", "=", "prep_jid", "(", "nocache", "=", "ret", ".", "get", "(", "'nocache'", ",",...
Return data to a mysql server
[ "Return", "data", "to", "a", "mysql", "server" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L289-L311
train
saltstack/salt
salt/returners/mysql.py
event_return
def event_return(events): ''' Return event to mysql server Requires that configuration be enabled via 'event_return' option in master config. ''' with _get_serv(events, commit=True) as cur: for event in events: tag = event.get('tag', '') data = event.get('data', ...
python
def event_return(events): ''' Return event to mysql server Requires that configuration be enabled via 'event_return' option in master config. ''' with _get_serv(events, commit=True) as cur: for event in events: tag = event.get('tag', '') data = event.get('data', ...
[ "def", "event_return", "(", "events", ")", ":", "with", "_get_serv", "(", "events", ",", "commit", "=", "True", ")", "as", "cur", ":", "for", "event", "in", "events", ":", "tag", "=", "event", ".", "get", "(", "'tag'", ",", "''", ")", "data", "=", ...
Return event to mysql server Requires that configuration be enabled via 'event_return' option in master config.
[ "Return", "event", "to", "mysql", "server" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L314-L327
train
saltstack/salt
salt/returners/mysql.py
save_load
def save_load(jid, load, minions=None): ''' Save the load to the specified jid id ''' with _get_serv(commit=True) as cur: sql = '''INSERT INTO `jids` (`jid`, `load`) VALUES (%s, %s)''' try: cur.execute(sql, (jid, salt.utils.json.dumps(load))) except MySQLdb.Integrit...
python
def save_load(jid, load, minions=None): ''' Save the load to the specified jid id ''' with _get_serv(commit=True) as cur: sql = '''INSERT INTO `jids` (`jid`, `load`) VALUES (%s, %s)''' try: cur.execute(sql, (jid, salt.utils.json.dumps(load))) except MySQLdb.Integrit...
[ "def", "save_load", "(", "jid", ",", "load", ",", "minions", "=", "None", ")", ":", "with", "_get_serv", "(", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''INSERT INTO `jids` (`jid`, `load`) VALUES (%s, %s)'''", "try", ":", "cur", ".", "execu...
Save the load to the specified jid id
[ "Save", "the", "load", "to", "the", "specified", "jid", "id" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L330-L344
train
saltstack/salt
salt/returners/mysql.py
get_load
def get_load(jid): ''' Return the load data that marks a specified jid ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT `load` FROM `jids` WHERE `jid` = %s;''' cur.execute(sql, (jid,)) data = cur.fetchone() if data: return salt.utils.json.loa...
python
def get_load(jid): ''' Return the load data that marks a specified jid ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT `load` FROM `jids` WHERE `jid` = %s;''' cur.execute(sql, (jid,)) data = cur.fetchone() if data: return salt.utils.json.loa...
[ "def", "get_load", "(", "jid", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT `load` FROM `jids` WHERE `jid` = %s;'''", "cur", ".", "execute", "(", "sql", ",", "(", "jid", ...
Return the load data that marks a specified jid
[ "Return", "the", "load", "data", "that", "marks", "a", "specified", "jid" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L354-L365
train
saltstack/salt
salt/returners/mysql.py
get_jid
def get_jid(jid): ''' Return the information returned when the specified job id was executed ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT id, full_ret FROM `salt_returns` WHERE `jid` = %s''' cur.execute(sql, (jid,)) data = cur.fetchall() ...
python
def get_jid(jid): ''' Return the information returned when the specified job id was executed ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT id, full_ret FROM `salt_returns` WHERE `jid` = %s''' cur.execute(sql, (jid,)) data = cur.fetchall() ...
[ "def", "get_jid", "(", "jid", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT id, full_ret FROM `salt_returns`\n WHERE `jid` = %s'''", "cur", ".", "execute", "(", "s...
Return the information returned when the specified job id was executed
[ "Return", "the", "information", "returned", "when", "the", "specified", "job", "id", "was", "executed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L368-L383
train
saltstack/salt
salt/returners/mysql.py
get_fun
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT s.id,s.jid, s.full_ret FROM `salt_returns` s JOIN ( SELECT MAX(`jid`) as jid from `salt_returns` ...
python
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT s.id,s.jid, s.full_ret FROM `salt_returns` s JOIN ( SELECT MAX(`jid`) as jid from `salt_returns` ...
[ "def", "get_fun", "(", "fun", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT s.id,s.jid, s.full_ret\n FROM `salt_returns` s\n JOIN ( SELECT MAX(`jid`) as jid\n...
Return a dict of the last function called for all minions
[ "Return", "a", "dict", "of", "the", "last", "function", "called", "for", "all", "minions" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L386-L407
train
saltstack/salt
salt/returners/mysql.py
get_jids_filter
def get_jids_filter(count, filter_find_job=True): ''' Return a list of all job ids :param int count: show not more than the count of most recent jobs :param bool filter_find_jobs: filter out 'saltutil.find_job' jobs ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT * FRO...
python
def get_jids_filter(count, filter_find_job=True): ''' Return a list of all job ids :param int count: show not more than the count of most recent jobs :param bool filter_find_jobs: filter out 'saltutil.find_job' jobs ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT * FRO...
[ "def", "get_jids_filter", "(", "count", ",", "filter_find_job", "=", "True", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT * FROM (\n SELECT DISTINCT `jid` ,`lo...
Return a list of all job ids :param int count: show not more than the count of most recent jobs :param bool filter_find_jobs: filter out 'saltutil.find_job' jobs
[ "Return", "a", "list", "of", "all", "job", "ids", ":", "param", "int", "count", ":", "show", "not", "more", "than", "the", "count", "of", "most", "recent", "jobs", ":", "param", "bool", "filter_find_jobs", ":", "filter", "out", "saltutil", ".", "find_job...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L429-L452
train
saltstack/salt
salt/returners/mysql.py
get_minions
def get_minions(): ''' Return a list of minions ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT DISTINCT id FROM `salt_returns`''' cur.execute(sql) data = cur.fetchall() ret = [] for minion in data: ret.append(minion...
python
def get_minions(): ''' Return a list of minions ''' with _get_serv(ret=None, commit=True) as cur: sql = '''SELECT DISTINCT id FROM `salt_returns`''' cur.execute(sql) data = cur.fetchall() ret = [] for minion in data: ret.append(minion...
[ "def", "get_minions", "(", ")", ":", "with", "_get_serv", "(", "ret", "=", "None", ",", "commit", "=", "True", ")", "as", "cur", ":", "sql", "=", "'''SELECT DISTINCT id\n FROM `salt_returns`'''", "cur", ".", "execute", "(", "sql", ")", "data", ...
Return a list of minions
[ "Return", "a", "list", "of", "minions" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L455-L469
train
saltstack/salt
salt/returners/mysql.py
_purge_jobs
def _purge_jobs(timestamp): ''' Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return: ''' with _get_serv() as cur: try: sql = 'delete from `jids` where jid in (select distinct jid from salt_returns where alter_time < %s)' ...
python
def _purge_jobs(timestamp): ''' Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return: ''' with _get_serv() as cur: try: sql = 'delete from `jids` where jid in (select distinct jid from salt_returns where alter_time < %s)' ...
[ "def", "_purge_jobs", "(", "timestamp", ")", ":", "with", "_get_serv", "(", ")", "as", "cur", ":", "try", ":", "sql", "=", "'delete from `jids` where jid in (select distinct jid from salt_returns where alter_time < %s)'", "cur", ".", "execute", "(", "sql", ",", "(", ...
Purge records from the returner tables. :param job_age_in_seconds: Purge jobs older than this :return:
[ "Purge", "records", "from", "the", "returner", "tables", ".", ":", "param", "job_age_in_seconds", ":", "Purge", "jobs", "older", "than", "this", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L479-L513
train
saltstack/salt
salt/returners/mysql.py
_archive_jobs
def _archive_jobs(timestamp): ''' Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return: ''' source_tables = ['jids', 'salt_returns', 'salt_events'] with _get_serv() as cur: ta...
python
def _archive_jobs(timestamp): ''' Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return: ''' source_tables = ['jids', 'salt_returns', 'salt_events'] with _get_serv() as cur: ta...
[ "def", "_archive_jobs", "(", "timestamp", ")", ":", "source_tables", "=", "[", "'jids'", ",", "'salt_returns'", ",", "'salt_events'", "]", "with", "_get_serv", "(", ")", "as", "cur", ":", "target_tables", "=", "{", "}", "for", "table_name", "in", "source_tab...
Copy rows to a set of backup tables, then purge rows. :param timestamp: Archive rows older than this timestamp :return:
[ "Copy", "rows", "to", "a", "set", "of", "backup", "tables", "then", "purge", "rows", ".", ":", "param", "timestamp", ":", "Archive", "rows", "older", "than", "this", "timestamp", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L516-L570
train
saltstack/salt
salt/returners/mysql.py
clean_old_jobs
def clean_old_jobs(): ''' Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return: ''' if __opts__.get('keep_jobs', False) and int(__opts__.get('keep_jobs', 0)) > 0: try: with _get_serv() as cur: ...
python
def clean_old_jobs(): ''' Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return: ''' if __opts__.get('keep_jobs', False) and int(__opts__.get('keep_jobs', 0)) > 0: try: with _get_serv() as cur: ...
[ "def", "clean_old_jobs", "(", ")", ":", "if", "__opts__", ".", "get", "(", "'keep_jobs'", ",", "False", ")", "and", "int", "(", "__opts__", ".", "get", "(", "'keep_jobs'", ",", "0", ")", ")", ">", "0", ":", "try", ":", "with", "_get_serv", "(", ")"...
Called in the master's event loop every loop_interval. Archives and/or deletes the events and job details from the database. :return:
[ "Called", "in", "the", "master", "s", "event", "loop", "every", "loop_interval", ".", "Archives", "and", "/", "or", "deletes", "the", "events", "and", "job", "details", "from", "the", "database", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/mysql.py#L573-L594
train
saltstack/salt
salt/returners/syslog_return.py
_verify_options
def _verify_options(options): ''' Verify options and log warnings Returns True if all options can be verified, otherwise False ''' # sanity check all vals used for bitwise operations later bitwise_args = [('level', options['level']), ('facility', options['facility']) ...
python
def _verify_options(options): ''' Verify options and log warnings Returns True if all options can be verified, otherwise False ''' # sanity check all vals used for bitwise operations later bitwise_args = [('level', options['level']), ('facility', options['facility']) ...
[ "def", "_verify_options", "(", "options", ")", ":", "# sanity check all vals used for bitwise operations later", "bitwise_args", "=", "[", "(", "'level'", ",", "options", "[", "'level'", "]", ")", ",", "(", "'facility'", ",", "options", "[", "'facility'", "]", ")"...
Verify options and log warnings Returns True if all options can be verified, otherwise False
[ "Verify", "options", "and", "log", "warnings" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/syslog_return.py#L135-L166
train
saltstack/salt
salt/returners/syslog_return.py
returner
def returner(ret): ''' Return data to the local syslog ''' _options = _get_options(ret) if not _verify_options(_options): return # Get values from syslog module level = getattr(syslog, _options['level']) facility = getattr(syslog, _options['facility']) # parse for syslog ...
python
def returner(ret): ''' Return data to the local syslog ''' _options = _get_options(ret) if not _verify_options(_options): return # Get values from syslog module level = getattr(syslog, _options['level']) facility = getattr(syslog, _options['facility']) # parse for syslog ...
[ "def", "returner", "(", "ret", ")", ":", "_options", "=", "_get_options", "(", "ret", ")", "if", "not", "_verify_options", "(", "_options", ")", ":", "return", "# Get values from syslog module", "level", "=", "getattr", "(", "syslog", ",", "_options", "[", "...
Return data to the local syslog
[ "Return", "data", "to", "the", "local", "syslog" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/syslog_return.py#L175-L204
train
saltstack/salt
salt/utils/parsers.py
OptionParser.error
def error(self, msg): ''' error(msg : string) Print a usage message incorporating 'msg' to stderr and exit. This keeps option parsing exit status uniform for all parsing errors. ''' self.print_usage(sys.stderr) self.exit(salt.defaults.exitcodes.EX_USAGE, '{0}: er...
python
def error(self, msg): ''' error(msg : string) Print a usage message incorporating 'msg' to stderr and exit. This keeps option parsing exit status uniform for all parsing errors. ''' self.print_usage(sys.stderr) self.exit(salt.defaults.exitcodes.EX_USAGE, '{0}: er...
[ "def", "error", "(", "self", ",", "msg", ")", ":", "self", ".", "print_usage", "(", "sys", ".", "stderr", ")", "self", ".", "exit", "(", "salt", ".", "defaults", ".", "exitcodes", ".", "EX_USAGE", ",", "'{0}: error: {1}\\n'", ".", "format", "(", "self"...
error(msg : string) Print a usage message incorporating 'msg' to stderr and exit. This keeps option parsing exit status uniform for all parsing errors.
[ "error", "(", "msg", ":", "string", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/parsers.py#L279-L287
train
saltstack/salt
salt/utils/parsers.py
DaemonMixIn.check_running
def check_running(self): ''' Check if a pid file exists and if it is associated with a running process. ''' if self.check_pidfile(): pid = self.get_pidfile() if not salt.utils.platform.is_windows(): if self.check_pidfile() and self.is_daem...
python
def check_running(self): ''' Check if a pid file exists and if it is associated with a running process. ''' if self.check_pidfile(): pid = self.get_pidfile() if not salt.utils.platform.is_windows(): if self.check_pidfile() and self.is_daem...
[ "def", "check_running", "(", "self", ")", ":", "if", "self", ".", "check_pidfile", "(", ")", ":", "pid", "=", "self", ".", "get_pidfile", "(", ")", "if", "not", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", ":", "if", "self", ...
Check if a pid file exists and if it is associated with a running process.
[ "Check", "if", "a", "pid", "file", "exists", "and", "if", "it", "is", "associated", "with", "a", "running", "process", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/parsers.py#L1045-L1060
train
saltstack/salt
salt/utils/parsers.py
SaltSupportOptionParser.find_existing_configs
def find_existing_configs(self, default): ''' Find configuration files on the system. :return: ''' configs = [] for cfg in [default, self._config_filename_, 'minion', 'proxy', 'cloud', 'spm']: if not cfg: continue config_path = self...
python
def find_existing_configs(self, default): ''' Find configuration files on the system. :return: ''' configs = [] for cfg in [default, self._config_filename_, 'minion', 'proxy', 'cloud', 'spm']: if not cfg: continue config_path = self...
[ "def", "find_existing_configs", "(", "self", ",", "default", ")", ":", "configs", "=", "[", "]", "for", "cfg", "in", "[", "default", ",", "self", ".", "_config_filename_", ",", "'minion'", ",", "'proxy'", ",", "'cloud'", ",", "'spm'", "]", ":", "if", "...
Find configuration files on the system. :return:
[ "Find", "configuration", "files", "on", "the", "system", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/parsers.py#L1950-L1966
train
saltstack/salt
salt/utils/parsers.py
SaltSupportOptionParser.setup_config
def setup_config(self, cfg=None): ''' Open suitable config file. :return: ''' _opts, _args = optparse.OptionParser.parse_args(self) configs = self.find_existing_configs(_opts.support_unit) if configs and cfg not in configs: cfg = configs[0] re...
python
def setup_config(self, cfg=None): ''' Open suitable config file. :return: ''' _opts, _args = optparse.OptionParser.parse_args(self) configs = self.find_existing_configs(_opts.support_unit) if configs and cfg not in configs: cfg = configs[0] re...
[ "def", "setup_config", "(", "self", ",", "cfg", "=", "None", ")", ":", "_opts", ",", "_args", "=", "optparse", ".", "OptionParser", ".", "parse_args", "(", "self", ")", "configs", "=", "self", ".", "find_existing_configs", "(", "_opts", ".", "support_unit"...
Open suitable config file. :return:
[ "Open", "suitable", "config", "file", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/parsers.py#L1968-L1978
train
saltstack/salt
salt/states/ethtool.py
coalesce
def coalesce(name, **kwargs): ''' Manage coalescing settings of network device name Interface name to apply coalescing settings .. code-block:: yaml eth0: ethtool.coalesce: - name: eth0 - adaptive_rx: on - adaptive_tx: on - rx_...
python
def coalesce(name, **kwargs): ''' Manage coalescing settings of network device name Interface name to apply coalescing settings .. code-block:: yaml eth0: ethtool.coalesce: - name: eth0 - adaptive_rx: on - adaptive_tx: on - rx_...
[ "def", "coalesce", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "'Network device {0} coalescing settings are up to date.'", ".", ...
Manage coalescing settings of network device name Interface name to apply coalescing settings .. code-block:: yaml eth0: ethtool.coalesce: - name: eth0 - adaptive_rx: on - adaptive_tx: on - rx_usecs: 24 - rx_frame: 0 ...
[ "Manage", "coalescing", "settings", "of", "network", "device" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ethtool.py#L51-L144
train
saltstack/salt
salt/states/esxdatacenter.py
datacenter_configured
def datacenter_configured(name): ''' Makes sure a datacenter exists. If the state is run by an ``esxdatacenter`` minion, the name of the datacenter is retrieved from the proxy details, otherwise the datacenter has the same name as the state. Supported proxies: esxdatacenter name: ...
python
def datacenter_configured(name): ''' Makes sure a datacenter exists. If the state is run by an ``esxdatacenter`` minion, the name of the datacenter is retrieved from the proxy details, otherwise the datacenter has the same name as the state. Supported proxies: esxdatacenter name: ...
[ "def", "datacenter_configured", "(", "name", ")", ":", "proxy_type", "=", "__salt__", "[", "'vsphere.get_proxy_type'", "]", "(", ")", "if", "proxy_type", "==", "'esxdatacenter'", ":", "dc_name", "=", "__salt__", "[", "'esxdatacenter.get_details'", "]", "(", ")", ...
Makes sure a datacenter exists. If the state is run by an ``esxdatacenter`` minion, the name of the datacenter is retrieved from the proxy details, otherwise the datacenter has the same name as the state. Supported proxies: esxdatacenter name: Datacenter name. Ignored if the proxytype is ...
[ "Makes", "sure", "a", "datacenter", "exists", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxdatacenter.py#L72-L126
train
saltstack/salt
salt/modules/napalm_formula.py
_container_path
def _container_path(model, key=None, container=None, delim=DEFAULT_TARGET_DELIM): ''' Generate all the possible paths within an OpenConfig-like object. This function returns a generator. ''' if not key: key = '' if not container...
python
def _container_path(model, key=None, container=None, delim=DEFAULT_TARGET_DELIM): ''' Generate all the possible paths within an OpenConfig-like object. This function returns a generator. ''' if not key: key = '' if not container...
[ "def", "_container_path", "(", "model", ",", "key", "=", "None", ",", "container", "=", "None", ",", "delim", "=", "DEFAULT_TARGET_DELIM", ")", ":", "if", "not", "key", ":", "key", "=", "''", "if", "not", "container", ":", "container", "=", "'config'", ...
Generate all the possible paths within an OpenConfig-like object. This function returns a generator.
[ "Generate", "all", "the", "possible", "paths", "within", "an", "OpenConfig", "-", "like", "object", ".", "This", "function", "returns", "a", "generator", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_formula.py#L42-L68
train
saltstack/salt
salt/modules/napalm_formula.py
setval
def setval(key, val, dict_=None, delim=DEFAULT_TARGET_DELIM): ''' Set a value under the dictionary hierarchy identified under the key. The target 'foo/bar/baz' returns the dictionary hierarchy {'foo': {'bar': {'baz': {}}}}. .. note:: Currently this doesn't work with integers, i.e. ...
python
def setval(key, val, dict_=None, delim=DEFAULT_TARGET_DELIM): ''' Set a value under the dictionary hierarchy identified under the key. The target 'foo/bar/baz' returns the dictionary hierarchy {'foo': {'bar': {'baz': {}}}}. .. note:: Currently this doesn't work with integers, i.e. ...
[ "def", "setval", "(", "key", ",", "val", ",", "dict_", "=", "None", ",", "delim", "=", "DEFAULT_TARGET_DELIM", ")", ":", "if", "not", "dict_", ":", "dict_", "=", "{", "}", "prev_hier", "=", "dict_", "dict_hier", "=", "key", ".", "split", "(", "delim"...
Set a value under the dictionary hierarchy identified under the key. The target 'foo/bar/baz' returns the dictionary hierarchy {'foo': {'bar': {'baz': {}}}}. .. note:: Currently this doesn't work with integers, i.e. cannot build lists dynamically. CLI Example: .. code-block:: bas...
[ "Set", "a", "value", "under", "the", "dictionary", "hierarchy", "identified", "under", "the", "key", ".", "The", "target", "foo", "/", "bar", "/", "baz", "returns", "the", "dictionary", "hierarchy", "{", "foo", ":", "{", "bar", ":", "{", "baz", ":", "{...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_formula.py#L107-L133
train
saltstack/salt
salt/modules/napalm_formula.py
traverse
def traverse(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): ''' Traverse a dict or list using a colon-delimited (or otherwise delimited, using the ``delimiter`` param) target string. The target ``foo:bar:0`` will return ``data['foo']['bar'][0]`` if this value exists, and will otherwise re...
python
def traverse(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): ''' Traverse a dict or list using a colon-delimited (or otherwise delimited, using the ``delimiter`` param) target string. The target ``foo:bar:0`` will return ``data['foo']['bar'][0]`` if this value exists, and will otherwise re...
[ "def", "traverse", "(", "data", ",", "key", ",", "default", "=", "None", ",", "delimiter", "=", "DEFAULT_TARGET_DELIM", ")", ":", "return", "_traverse_dict_and_list", "(", "data", ",", "key", ",", "default", "=", "default", ",", "delimiter", "=", "delimiter"...
Traverse a dict or list using a colon-delimited (or otherwise delimited, using the ``delimiter`` param) target string. The target ``foo:bar:0`` will return ``data['foo']['bar'][0]`` if this value exists, and will otherwise return the dict in the default argument. Function will automatically determine th...
[ "Traverse", "a", "dict", "or", "list", "using", "a", "colon", "-", "delimited", "(", "or", "otherwise", "delimited", "using", "the", "delimiter", "param", ")", "target", "string", ".", "The", "target", "foo", ":", "bar", ":", "0", "will", "return", "data...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_formula.py#L136-L153
train
saltstack/salt
salt/modules/napalm_formula.py
dictupdate
def dictupdate(dest, upd, recursive_update=True, merge_lists=False): ''' Recursive version of the default dict.update Merges upd recursively into dest If recursive_update=False, will use the classic dict.update, or fall back on a manual merge (helpful for non-dict types like ``FunctionWrapper``). ...
python
def dictupdate(dest, upd, recursive_update=True, merge_lists=False): ''' Recursive version of the default dict.update Merges upd recursively into dest If recursive_update=False, will use the classic dict.update, or fall back on a manual merge (helpful for non-dict types like ``FunctionWrapper``). ...
[ "def", "dictupdate", "(", "dest", ",", "upd", ",", "recursive_update", "=", "True", ",", "merge_lists", "=", "False", ")", ":", "return", "salt", ".", "utils", ".", "dictupdate", ".", "update", "(", "dest", ",", "upd", ",", "recursive_update", "=", "recu...
Recursive version of the default dict.update Merges upd recursively into dest If recursive_update=False, will use the classic dict.update, or fall back on a manual merge (helpful for non-dict types like ``FunctionWrapper``). If ``merge_lists=True``, will aggregate list object types instead of replace...
[ "Recursive", "version", "of", "the", "default", "dict", ".", "update" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_formula.py#L156-L170
train
saltstack/salt
salt/modules/napalm_formula.py
defaults
def defaults(model, defaults_, delim='//', flipped_merge=False): ''' Apply the defaults to a Python dictionary having the structure as described in the OpenConfig standards. model The OpenConfig model to apply the defaults to. defaults The dic...
python
def defaults(model, defaults_, delim='//', flipped_merge=False): ''' Apply the defaults to a Python dictionary having the structure as described in the OpenConfig standards. model The OpenConfig model to apply the defaults to. defaults The dic...
[ "def", "defaults", "(", "model", ",", "defaults_", ",", "delim", "=", "'//'", ",", "flipped_merge", "=", "False", ")", ":", "merged", "=", "{", "}", "log", ".", "debug", "(", "'Applying the defaults:'", ")", "log", ".", "debug", "(", "defaults_", ")", ...
Apply the defaults to a Python dictionary having the structure as described in the OpenConfig standards. model The OpenConfig model to apply the defaults to. defaults The dictionary of defaults. This argument must equally be structured with respect to the OpenConfig standards. ...
[ "Apply", "the", "defaults", "to", "a", "Python", "dictionary", "having", "the", "structure", "as", "described", "in", "the", "OpenConfig", "standards", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_formula.py#L173-L234
train
saltstack/salt
salt/modules/napalm_formula.py
render_field
def render_field(dictionary, field, prepend=None, append=None, quotes=False, **opts): ''' Render a field found under the ``field`` level of the hierarchy in the ``dictionary`` object. This is useful to render a field in...
python
def render_field(dictionary, field, prepend=None, append=None, quotes=False, **opts): ''' Render a field found under the ``field`` level of the hierarchy in the ``dictionary`` object. This is useful to render a field in...
[ "def", "render_field", "(", "dictionary", ",", "field", ",", "prepend", "=", "None", ",", "append", "=", "None", ",", "quotes", "=", "False", ",", "*", "*", "opts", ")", ":", "value", "=", "traverse", "(", "dictionary", ",", "field", ")", "if", "valu...
Render a field found under the ``field`` level of the hierarchy in the ``dictionary`` object. This is useful to render a field in a Jinja template without worrying that the hierarchy might not exist. For example if we do the following in Jinja: ``{{ interfaces.interface.Ethernet5.config.description }}``...
[ "Render", "a", "field", "found", "under", "the", "field", "level", "of", "the", "hierarchy", "in", "the", "dictionary", "object", ".", "This", "is", "useful", "to", "render", "a", "field", "in", "a", "Jinja", "template", "without", "worrying", "that", "the...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_formula.py#L237-L314
train
saltstack/salt
salt/modules/napalm_formula.py
render_fields
def render_fields(dictionary, *fields, **opts): ''' This function works similarly to :mod:`render_field <salt.modules.napalm_formula.render_field>` but for a list of fields from the same dictionary, rendering, indenting and distributing them on separate lines. ...
python
def render_fields(dictionary, *fields, **opts): ''' This function works similarly to :mod:`render_field <salt.modules.napalm_formula.render_field>` but for a list of fields from the same dictionary, rendering, indenting and distributing them on separate lines. ...
[ "def", "render_fields", "(", "dictionary", ",", "*", "fields", ",", "*", "*", "opts", ")", ":", "results", "=", "[", "]", "for", "field", "in", "fields", ":", "res", "=", "render_field", "(", "dictionary", ",", "field", ",", "*", "*", "opts", ")", ...
This function works similarly to :mod:`render_field <salt.modules.napalm_formula.render_field>` but for a list of fields from the same dictionary, rendering, indenting and distributing them on separate lines. dictionary The dictionary to traverse. fields A list of field names or pa...
[ "This", "function", "works", "similarly", "to", ":", "mod", ":", "render_field", "<salt", ".", "modules", ".", "napalm_formula", ".", "render_field", ">", "but", "for", "a", "list", "of", "fields", "from", "the", "same", "dictionary", "rendering", "indenting",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_formula.py#L317-L367
train
saltstack/salt
salt/states/win_servermanager.py
installed
def installed(name, features=None, recurse=False, restart=False, source=None, exclude=None): ''' Install the windows feature. To install a single feature, use the ``name`` parameter. To install multiple features, use the ``features`` para...
python
def installed(name, features=None, recurse=False, restart=False, source=None, exclude=None): ''' Install the windows feature. To install a single feature, use the ``name`` parameter. To install multiple features, use the ``features`` para...
[ "def", "installed", "(", "name", ",", "features", "=", "None", ",", "recurse", "=", "False", ",", "restart", "=", "False", ",", "source", "=", "None", ",", "exclude", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", "...
Install the windows feature. To install a single feature, use the ``name`` parameter. To install multiple features, use the ``features`` parameter. .. note:: Some features require reboot after un/installation. If so, until the server is restarted other features can not be installed! Args: ...
[ "Install", "the", "windows", "feature", ".", "To", "install", "a", "single", "feature", "use", "the", "name", "parameter", ".", "To", "install", "multiple", "features", "use", "the", "features", "parameter", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_servermanager.py#L25-L189
train
saltstack/salt
salt/states/win_servermanager.py
removed
def removed(name, features=None, remove_payload=False, restart=False): ''' Remove the windows feature To remove a single feature, use the ``name`` parameter. To remove multiple features, use the ``features`` parameter. Args: name (str): Short name of the feature (the right column in...
python
def removed(name, features=None, remove_payload=False, restart=False): ''' Remove the windows feature To remove a single feature, use the ``name`` parameter. To remove multiple features, use the ``features`` parameter. Args: name (str): Short name of the feature (the right column in...
[ "def", "removed", "(", "name", ",", "features", "=", "None", ",", "remove_payload", "=", "False", ",", "restart", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'...
Remove the windows feature To remove a single feature, use the ``name`` parameter. To remove multiple features, use the ``features`` parameter. Args: name (str): Short name of the feature (the right column in win_servermanager.list_available). This can be a single feature or a ...
[ "Remove", "the", "windows", "feature", "To", "remove", "a", "single", "feature", "use", "the", "name", "parameter", ".", "To", "remove", "multiple", "features", "use", "the", "features", "parameter", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_servermanager.py#L192-L320
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
_check_cors_origin
def _check_cors_origin(origin, allowed_origins): ''' Check if an origin match cors allowed origins ''' if isinstance(allowed_origins, list): if origin in allowed_origins: return origin elif allowed_origins == '*': return allowed_origins elif allowed_origins == origin:...
python
def _check_cors_origin(origin, allowed_origins): ''' Check if an origin match cors allowed origins ''' if isinstance(allowed_origins, list): if origin in allowed_origins: return origin elif allowed_origins == '*': return allowed_origins elif allowed_origins == origin:...
[ "def", "_check_cors_origin", "(", "origin", ",", "allowed_origins", ")", ":", "if", "isinstance", "(", "allowed_origins", ",", "list", ")", ":", "if", "origin", "in", "allowed_origins", ":", "return", "origin", "elif", "allowed_origins", "==", "'*'", ":", "ret...
Check if an origin match cors allowed origins
[ "Check", "if", "an", "origin", "match", "cors", "allowed", "origins" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1750-L1761
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
EventListener.clean_by_request
def clean_by_request(self, request): ''' Remove all futures that were waiting for request `request` since it is done waiting ''' if request not in self.request_map: return for tag, matcher, future in self.request_map[request]: # timeout the future ...
python
def clean_by_request(self, request): ''' Remove all futures that were waiting for request `request` since it is done waiting ''' if request not in self.request_map: return for tag, matcher, future in self.request_map[request]: # timeout the future ...
[ "def", "clean_by_request", "(", "self", ",", "request", ")", ":", "if", "request", "not", "in", "self", ".", "request_map", ":", "return", "for", "tag", ",", "matcher", ",", "future", "in", "self", ".", "request_map", "[", "request", "]", ":", "# timeout...
Remove all futures that were waiting for request `request` since it is done waiting
[ "Remove", "all", "futures", "that", "were", "waiting", "for", "request", "request", "since", "it", "is", "done", "waiting" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L302-L316
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
EventListener.get_event
def get_event(self, request, tag='', matcher=prefix_matcher.__func__, callback=None, timeout=None ): ''' Get an event (asynchronous of course) return a future that will get it later ''' ...
python
def get_event(self, request, tag='', matcher=prefix_matcher.__func__, callback=None, timeout=None ): ''' Get an event (asynchronous of course) return a future that will get it later ''' ...
[ "def", "get_event", "(", "self", ",", "request", ",", "tag", "=", "''", ",", "matcher", "=", "prefix_matcher", ".", "__func__", ",", "callback", "=", "None", ",", "timeout", "=", "None", ")", ":", "# if the request finished, no reason to allow event fetching, sinc...
Get an event (asynchronous of course) return a future that will get it later
[ "Get", "an", "event", "(", "asynchronous", "of", "course", ")", "return", "a", "future", "that", "will", "get", "it", "later" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L330-L360
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
EventListener._timeout_future
def _timeout_future(self, tag, matcher, future): ''' Timeout a specific future ''' if (tag, matcher) not in self.tag_map: return if not future.done(): future.set_exception(TimeoutException()) self.tag_map[(tag, matcher)].remove(future) ...
python
def _timeout_future(self, tag, matcher, future): ''' Timeout a specific future ''' if (tag, matcher) not in self.tag_map: return if not future.done(): future.set_exception(TimeoutException()) self.tag_map[(tag, matcher)].remove(future) ...
[ "def", "_timeout_future", "(", "self", ",", "tag", ",", "matcher", ",", "future", ")", ":", "if", "(", "tag", ",", "matcher", ")", "not", "in", "self", ".", "tag_map", ":", "return", "if", "not", "future", ".", "done", "(", ")", ":", "future", ".",...
Timeout a specific future
[ "Timeout", "a", "specific", "future" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L362-L372
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
EventListener._handle_event_socket_recv
def _handle_event_socket_recv(self, raw): ''' Callback for events on the event sub socket ''' mtag, data = self.event.unpack(raw, self.event.serial) # see if we have any futures that need this info: for (tag, matcher), futures in six.iteritems(self.tag_map): ...
python
def _handle_event_socket_recv(self, raw): ''' Callback for events on the event sub socket ''' mtag, data = self.event.unpack(raw, self.event.serial) # see if we have any futures that need this info: for (tag, matcher), futures in six.iteritems(self.tag_map): ...
[ "def", "_handle_event_socket_recv", "(", "self", ",", "raw", ")", ":", "mtag", ",", "data", "=", "self", ".", "event", ".", "unpack", "(", "raw", ",", "self", ".", "event", ".", "serial", ")", "# see if we have any futures that need this info:", "for", "(", ...
Callback for events on the event sub socket
[ "Callback", "for", "events", "on", "the", "event", "sub", "socket" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L374-L398
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler._verify_client
def _verify_client(self, low): ''' Verify that the client is in fact one we have ''' if 'client' not in low or low.get('client') not in self.saltclients: self.set_status(400) self.write("400 Invalid Client: Client not found in salt clients") self.finis...
python
def _verify_client(self, low): ''' Verify that the client is in fact one we have ''' if 'client' not in low or low.get('client') not in self.saltclients: self.set_status(400) self.write("400 Invalid Client: Client not found in salt clients") self.finis...
[ "def", "_verify_client", "(", "self", ",", "low", ")", ":", "if", "'client'", "not", "in", "low", "or", "low", ".", "get", "(", "'client'", ")", "not", "in", "self", ".", "saltclients", ":", "self", ".", "set_status", "(", "400", ")", "self", ".", ...
Verify that the client is in fact one we have
[ "Verify", "that", "the", "client", "is", "in", "fact", "one", "we", "have" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L407-L416
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler.initialize
def initialize(self): ''' Initialize the handler before requests are called ''' if not hasattr(self.application, 'event_listener'): log.debug('init a listener') self.application.event_listener = EventListener( self.application.mod_opts, ...
python
def initialize(self): ''' Initialize the handler before requests are called ''' if not hasattr(self.application, 'event_listener'): log.debug('init a listener') self.application.event_listener = EventListener( self.application.mod_opts, ...
[ "def", "initialize", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ".", "application", ",", "'event_listener'", ")", ":", "log", ".", "debug", "(", "'init a listener'", ")", "self", ".", "application", ".", "event_listener", "=", "EventListener...
Initialize the handler before requests are called
[ "Initialize", "the", "handler", "before", "requests", "are", "called" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L418-L440
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler.token
def token(self): ''' The token used for the request ''' # find the token (cookie or headers) if AUTH_TOKEN_HEADER in self.request.headers: return self.request.headers[AUTH_TOKEN_HEADER] else: return self.get_cookie(AUTH_COOKIE_NAME)
python
def token(self): ''' The token used for the request ''' # find the token (cookie or headers) if AUTH_TOKEN_HEADER in self.request.headers: return self.request.headers[AUTH_TOKEN_HEADER] else: return self.get_cookie(AUTH_COOKIE_NAME)
[ "def", "token", "(", "self", ")", ":", "# find the token (cookie or headers)", "if", "AUTH_TOKEN_HEADER", "in", "self", ".", "request", ".", "headers", ":", "return", "self", ".", "request", ".", "headers", "[", "AUTH_TOKEN_HEADER", "]", "else", ":", "return", ...
The token used for the request
[ "The", "token", "used", "for", "the", "request" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L443-L451
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler._verify_auth
def _verify_auth(self): ''' Boolean whether the request is auth'd ''' return self.token and bool(self.application.auth.get_tok(self.token))
python
def _verify_auth(self): ''' Boolean whether the request is auth'd ''' return self.token and bool(self.application.auth.get_tok(self.token))
[ "def", "_verify_auth", "(", "self", ")", ":", "return", "self", ".", "token", "and", "bool", "(", "self", ".", "application", ".", "auth", ".", "get_tok", "(", "self", ".", "token", ")", ")" ]
Boolean whether the request is auth'd
[ "Boolean", "whether", "the", "request", "is", "auth", "d" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L453-L458
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler.prepare
def prepare(self): ''' Run before get/posts etc. Pre-flight checks: - verify that we can speak back to them (compatible accept header) ''' # Find an acceptable content-type accept_header = self.request.headers.get('Accept', '*/*') # Ignore any parameter, inclu...
python
def prepare(self): ''' Run before get/posts etc. Pre-flight checks: - verify that we can speak back to them (compatible accept header) ''' # Find an acceptable content-type accept_header = self.request.headers.get('Accept', '*/*') # Ignore any parameter, inclu...
[ "def", "prepare", "(", "self", ")", ":", "# Find an acceptable content-type", "accept_header", "=", "self", ".", "request", ".", "headers", ".", "get", "(", "'Accept'", ",", "'*/*'", ")", "# Ignore any parameter, including q (quality) one", "parsed_accept_header", "=", ...
Run before get/posts etc. Pre-flight checks: - verify that we can speak back to them (compatible accept header)
[ "Run", "before", "get", "/", "posts", "etc", ".", "Pre", "-", "flight", "checks", ":", "-", "verify", "that", "we", "can", "speak", "back", "to", "them", "(", "compatible", "accept", "header", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L460-L490
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler.serialize
def serialize(self, data): ''' Serlialize the output based on the Accept header ''' self.set_header('Content-Type', self.content_type) return self.dumper(data)
python
def serialize(self, data): ''' Serlialize the output based on the Accept header ''' self.set_header('Content-Type', self.content_type) return self.dumper(data)
[ "def", "serialize", "(", "self", ",", "data", ")", ":", "self", ".", "set_header", "(", "'Content-Type'", ",", "self", ".", "content_type", ")", "return", "self", ".", "dumper", "(", "data", ")" ]
Serlialize the output based on the Accept header
[ "Serlialize", "the", "output", "based", "on", "the", "Accept", "header" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L514-L520
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler._form_loader
def _form_loader(self, _): ''' function to get the data from the urlencoded forms ignore the data passed in and just get the args from wherever they are ''' data = {} for key in self.request.arguments: val = self.get_arguments(key) if len(val) == 1...
python
def _form_loader(self, _): ''' function to get the data from the urlencoded forms ignore the data passed in and just get the args from wherever they are ''' data = {} for key in self.request.arguments: val = self.get_arguments(key) if len(val) == 1...
[ "def", "_form_loader", "(", "self", ",", "_", ")", ":", "data", "=", "{", "}", "for", "key", "in", "self", ".", "request", ".", "arguments", ":", "val", "=", "self", ".", "get_arguments", "(", "key", ")", "if", "len", "(", "val", ")", "==", "1", ...
function to get the data from the urlencoded forms ignore the data passed in and just get the args from wherever they are
[ "function", "to", "get", "the", "data", "from", "the", "urlencoded", "forms", "ignore", "the", "data", "passed", "in", "and", "just", "get", "the", "args", "from", "wherever", "they", "are" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L522-L534
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler.deserialize
def deserialize(self, data): ''' Deserialize the data based on request content type headers ''' ct_in_map = { 'application/x-www-form-urlencoded': self._form_loader, 'application/json': salt.utils.json.loads, 'application/x-yaml': salt.utils.yaml.safe_...
python
def deserialize(self, data): ''' Deserialize the data based on request content type headers ''' ct_in_map = { 'application/x-www-form-urlencoded': self._form_loader, 'application/json': salt.utils.json.loads, 'application/x-yaml': salt.utils.yaml.safe_...
[ "def", "deserialize", "(", "self", ",", "data", ")", ":", "ct_in_map", "=", "{", "'application/x-www-form-urlencoded'", ":", "self", ".", "_form_loader", ",", "'application/json'", ":", "salt", ".", "utils", ".", "json", ".", "loads", ",", "'application/x-yaml'"...
Deserialize the data based on request content type headers
[ "Deserialize", "the", "data", "based", "on", "request", "content", "type", "headers" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L536-L556
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler._get_lowstate
def _get_lowstate(self): ''' Format the incoming data into a lowstate object ''' if not self.request.body: return data = self.deserialize(self.request.body) self.request_payload = copy(data) if data and 'arg' in data and not isinstance(data['arg'], li...
python
def _get_lowstate(self): ''' Format the incoming data into a lowstate object ''' if not self.request.body: return data = self.deserialize(self.request.body) self.request_payload = copy(data) if data and 'arg' in data and not isinstance(data['arg'], li...
[ "def", "_get_lowstate", "(", "self", ")", ":", "if", "not", "self", ".", "request", ".", "body", ":", "return", "data", "=", "self", ".", "deserialize", "(", "self", ".", "request", ".", "body", ")", "self", ".", "request_payload", "=", "copy", "(", ...
Format the incoming data into a lowstate object
[ "Format", "the", "incoming", "data", "into", "a", "lowstate", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L558-L575
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler.set_default_headers
def set_default_headers(self): ''' Set default CORS headers ''' mod_opts = self.application.mod_opts if mod_opts.get('cors_origin'): origin = self.request.headers.get('Origin') allowed_origin = _check_cors_origin(origin, mod_opts['cors_origin']) ...
python
def set_default_headers(self): ''' Set default CORS headers ''' mod_opts = self.application.mod_opts if mod_opts.get('cors_origin'): origin = self.request.headers.get('Origin') allowed_origin = _check_cors_origin(origin, mod_opts['cors_origin']) ...
[ "def", "set_default_headers", "(", "self", ")", ":", "mod_opts", "=", "self", ".", "application", ".", "mod_opts", "if", "mod_opts", ".", "get", "(", "'cors_origin'", ")", ":", "origin", "=", "self", ".", "request", ".", "headers", ".", "get", "(", "'Ori...
Set default CORS headers
[ "Set", "default", "CORS", "headers" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L577-L589
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
BaseSaltAPIHandler.options
def options(self, *args, **kwargs): ''' Return CORS headers for preflight requests ''' # Allow X-Auth-Token in requests request_headers = self.request.headers.get('Access-Control-Request-Headers') allowed_headers = request_headers.split(',') # Filter allowed head...
python
def options(self, *args, **kwargs): ''' Return CORS headers for preflight requests ''' # Allow X-Auth-Token in requests request_headers = self.request.headers.get('Access-Control-Request-Headers') allowed_headers = request_headers.split(',') # Filter allowed head...
[ "def", "options", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Allow X-Auth-Token in requests", "request_headers", "=", "self", ".", "request", ".", "headers", ".", "get", "(", "'Access-Control-Request-Headers'", ")", "allowed_headers", "...
Return CORS headers for preflight requests
[ "Return", "CORS", "headers", "for", "preflight", "requests" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L591-L611
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAuthHandler.get
def get(self): ''' All logins are done over post, this is a parked endpoint .. http:get:: /login :status 401: |401| :status 406: |406| **Example request:** .. code-block:: bash curl -i localhost:8000/login .. code-block:: text ...
python
def get(self): ''' All logins are done over post, this is a parked endpoint .. http:get:: /login :status 401: |401| :status 406: |406| **Example request:** .. code-block:: bash curl -i localhost:8000/login .. code-block:: text ...
[ "def", "get", "(", "self", ")", ":", "self", ".", "set_status", "(", "401", ")", "self", ".", "set_header", "(", "'WWW-Authenticate'", ",", "'Session'", ")", "ret", "=", "{", "'status'", ":", "'401 Unauthorized'", ",", "'return'", ":", "'Please log in'", "...
All logins are done over post, this is a parked endpoint .. http:get:: /login :status 401: |401| :status 406: |406| **Example request:** .. code-block:: bash curl -i localhost:8000/login .. code-block:: text GET /login HTTP/1.1 ...
[ "All", "logins", "are", "done", "over", "post", "this", "is", "a", "parked", "endpoint" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L618-L655
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAuthHandler.post
def post(self): ''' :ref:`Authenticate <rest_tornado-auth>` against Salt's eauth system .. http:post:: /login :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :form eauth: the eauth backend c...
python
def post(self): ''' :ref:`Authenticate <rest_tornado-auth>` against Salt's eauth system .. http:post:: /login :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :form eauth: the eauth backend c...
[ "def", "post", "(", "self", ")", ":", "try", ":", "if", "not", "isinstance", "(", "self", ".", "request_payload", ",", "dict", ")", ":", "self", ".", "send_error", "(", "400", ")", "return", "creds", "=", "{", "'username'", ":", "self", ".", "request...
:ref:`Authenticate <rest_tornado-auth>` against Salt's eauth system .. http:post:: /login :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :form eauth: the eauth backend configured for the user :...
[ ":", "ref", ":", "Authenticate", "<rest_tornado", "-", "auth", ">", "against", "Salt", "s", "eauth", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L658-L788
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAPIHandler.get
def get(self): ''' An endpoint to determine salt-api capabilities .. http:get:: / :reqheader Accept: |req_accept| :status 200: |200| :status 401: |401| :status 406: |406| **Example request:** .. code-block:: bash c...
python
def get(self): ''' An endpoint to determine salt-api capabilities .. http:get:: / :reqheader Accept: |req_accept| :status 200: |200| :status 401: |401| :status 406: |406| **Example request:** .. code-block:: bash c...
[ "def", "get", "(", "self", ")", ":", "ret", "=", "{", "\"clients\"", ":", "list", "(", "self", ".", "saltclients", ".", "keys", "(", ")", ")", ",", "\"return\"", ":", "\"Welcome\"", "}", "self", ".", "write", "(", "self", ".", "serialize", "(", "re...
An endpoint to determine salt-api capabilities .. http:get:: / :reqheader Accept: |req_accept| :status 200: |200| :status 401: |401| :status 406: |406| **Example request:** .. code-block:: bash curl -i localhost:8000 .. c...
[ "An", "endpoint", "to", "determine", "salt", "-", "api", "capabilities" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L795-L831
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAPIHandler.disbatch
def disbatch(self): ''' Disbatch all lowstates to the appropriate clients ''' ret = [] # check clients before going, we want to throw 400 if one is bad for low in self.lowstate: if not self._verify_client(low): return # Make sure ...
python
def disbatch(self): ''' Disbatch all lowstates to the appropriate clients ''' ret = [] # check clients before going, we want to throw 400 if one is bad for low in self.lowstate: if not self._verify_client(low): return # Make sure ...
[ "def", "disbatch", "(", "self", ")", ":", "ret", "=", "[", "]", "# check clients before going, we want to throw 400 if one is bad", "for", "low", "in", "self", ".", "lowstate", ":", "if", "not", "self", ".", "_verify_client", "(", "low", ")", ":", "return", "#...
Disbatch all lowstates to the appropriate clients
[ "Disbatch", "all", "lowstates", "to", "the", "appropriate", "clients" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L912-L946
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAPIHandler._disbatch_local
def _disbatch_local(self, chunk): ''' Dispatch local client commands ''' # Generate jid and find all minions before triggering a job to subscribe all returns from minions full_return = chunk.pop('full_return', False) chunk['jid'] = salt.utils.jid.gen_jid(self.application....
python
def _disbatch_local(self, chunk): ''' Dispatch local client commands ''' # Generate jid and find all minions before triggering a job to subscribe all returns from minions full_return = chunk.pop('full_return', False) chunk['jid'] = salt.utils.jid.gen_jid(self.application....
[ "def", "_disbatch_local", "(", "self", ",", "chunk", ")", ":", "# Generate jid and find all minions before triggering a job to subscribe all returns from minions", "full_return", "=", "chunk", ".", "pop", "(", "'full_return'", ",", "False", ")", "chunk", "[", "'jid'", "]"...
Dispatch local client commands
[ "Dispatch", "local", "client", "commands" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L949-L1070
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAPIHandler.job_not_running
def job_not_running(self, jid, tgt, tgt_type, minions, is_finished): ''' Return a future which will complete once jid (passed in) is no longer running on tgt ''' ping_pub_data = yield self.saltclients['local'](tgt, 'saltutil...
python
def job_not_running(self, jid, tgt, tgt_type, minions, is_finished): ''' Return a future which will complete once jid (passed in) is no longer running on tgt ''' ping_pub_data = yield self.saltclients['local'](tgt, 'saltutil...
[ "def", "job_not_running", "(", "self", ",", "jid", ",", "tgt", ",", "tgt_type", ",", "minions", ",", "is_finished", ")", ":", "ping_pub_data", "=", "yield", "self", ".", "saltclients", "[", "'local'", "]", "(", "tgt", ",", "'saltutil.find_job'", ",", "[", ...
Return a future which will complete once jid (passed in) is no longer running on tgt
[ "Return", "a", "future", "which", "will", "complete", "once", "jid", "(", "passed", "in", ")", "is", "no", "longer", "running", "on", "tgt" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1073-L1111
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAPIHandler._disbatch_local_async
def _disbatch_local_async(self, chunk): ''' Disbatch local client_async commands ''' f_call = self._format_call_run_job_async(chunk) # fire a job off pub_data = yield self.saltclients['local_async'](*f_call.get('args', ()), **f_call.get('kwargs', {})) raise torna...
python
def _disbatch_local_async(self, chunk): ''' Disbatch local client_async commands ''' f_call = self._format_call_run_job_async(chunk) # fire a job off pub_data = yield self.saltclients['local_async'](*f_call.get('args', ()), **f_call.get('kwargs', {})) raise torna...
[ "def", "_disbatch_local_async", "(", "self", ",", "chunk", ")", ":", "f_call", "=", "self", ".", "_format_call_run_job_async", "(", "chunk", ")", "# fire a job off", "pub_data", "=", "yield", "self", ".", "saltclients", "[", "'local_async'", "]", "(", "*", "f_...
Disbatch local client_async commands
[ "Disbatch", "local", "client_async", "commands" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1114-L1122
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAPIHandler._disbatch_runner
def _disbatch_runner(self, chunk): ''' Disbatch runner client commands ''' full_return = chunk.pop('full_return', False) pub_data = self.saltclients['runner'](chunk) tag = pub_data['tag'] + '/ret' try: event = yield self.application.event_listener.get_...
python
def _disbatch_runner(self, chunk): ''' Disbatch runner client commands ''' full_return = chunk.pop('full_return', False) pub_data = self.saltclients['runner'](chunk) tag = pub_data['tag'] + '/ret' try: event = yield self.application.event_listener.get_...
[ "def", "_disbatch_runner", "(", "self", ",", "chunk", ")", ":", "full_return", "=", "chunk", ".", "pop", "(", "'full_return'", ",", "False", ")", "pub_data", "=", "self", ".", "saltclients", "[", "'runner'", "]", "(", "chunk", ")", "tag", "=", "pub_data"...
Disbatch runner client commands
[ "Disbatch", "runner", "client", "commands" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1125-L1139
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
SaltAPIHandler._disbatch_runner_async
def _disbatch_runner_async(self, chunk): ''' Disbatch runner client_async commands ''' pub_data = self.saltclients['runner'](chunk) raise tornado.gen.Return(pub_data)
python
def _disbatch_runner_async(self, chunk): ''' Disbatch runner client_async commands ''' pub_data = self.saltclients['runner'](chunk) raise tornado.gen.Return(pub_data)
[ "def", "_disbatch_runner_async", "(", "self", ",", "chunk", ")", ":", "pub_data", "=", "self", ".", "saltclients", "[", "'runner'", "]", "(", "chunk", ")", "raise", "tornado", ".", "gen", ".", "Return", "(", "pub_data", ")" ]
Disbatch runner client_async commands
[ "Disbatch", "runner", "client_async", "commands" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1142-L1147
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
MinionSaltAPIHandler.get
def get(self, mid=None): # pylint: disable=W0221 ''' A convenience URL for getting lists of minions or getting minion details .. http:get:: /minions/(mid) :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status 200: |200| ...
python
def get(self, mid=None): # pylint: disable=W0221 ''' A convenience URL for getting lists of minions or getting minion details .. http:get:: /minions/(mid) :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status 200: |200| ...
[ "def", "get", "(", "self", ",", "mid", "=", "None", ")", ":", "# pylint: disable=W0221", "# if you aren't authenticated, redirect to login", "if", "not", "self", ".", "_verify_auth", "(", ")", ":", "self", ".", "redirect", "(", "'/login'", ")", "return", "self",...
A convenience URL for getting lists of minions or getting minion details .. http:get:: /minions/(mid) :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :status 200: |200| :status 401: |401| :status 406: |406| **Ex...
[ "A", "convenience", "URL", "for", "getting", "lists", "of", "minions", "or", "getting", "minion", "details" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1165-L1214
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
MinionSaltAPIHandler.post
def post(self): ''' Start an execution command and immediately return the job id .. http:post:: /minions :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |res_ct| ...
python
def post(self): ''' Start an execution command and immediately return the job id .. http:post:: /minions :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |res_ct| ...
[ "def", "post", "(", "self", ")", ":", "# if you aren't authenticated, redirect to login", "if", "not", "self", ".", "_verify_auth", "(", ")", ":", "self", ".", "redirect", "(", "'/login'", ")", "return", "# verify that all lowstates are the correct client type", "for", ...
Start an execution command and immediately return the job id .. http:post:: /minions :reqheader X-Auth-Token: |req_token| :reqheader Accept: |req_accept| :reqheader Content-Type: |req_ct| :resheader Content-Type: |res_ct| :status 200: |200| ...
[ "Start", "an", "execution", "command", "and", "immediately", "return", "the", "job", "id" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1217-L1286
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
JobsSaltAPIHandler.get
def get(self, jid=None): # pylint: disable=W0221 ''' A convenience URL for getting lists of previously run jobs or getting the return from a single job .. http:get:: /jobs/(jid) List jobs or show a single job from the job cache. :status 200: |200| ...
python
def get(self, jid=None): # pylint: disable=W0221 ''' A convenience URL for getting lists of previously run jobs or getting the return from a single job .. http:get:: /jobs/(jid) List jobs or show a single job from the job cache. :status 200: |200| ...
[ "def", "get", "(", "self", ",", "jid", "=", "None", ")", ":", "# pylint: disable=W0221", "# if you aren't authenticated, redirect to login", "if", "not", "self", ".", "_verify_auth", "(", ")", ":", "self", ".", "redirect", "(", "'/login'", ")", "return", "if", ...
A convenience URL for getting lists of previously run jobs or getting the return from a single job .. http:get:: /jobs/(jid) List jobs or show a single job from the job cache. :status 200: |200| :status 401: |401| :status 406: |406| **Example r...
[ "A", "convenience", "URL", "for", "getting", "lists", "of", "previously", "run", "jobs", "or", "getting", "the", "return", "from", "a", "single", "job" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1294-L1392
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
EventsSaltAPIHandler.get
def get(self): r''' An HTTP stream of the Salt master event bus This stream is formatted per the Server Sent Events (SSE) spec. Each event is formatted as JSON. .. http:get:: /events :status 200: |200| :status 401: |401| :status 406: |406| ...
python
def get(self): r''' An HTTP stream of the Salt master event bus This stream is formatted per the Server Sent Events (SSE) spec. Each event is formatted as JSON. .. http:get:: /events :status 200: |200| :status 401: |401| :status 406: |406| ...
[ "def", "get", "(", "self", ")", ":", "# if you aren't authenticated, redirect to login", "if", "not", "self", ".", "_verify_auth", "(", ")", ":", "self", ".", "redirect", "(", "'/login'", ")", "return", "# set the streaming headers", "self", ".", "set_header", "("...
r''' An HTTP stream of the Salt master event bus This stream is formatted per the Server Sent Events (SSE) spec. Each event is formatted as JSON. .. http:get:: /events :status 200: |200| :status 401: |401| :status 406: |406| **Example reque...
[ "r", "An", "HTTP", "stream", "of", "the", "Salt", "master", "event", "bus" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1471-L1584
train
saltstack/salt
salt/netapi/rest_tornado/saltnado.py
WebhookSaltAPIHandler.post
def post(self, tag_suffix=None): # pylint: disable=W0221 ''' Fire an event in Salt with a custom event tag and data .. http:post:: /hook :status 200: |200| :status 401: |401| :status 406: |406| :status 413: request body is too large **E...
python
def post(self, tag_suffix=None): # pylint: disable=W0221 ''' Fire an event in Salt with a custom event tag and data .. http:post:: /hook :status 200: |200| :status 401: |401| :status 406: |406| :status 413: request body is too large **E...
[ "def", "post", "(", "self", ",", "tag_suffix", "=", "None", ")", ":", "# pylint: disable=W0221", "disable_auth", "=", "self", ".", "application", ".", "mod_opts", ".", "get", "(", "'webhook_disable_auth'", ")", "if", "not", "disable_auth", "and", "not", "self"...
Fire an event in Salt with a custom event tag and data .. http:post:: /hook :status 200: |200| :status 401: |401| :status 406: |406| :status 413: request body is too large **Example request:** .. code-block:: bash curl -sS localhos...
[ "Fire", "an", "event", "in", "Salt", "with", "a", "custom", "event", "tag", "and", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/saltnado.py#L1628-L1747
train
saltstack/salt
salt/beacons/proxy_example.py
beacon
def beacon(config): ''' Called several times each second https://docs.saltstack.com/en/latest/topics/beacons/#the-beacon-function .. code-block:: yaml beacons: proxy_example: - endpoint: beacon ''' # Important!!! # Although this toy example makes an HTTP call ...
python
def beacon(config): ''' Called several times each second https://docs.saltstack.com/en/latest/topics/beacons/#the-beacon-function .. code-block:: yaml beacons: proxy_example: - endpoint: beacon ''' # Important!!! # Although this toy example makes an HTTP call ...
[ "def", "beacon", "(", "config", ")", ":", "# Important!!!", "# Although this toy example makes an HTTP call", "# to get beacon information", "# please be advised that doing CPU or IO intensive", "# operations in this method will cause the beacon loop", "# to block.", "_config", "=", "{",...
Called several times each second https://docs.saltstack.com/en/latest/topics/beacons/#the-beacon-function .. code-block:: yaml beacons: proxy_example: - endpoint: beacon
[ "Called", "several", "times", "each", "second", "https", ":", "//", "docs", ".", "saltstack", ".", "com", "/", "en", "/", "latest", "/", "topics", "/", "beacons", "/", "#the", "-", "beacon", "-", "function" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/proxy_example.py#L46-L71
train
saltstack/salt
salt/states/pdbedit.py
absent
def absent(name): ''' Ensure user account is absent name : string username ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} # remove if needed if name in __salt__['pdbedit.list'](False): res = __salt__['pdbedit.delete']...
python
def absent(name): ''' Ensure user account is absent name : string username ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} # remove if needed if name in __salt__['pdbedit.list'](False): res = __salt__['pdbedit.delete']...
[ "def", "absent", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "# remove if needed", "if", "name", "in", "__salt__", "[", "'pdbedit.list'"...
Ensure user account is absent name : string username
[ "Ensure", "user", "account", "is", "absent" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pdbedit.py#L53-L75
train
saltstack/salt
salt/states/pdbedit.py
managed
def managed(name, **kwargs): ''' Manage user account login : string login name password : string password password_hashed : boolean set if password is a nt hash instead of plain text domain : string users domain profile : string profile path scrip...
python
def managed(name, **kwargs): ''' Manage user account login : string login name password : string password password_hashed : boolean set if password is a nt hash instead of plain text domain : string users domain profile : string profile path scrip...
[ "def", "managed", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "# save state", "saved", "=", "__salt__", "["...
Manage user account login : string login name password : string password password_hashed : boolean set if password is a nt hash instead of plain text domain : string users domain profile : string profile path script : string logon script drive...
[ "Manage", "user", "account" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pdbedit.py#L78-L146
train
saltstack/salt
salt/modules/salt_proxy.py
_write_proxy_conf
def _write_proxy_conf(proxyfile): ''' write to file ''' msg = 'Invalid value for proxy file provided!, Supplied value = {0}' \ .format(proxyfile) log.trace('Salt Proxy Module: write proxy conf') if proxyfile: log.debug('Writing proxy conf file') with salt.utils.files.fo...
python
def _write_proxy_conf(proxyfile): ''' write to file ''' msg = 'Invalid value for proxy file provided!, Supplied value = {0}' \ .format(proxyfile) log.trace('Salt Proxy Module: write proxy conf') if proxyfile: log.debug('Writing proxy conf file') with salt.utils.files.fo...
[ "def", "_write_proxy_conf", "(", "proxyfile", ")", ":", "msg", "=", "'Invalid value for proxy file provided!, Supplied value = {0}'", ".", "format", "(", "proxyfile", ")", "log", ".", "trace", "(", "'Salt Proxy Module: write proxy conf'", ")", "if", "proxyfile", ":", "l...
write to file
[ "write", "to", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_proxy.py#L24-L41
train
saltstack/salt
salt/modules/salt_proxy.py
_proxy_conf_file
def _proxy_conf_file(proxyfile, test): ''' Check if proxy conf exists and update ''' changes_old = [] changes_new = [] success = True if not os.path.exists(proxyfile): try: if not test: changes_new.append(_write_proxy_conf(proxyfile)) msg =...
python
def _proxy_conf_file(proxyfile, test): ''' Check if proxy conf exists and update ''' changes_old = [] changes_new = [] success = True if not os.path.exists(proxyfile): try: if not test: changes_new.append(_write_proxy_conf(proxyfile)) msg =...
[ "def", "_proxy_conf_file", "(", "proxyfile", ",", "test", ")", ":", "changes_old", "=", "[", "]", "changes_new", "=", "[", "]", "success", "=", "True", "if", "not", "os", ".", "path", ".", "exists", "(", "proxyfile", ")", ":", "try", ":", "if", "not"...
Check if proxy conf exists and update
[ "Check", "if", "proxy", "conf", "exists", "and", "update" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_proxy.py#L44-L70
train
saltstack/salt
salt/modules/salt_proxy.py
_is_proxy_running
def _is_proxy_running(proxyname): ''' Check if proxy for this name is running ''' cmd = ('ps ax | grep "salt-proxy --proxyid={0}" | grep -v grep' .format(salt.ext.six.moves.shlex_quote(proxyname))) cmdout = __salt__['cmd.run_all']( cmd, timeout=5, python_shell=True...
python
def _is_proxy_running(proxyname): ''' Check if proxy for this name is running ''' cmd = ('ps ax | grep "salt-proxy --proxyid={0}" | grep -v grep' .format(salt.ext.six.moves.shlex_quote(proxyname))) cmdout = __salt__['cmd.run_all']( cmd, timeout=5, python_shell=True...
[ "def", "_is_proxy_running", "(", "proxyname", ")", ":", "cmd", "=", "(", "'ps ax | grep \"salt-proxy --proxyid={0}\" | grep -v grep'", ".", "format", "(", "salt", ".", "ext", ".", "six", ".", "moves", ".", "shlex_quote", "(", "proxyname", ")", ")", ")", "cmdout"...
Check if proxy for this name is running
[ "Check", "if", "proxy", "for", "this", "name", "is", "running" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_proxy.py#L73-L86
train
saltstack/salt
salt/modules/salt_proxy.py
_proxy_process
def _proxy_process(proxyname, test): ''' Check and execute proxy process ''' changes_old = [] changes_new = [] if not _is_proxy_running(proxyname): if not test: __salt__['cmd.run_all']( 'salt-proxy --proxyid={0} -l info -d'.format(salt.ext.six.moves.shlex_quot...
python
def _proxy_process(proxyname, test): ''' Check and execute proxy process ''' changes_old = [] changes_new = [] if not _is_proxy_running(proxyname): if not test: __salt__['cmd.run_all']( 'salt-proxy --proxyid={0} -l info -d'.format(salt.ext.six.moves.shlex_quot...
[ "def", "_proxy_process", "(", "proxyname", ",", "test", ")", ":", "changes_old", "=", "[", "]", "changes_new", "=", "[", "]", "if", "not", "_is_proxy_running", "(", "proxyname", ")", ":", "if", "not", "test", ":", "__salt__", "[", "'cmd.run_all'", "]", "...
Check and execute proxy process
[ "Check", "and", "execute", "proxy", "process" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_proxy.py#L89-L108
train
saltstack/salt
salt/modules/salt_proxy.py
configure_proxy
def configure_proxy(proxyname, start=True): ''' Create the salt proxy file and start the proxy process if required Parameters: proxyname: Name to be used for this proxy (should match entries in pillar) start: Boolean indicating if the process should be started ...
python
def configure_proxy(proxyname, start=True): ''' Create the salt proxy file and start the proxy process if required Parameters: proxyname: Name to be used for this proxy (should match entries in pillar) start: Boolean indicating if the process should be started ...
[ "def", "configure_proxy", "(", "proxyname", ",", "start", "=", "True", ")", ":", "changes_new", "=", "[", "]", "changes_old", "=", "[", "]", "status_file", "=", "True", "test", "=", "__opts__", "[", "'test'", "]", "# write the proxy file if necessary", "proxyf...
Create the salt proxy file and start the proxy process if required Parameters: proxyname: Name to be used for this proxy (should match entries in pillar) start: Boolean indicating if the process should be started default = True CLI Example: .. code-...
[ "Create", "the", "salt", "proxy", "file", "and", "start", "the", "proxy", "process", "if", "required" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_proxy.py#L111-L156
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.publish_minions
def publish_minions(self): ''' Publishes minions as a list of dicts. ''' log.debug('in publish minions') minions = {} log.debug('starting loop') for minion, minion_info in six.iteritems(self.minions): log.debug(minion) # log.debug(minion_i...
python
def publish_minions(self): ''' Publishes minions as a list of dicts. ''' log.debug('in publish minions') minions = {} log.debug('starting loop') for minion, minion_info in six.iteritems(self.minions): log.debug(minion) # log.debug(minion_i...
[ "def", "publish_minions", "(", "self", ")", ":", "log", ".", "debug", "(", "'in publish minions'", ")", "minions", "=", "{", "}", "log", ".", "debug", "(", "'starting loop'", ")", "for", "minion", ",", "minion_info", "in", "six", ".", "iteritems", "(", "...
Publishes minions as a list of dicts.
[ "Publishes", "minions", "as", "a", "list", "of", "dicts", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L32-L50
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.publish
def publish(self, key, data): ''' Publishes the data to the event stream. ''' publish_data = {key: data} pub = salt.utils.json.dumps(publish_data) + str('\n\n') # future lint: disable=blacklisted-function self.handler.write_message(pub)
python
def publish(self, key, data): ''' Publishes the data to the event stream. ''' publish_data = {key: data} pub = salt.utils.json.dumps(publish_data) + str('\n\n') # future lint: disable=blacklisted-function self.handler.write_message(pub)
[ "def", "publish", "(", "self", ",", "key", ",", "data", ")", ":", "publish_data", "=", "{", "key", ":", "data", "}", "pub", "=", "salt", ".", "utils", ".", "json", ".", "dumps", "(", "publish_data", ")", "+", "str", "(", "'\\n\\n'", ")", "# future ...
Publishes the data to the event stream.
[ "Publishes", "the", "data", "to", "the", "event", "stream", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L52-L58
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.process_minion_update
def process_minion_update(self, event_data): ''' Associate grains data with a minion and publish minion update ''' tag = event_data['tag'] event_info = event_data['data'] mid = tag.split('/')[-1] if not self.minions.get(mid, None): self.minions[mid] ...
python
def process_minion_update(self, event_data): ''' Associate grains data with a minion and publish minion update ''' tag = event_data['tag'] event_info = event_data['data'] mid = tag.split('/')[-1] if not self.minions.get(mid, None): self.minions[mid] ...
[ "def", "process_minion_update", "(", "self", ",", "event_data", ")", ":", "tag", "=", "event_data", "[", "'tag'", "]", "event_info", "=", "event_data", "[", "'data'", "]", "mid", "=", "tag", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "if", "n...
Associate grains data with a minion and publish minion update
[ "Associate", "grains", "data", "with", "a", "minion", "and", "publish", "minion", "update" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L60-L76
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.process_ret_job_event
def process_ret_job_event(self, event_data): ''' Process a /ret event returned by Salt for a particular minion. These events contain the returned results from a particular execution. ''' tag = event_data['tag'] event_info = event_data['data'] _, _, jid, _, mid = ...
python
def process_ret_job_event(self, event_data): ''' Process a /ret event returned by Salt for a particular minion. These events contain the returned results from a particular execution. ''' tag = event_data['tag'] event_info = event_data['data'] _, _, jid, _, mid = ...
[ "def", "process_ret_job_event", "(", "self", ",", "event_data", ")", ":", "tag", "=", "event_data", "[", "'tag'", "]", "event_info", "=", "event_data", "[", "'data'", "]", "_", ",", "_", ",", "jid", ",", "_", ",", "mid", "=", "tag", ".", "split", "("...
Process a /ret event returned by Salt for a particular minion. These events contain the returned results from a particular execution.
[ "Process", "a", "/", "ret", "event", "returned", "by", "Salt", "for", "a", "particular", "minion", ".", "These", "events", "contain", "the", "returned", "results", "from", "a", "particular", "execution", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L78-L100
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.process_new_job_event
def process_new_job_event(self, event_data): ''' Creates a new job with properties from the event data like jid, function, args, timestamp. Also sets the initial state to started. Minions that are participating in this job are also noted. ''' job = None ...
python
def process_new_job_event(self, event_data): ''' Creates a new job with properties from the event data like jid, function, args, timestamp. Also sets the initial state to started. Minions that are participating in this job are also noted. ''' job = None ...
[ "def", "process_new_job_event", "(", "self", ",", "event_data", ")", ":", "job", "=", "None", "tag", "=", "event_data", "[", "'tag'", "]", "event_info", "=", "event_data", "[", "'data'", "]", "minions", "=", "{", "}", "for", "mid", "in", "event_info", "[...
Creates a new job with properties from the event data like jid, function, args, timestamp. Also sets the initial state to started. Minions that are participating in this job are also noted.
[ "Creates", "a", "new", "job", "with", "properties", "from", "the", "event", "data", "like", "jid", "function", "args", "timestamp", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L102-L129
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.process_key_event
def process_key_event(self, event_data): ''' Tag: salt/key Data: {'_stamp': '2014-05-20T22:45:04.345583', 'act': 'delete', 'id': 'compute.home', 'result': True} ''' tag = event_data['tag'] event_info = event_data['data'] if eve...
python
def process_key_event(self, event_data): ''' Tag: salt/key Data: {'_stamp': '2014-05-20T22:45:04.345583', 'act': 'delete', 'id': 'compute.home', 'result': True} ''' tag = event_data['tag'] event_info = event_data['data'] if eve...
[ "def", "process_key_event", "(", "self", ",", "event_data", ")", ":", "tag", "=", "event_data", "[", "'tag'", "]", "event_info", "=", "event_data", "[", "'data'", "]", "if", "event_info", "[", "'act'", "]", "==", "'delete'", ":", "self", ".", "minions", ...
Tag: salt/key Data: {'_stamp': '2014-05-20T22:45:04.345583', 'act': 'delete', 'id': 'compute.home', 'result': True}
[ "Tag", ":", "salt", "/", "key", "Data", ":", "{", "_stamp", ":", "2014", "-", "05", "-", "20T22", ":", "45", ":", "04", ".", "345583", "act", ":", "delete", "id", ":", "compute", ".", "home", "result", ":", "True", "}" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L131-L149
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.process_presence_events
def process_presence_events(self, salt_data, token, opts): ''' Check if any minions have connected or dropped. Send a message to the client if they have. ''' log.debug('In presence') changed = False # check if any connections were dropped if set(salt_data...
python
def process_presence_events(self, salt_data, token, opts): ''' Check if any minions have connected or dropped. Send a message to the client if they have. ''' log.debug('In presence') changed = False # check if any connections were dropped if set(salt_data...
[ "def", "process_presence_events", "(", "self", ",", "salt_data", ",", "token", ",", "opts", ")", ":", "log", ".", "debug", "(", "'In presence'", ")", "changed", "=", "False", "# check if any connections were dropped", "if", "set", "(", "salt_data", "[", "'data'"...
Check if any minions have connected or dropped. Send a message to the client if they have.
[ "Check", "if", "any", "minions", "have", "connected", "or", "dropped", ".", "Send", "a", "message", "to", "the", "client", "if", "they", "have", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L151-L202
train
saltstack/salt
salt/netapi/rest_tornado/event_processor.py
SaltInfo.process
def process(self, salt_data, token, opts): ''' Process events and publish data ''' log.debug('In process %s', threading.current_thread()) log.debug(salt_data['tag']) log.debug(salt_data) parts = salt_data['tag'].split('/') if len(parts) < 2: r...
python
def process(self, salt_data, token, opts): ''' Process events and publish data ''' log.debug('In process %s', threading.current_thread()) log.debug(salt_data['tag']) log.debug(salt_data) parts = salt_data['tag'].split('/') if len(parts) < 2: r...
[ "def", "process", "(", "self", ",", "salt_data", ",", "token", ",", "opts", ")", ":", "log", ".", "debug", "(", "'In process %s'", ",", "threading", ".", "current_thread", "(", ")", ")", "log", ".", "debug", "(", "salt_data", "[", "'tag'", "]", ")", ...
Process events and publish data
[ "Process", "events", "and", "publish", "data" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_tornado/event_processor.py#L204-L233
train
saltstack/salt
salt/client/ssh/wrapper/mine.py
get
def get(tgt, fun, tgt_type='glob', roster='flat'): ''' Get data from the mine based on the target, function and tgt_type This will actually run the function on all targeted minions (like publish.publish), as salt-ssh clients can't update the mine themselves. We will look for mine_functions in the ...
python
def get(tgt, fun, tgt_type='glob', roster='flat'): ''' Get data from the mine based on the target, function and tgt_type This will actually run the function on all targeted minions (like publish.publish), as salt-ssh clients can't update the mine themselves. We will look for mine_functions in the ...
[ "def", "get", "(", "tgt", ",", "fun", ",", "tgt_type", "=", "'glob'", ",", "roster", "=", "'flat'", ")", ":", "# Set up opts for the SSH object", "opts", "=", "copy", ".", "deepcopy", "(", "__context__", "[", "'master_opts'", "]", ")", "minopts", "=", "cop...
Get data from the mine based on the target, function and tgt_type This will actually run the function on all targeted minions (like publish.publish), as salt-ssh clients can't update the mine themselves. We will look for mine_functions in the roster, pillar, and master config, in that order, looking f...
[ "Get", "data", "from", "the", "mine", "based", "on", "the", "target", "function", "and", "tgt_type" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/mine.py#L17-L63
train
saltstack/salt
salt/utils/timeout.py
wait_for
def wait_for(func, timeout=10, step=1, default=None, func_args=(), func_kwargs=None): ''' Call `func` at regular intervals and Waits until the given function returns a truthy value within the given timeout and returns that value. @param func: @type func: function @param timeout: @type timeo...
python
def wait_for(func, timeout=10, step=1, default=None, func_args=(), func_kwargs=None): ''' Call `func` at regular intervals and Waits until the given function returns a truthy value within the given timeout and returns that value. @param func: @type func: function @param timeout: @type timeo...
[ "def", "wait_for", "(", "func", ",", "timeout", "=", "10", ",", "step", "=", "1", ",", "default", "=", "None", ",", "func_args", "=", "(", ")", ",", "func_kwargs", "=", "None", ")", ":", "if", "func_kwargs", "is", "None", ":", "func_kwargs", "=", "...
Call `func` at regular intervals and Waits until the given function returns a truthy value within the given timeout and returns that value. @param func: @type func: function @param timeout: @type timeout: int | float @param step: Interval at which we should check for the value @type step: i...
[ "Call", "func", "at", "regular", "intervals", "and", "Waits", "until", "the", "given", "function", "returns", "a", "truthy", "value", "within", "the", "given", "timeout", "and", "returns", "that", "value", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/timeout.py#L12-L50
train
saltstack/salt
salt/modules/debian_service.py
get_enabled
def get_enabled(): ''' Return a list of service that are enabled on boot CLI Example: .. code-block:: bash salt '*' service.get_enabled ''' prefix = '/etc/rc[S{0}].d/S'.format(_get_runlevel()) ret = set() lines = glob.glob('{0}*'.format(prefix)) for line in lines: ...
python
def get_enabled(): ''' Return a list of service that are enabled on boot CLI Example: .. code-block:: bash salt '*' service.get_enabled ''' prefix = '/etc/rc[S{0}].d/S'.format(_get_runlevel()) ret = set() lines = glob.glob('{0}*'.format(prefix)) for line in lines: ...
[ "def", "get_enabled", "(", ")", ":", "prefix", "=", "'/etc/rc[S{0}].d/S'", ".", "format", "(", "_get_runlevel", "(", ")", ")", "ret", "=", "set", "(", ")", "lines", "=", "glob", ".", "glob", "(", "'{0}*'", ".", "format", "(", "prefix", ")", ")", "for...
Return a list of service that are enabled on boot CLI Example: .. code-block:: bash salt '*' service.get_enabled
[ "Return", "a", "list", "of", "service", "that", "are", "enabled", "on", "boot" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_service.py#L76-L91
train
saltstack/salt
salt/modules/debian_service.py
get_all
def get_all(): ''' Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = set() lines = glob.glob('/etc/init.d/*') for line in lines: service = line.split('/etc/init.d/')[1] # Remove README. If it's an enabled s...
python
def get_all(): ''' Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = set() lines = glob.glob('/etc/init.d/*') for line in lines: service = line.split('/etc/init.d/')[1] # Remove README. If it's an enabled s...
[ "def", "get_all", "(", ")", ":", "ret", "=", "set", "(", ")", "lines", "=", "glob", ".", "glob", "(", "'/etc/init.d/*'", ")", "for", "line", "in", "lines", ":", "service", "=", "line", ".", "split", "(", "'/etc/init.d/'", ")", "[", "1", "]", "# Rem...
Return all available boot services CLI Example: .. code-block:: bash salt '*' service.get_all
[ "Return", "all", "available", "boot", "services" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_service.py#L136-L153
train
saltstack/salt
salt/modules/debian_service.py
enable
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> ''' osmajor = _osrel()[0] if osmajor < '6': cmd = 'update-rc.d -f {0} defaults 99'.format(_cmd_quote(name)) else: ...
python
def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> ''' osmajor = _osrel()[0] if osmajor < '6': cmd = 'update-rc.d -f {0} defaults 99'.format(_cmd_quote(name)) else: ...
[ "def", "enable", "(", "name", ",", "*", "*", "kwargs", ")", ":", "osmajor", "=", "_osrel", "(", ")", "[", "0", "]", "if", "osmajor", "<", "'6'", ":", "cmd", "=", "'update-rc.d -f {0} defaults 99'", ".", "format", "(", "_cmd_quote", "(", "name", ")", ...
Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name>
[ "Enable", "the", "named", "service", "to", "start", "at", "boot" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_service.py#L273-L295
train