INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Ensure that the given package is not cached.
If no package is specified, this ensures the entire cache is cleared.
name
The name of the package to remove from the cache, or None for all packages
user
The user to run NPM with
force
Force cleaning of cache. Required for npm@5 ... | def cache_cleaned(name=None,
user=None,
force=False):
'''
Ensure that the given package is not cached.
If no package is specified, this ensures the entire cache is cleared.
name
The name of the package to remove from the cache, or None for all packages
... |
Ensure a search is present
.. code-block:: yaml
API Error Search:
splunk_search.present:
search: index=main sourcetype=blah
template: alert_5min
The following parameters are required:
name
This is the name of the search in splunk | def present(name, profile="splunk", **kwargs):
'''
Ensure a search is present
.. code-block:: yaml
API Error Search:
splunk_search.present:
search: index=main sourcetype=blah
template: alert_5min
The following parameters are required:
name
This i... |
Ensure a search is absent
.. code-block:: yaml
API Error Search:
splunk_search.absent
The following parameters are required:
name
This is the name of the search in splunk | def absent(name, profile="splunk"):
'''
Ensure a search is absent
.. code-block:: yaml
API Error Search:
splunk_search.absent
The following parameters are required:
name
This is the name of the search in splunk
'''
ret = {
'name': name,
'changes'... |
Generic function for bulk worker operation | def _bulk_state(saltfunc, lbn, workers, profile):
'''
Generic function for bulk worker operation
'''
ret = {'name': lbn,
'result': True,
'changes': {},
'comment': ''}
if not isinstance(workers, list):
ret['result'] = False
ret['comment'] = 'workers s... |
Stop all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_stopped:
- workers:
- app1
- app2 | def worker_stopped(name, workers=None, profile='default'):
'''
Stop all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_stopped:
- workers:
- app1
- app2
'''
if workers is None:
w... |
Activate all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_activated:
- workers:
- app1
- app2 | def worker_activated(name, workers=None, profile='default'):
'''
Activate all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_activated:
- workers:
- app1
- app2
'''
if workers is None:
... |
Disable all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_disabled:
- workers:
- app1
- app2 | def worker_disabled(name, workers=None, profile='default'):
'''
Disable all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_disabled:
- workers:
- app1
- app2
'''
if workers is None:
... |
Recover all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_recover:
- workers:
- app1
- app2 | def worker_recover(name, workers=None, profile='default'):
'''
Recover all the workers in the modjk load balancer
Example:
.. code-block:: yaml
loadbalancer:
modjk.worker_recover:
- workers:
- app1
- app2
'''
if workers is None:
... |
Parses a port forwarding statement in the form used by this state:
from_port:to_port:protocol[:destination]
and returns a ForwardingMapping object | def _parse_forward(mapping):
'''
Parses a port forwarding statement in the form used by this state:
from_port:to_port:protocol[:destination]
and returns a ForwardingMapping object
'''
if len(mapping.split(':')) > 3:
(srcport, destport, protocol, destaddr) = mapping.split(':')
else:... |
Ensure a zone has specific attributes.
name
The zone to modify.
default : None
Set this zone as the default zone if ``True``.
masquerade : False
Enable or disable masquerade for a zone.
block_icmp : None
List of ICMP types to block in the zone.
prune_block_icmp :... | def present(name,
block_icmp=None,
prune_block_icmp=False,
default=None,
masquerade=False,
ports=None,
prune_ports=False,
port_fwd=None,
prune_port_fwd=False,
services=None,
prune_services=False,
... |
Ensure the service exists and encompasses the specified ports and
protocols.
.. versionadded:: 2016.11.0 | def service(name,
ports=None,
protocols=None):
'''
Ensure the service exists and encompasses the specified ports and
protocols.
.. versionadded:: 2016.11.0
'''
ret = {'name': name,
'result': False,
'changes': {},
'comment': ''}
if na... |
Ensure a zone has specific attributes. | def _present(name,
block_icmp=None,
prune_block_icmp=False,
default=None,
masquerade=False,
ports=None,
prune_ports=False,
port_fwd=None,
prune_port_fwd=False,
services=None,
# TODO: prune_services=Fa... |
Returns a pretty dictionary meant for command line output. | def todict(self):
'''
Returns a pretty dictionary meant for command line output.
'''
return {
'Source port': self.srcport,
'Destination port': self.destport,
'Protocol': self.protocol,
'Destination address': self.destaddr} |
Return server object used to interact with Jenkins.
:return: server object used to interact with Jenkins | def _connect():
'''
Return server object used to interact with Jenkins.
:return: server object used to interact with Jenkins
'''
jenkins_url = __salt__['config.get']('jenkins.url') or \
__salt__['config.get']('jenkins:url') or \
__salt__['pillar.get']('jenkins.url')
jenkins_use... |
Helper to cache the config XML and raise a CommandExecutionError if we fail
to do so. If we successfully cache the file, return the cached path. | def _retrieve_config_xml(config_xml, saltenv):
'''
Helper to cache the config XML and raise a CommandExecutionError if we fail
to do so. If we successfully cache the file, return the cached path.
'''
ret = __salt__['cp.cache_file'](config_xml, saltenv)
if not ret:
raise CommandExecution... |
Check whether the job exists in configured Jenkins jobs.
:param name: The name of the job is check if it exists.
:return: True if job exists, False if job does not exist.
CLI Example:
.. code-block:: bash
salt '*' jenkins.job_exists jobname | def job_exists(name=None):
'''
Check whether the job exists in configured Jenkins jobs.
:param name: The name of the job is check if it exists.
:return: True if job exists, False if job does not exist.
CLI Example:
.. code-block:: bash
salt '*' jenkins.job_exists jobname
'''
... |
Return information about the Jenkins job.
:param name: The name of the job is check if it exists.
:return: Information about the Jenkins job.
CLI Example:
.. code-block:: bash
salt '*' jenkins.get_job_info jobname | def get_job_info(name=None):
'''
Return information about the Jenkins job.
:param name: The name of the job is check if it exists.
:return: Information about the Jenkins job.
CLI Example:
.. code-block:: bash
salt '*' jenkins.get_job_info jobname
'''
if not name:
rai... |
Initiate a build for the provided job.
:param name: The name of the job is check if it exists.
:param parameters: Parameters to send to the job.
:return: True is successful, otherwise raise an exception.
CLI Example:
.. code-block:: bash
salt '*' jenkins.build_job jobname | def build_job(name=None, parameters=None):
'''
Initiate a build for the provided job.
:param name: The name of the job is check if it exists.
:param parameters: Parameters to send to the job.
:return: True is successful, otherwise raise an exception.
CLI Example:
.. code-block:: bash
... |
Return the configuration file.
:param name: The name of the job is check if it exists.
:param config_xml: The configuration file to use to create the job.
:param saltenv: The environment to look for the file in.
:return: The configuration file used for the job.
CLI Example:
.. code-block:: ba... | def create_job(name=None,
config_xml=None,
saltenv='base'):
'''
Return the configuration file.
:param name: The name of the job is check if it exists.
:param config_xml: The configuration file to use to create the job.
:param saltenv: The environment to look for the fi... |
Return true is job is deleted successfully.
:param name: The name of the job to delete.
:return: Return true if job is deleted successfully.
CLI Example:
.. code-block:: bash
salt '*' jenkins.delete_job jobname | def delete_job(name=None):
'''
Return true is job is deleted successfully.
:param name: The name of the job to delete.
:return: Return true if job is deleted successfully.
CLI Example:
.. code-block:: bash
salt '*' jenkins.delete_job jobname
'''
if not name:
raise Sa... |
Return the current status, enabled or disabled, of the job.
:param name: The name of the job to return status for
:return: Return true if enabled or false if disabled.
CLI Example:
.. code-block:: bash
salt '*' jenkins.job_status jobname | def job_status(name=None):
'''
Return the current status, enabled or disabled, of the job.
:param name: The name of the job to return status for
:return: Return true if enabled or false if disabled.
CLI Example:
.. code-block:: bash
salt '*' jenkins.job_status jobname
'''
i... |
Return the current job configuration for the provided job.
:param name: The name of the job to return the configuration for.
:return: The configuration for the job specified.
CLI Example:
.. code-block:: bash
salt '*' jenkins.get_job_config jobname | def get_job_config(name=None):
'''
Return the current job configuration for the provided job.
:param name: The name of the job to return the configuration for.
:return: The configuration for the job specified.
CLI Example:
.. code-block:: bash
salt '*' jenkins.get_job_config jobname
... |
.. versionadded:: 2016.11.0
Return if the plugin is installed for the provided plugin name.
:param name: The name of the parameter to confirm installation.
:return: True if plugin exists, False if plugin does not exist.
CLI Example:
.. code-block:: bash
salt '*' jenkins.plugin_installed... | def plugin_installed(name):
'''
.. versionadded:: 2016.11.0
Return if the plugin is installed for the provided plugin name.
:param name: The name of the parameter to confirm installation.
:return: True if plugin exists, False if plugin does not exist.
CLI Example:
.. code-block:: bash
... |
.. versionadded:: Fluorine
Creates or updates a record set within a DNS zone.
:param name: The name of the record set, relative to the name of the zone.
:param zone_name: The name of the DNS zone (without a terminating dot).
:param resource_group: The name of the resource group.
:param record_t... | def record_set_create_or_update(name, zone_name, resource_group, record_type, **kwargs):
'''
.. versionadded:: Fluorine
Creates or updates a record set within a DNS zone.
:param name: The name of the record set, relative to the name of the zone.
:param zone_name: The name of the DNS zone (without... |
.. versionadded:: Fluorine
Deletes a record set from a DNS zone. This operation cannot be undone.
:param name: The name of the record set, relative to the name of the zone.
:param zone_name: The name of the DNS zone (without a terminating dot).
:param resource_group: The name of the resource group.
... | def record_set_delete(name, zone_name, resource_group, record_type, **kwargs):
'''
.. versionadded:: Fluorine
Deletes a record set from a DNS zone. This operation cannot be undone.
:param name: The name of the record set, relative to the name of the zone.
:param zone_name: The name of the DNS zon... |
.. versionadded:: Fluorine
Get a dictionary representing a record set's properties.
:param name: The name of the record set, relative to the name of the zone.
:param zone_name: The name of the DNS zone (without a terminating dot).
:param resource_group: The name of the resource group.
:param re... | def record_set_get(name, zone_name, resource_group, record_type, **kwargs):
'''
.. versionadded:: Fluorine
Get a dictionary representing a record set's properties.
:param name: The name of the record set, relative to the name of the zone.
:param zone_name: The name of the DNS zone (without a term... |
.. versionadded:: Fluorine
Lists the record sets of a specified type in a DNS zone.
:param zone_name: The name of the DNS zone (without a terminating dot).
:param resource_group: The name of the resource group.
:param record_type: The type of record sets to enumerate.
Possible values include: 'A... | def record_sets_list_by_type(zone_name, resource_group, record_type, top=None, recordsetnamesuffix=None, **kwargs):
'''
.. versionadded:: Fluorine
Lists the record sets of a specified type in a DNS zone.
:param zone_name: The name of the DNS zone (without a terminating dot).
:param resource_group... |
.. versionadded:: Fluorine
Lists all record sets in a DNS zone.
:param zone_name: The name of the DNS zone (without a terminating dot).
:param resource_group: The name of the resource group.
:param top: The maximum number of record sets to return. If not specified,
returns up to 100 record sets.... | def record_sets_list_by_dns_zone(zone_name, resource_group, top=None, recordsetnamesuffix=None, **kwargs):
'''
.. versionadded:: Fluorine
Lists all record sets in a DNS zone.
:param zone_name: The name of the DNS zone (without a terminating dot).
:param resource_group: The name of the resource gr... |
.. versionadded:: Fluorine
Creates or updates a DNS zone. Does not modify DNS records within the zone.
:param name: The name of the DNS zone to create (without a terminating dot).
:param resource_group: The name of the resource group.
CLI Example:
.. code-block:: bash
salt-call azurear... | def zone_create_or_update(name, resource_group, **kwargs):
'''
.. versionadded:: Fluorine
Creates or updates a DNS zone. Does not modify DNS records within the zone.
:param name: The name of the DNS zone to create (without a terminating dot).
:param resource_group: The name of the resource group.... |
.. versionadded:: Fluorine
Delete a DNS zone within a resource group.
:param name: The name of the DNS zone to delete.
:param resource_group: The name of the resource group.
CLI Example:
.. code-block:: bash
salt-call azurearm_dns.zone_delete myzone testgroup | def zone_delete(name, resource_group, **kwargs):
'''
.. versionadded:: Fluorine
Delete a DNS zone within a resource group.
:param name: The name of the DNS zone to delete.
:param resource_group: The name of the resource group.
CLI Example:
.. code-block:: bash
salt-call azurear... |
.. versionadded:: Fluorine
Get a dictionary representing a DNS zone's properties, but not the
record sets within the zone.
:param name: The DNS zone to get.
:param resource_group: The name of the resource group.
CLI Example:
.. code-block:: bash
salt-call azurearm_dns.zone_get myzo... | def zone_get(name, resource_group, **kwargs):
'''
.. versionadded:: Fluorine
Get a dictionary representing a DNS zone's properties, but not the
record sets within the zone.
:param name: The DNS zone to get.
:param resource_group: The name of the resource group.
CLI Example:
.. code-... |
.. versionadded:: Fluorine
Lists the DNS zones in a resource group.
:param resource_group: The name of the resource group.
:param top: The maximum number of DNS zones to return. If not specified,
returns up to 100 zones.
CLI Example:
.. code-block:: bash
salt-call azurearm_dns.zone... | def zones_list_by_resource_group(resource_group, top=None, **kwargs):
'''
.. versionadded:: Fluorine
Lists the DNS zones in a resource group.
:param resource_group: The name of the resource group.
:param top: The maximum number of DNS zones to return. If not specified,
returns up to 100 zones... |
.. versionadded:: Fluorine
Lists the DNS zones in all resource groups in a subscription.
:param top: The maximum number of DNS zones to return. If not specified,
returns up to 100 zones.
CLI Example:
.. code-block:: bash
salt-call azurearm_dns.zones_list | def zones_list(top=None, **kwargs):
'''
.. versionadded:: Fluorine
Lists the DNS zones in all resource groups in a subscription.
:param top: The maximum number of DNS zones to return. If not specified,
returns up to 100 zones.
CLI Example:
.. code-block:: bash
salt-call azurearm... |
Check to see if an ELB exists.
CLI example:
.. code-block:: bash
salt myminion boto_elb.exists myelb region=us-east-1 | def exists(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if an ELB exists.
CLI example:
.. code-block:: bash
salt myminion boto_elb.exists myelb region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
elb... |
Return all load balancers associated with an account
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_all_elbs region=us-east-1 | def get_all_elbs(region=None, key=None, keyid=None, profile=None):
'''
Return all load balancers associated with an account
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_all_elbs region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)... |
Return names of all load balancers associated with an account
CLI example:
.. code-block:: bash
salt myminion boto_elb.list_elbs region=us-east-1 | def list_elbs(region=None, key=None, keyid=None, profile=None):
'''
Return names of all load balancers associated with an account
CLI example:
.. code-block:: bash
salt myminion boto_elb.list_elbs region=us-east-1
'''
return [e.name for e in get_all_elbs(region=region, key=key, keyid... |
Get an ELB configuration.
CLI example:
.. code-block:: bash
salt myminion boto_elb.exists myelb region=us-east-1 | def get_elb_config(name, region=None, key=None, keyid=None, profile=None):
'''
Get an ELB configuration.
CLI example:
.. code-block:: bash
salt myminion boto_elb.exists myelb region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
retries = 30
... |
Convert an ELB listener dict into a listener tuple used by certain parts of
the AWS ELB API.
CLI example:
.. code-block:: bash
salt myminion boto_elb.listener_dict_to_tuple '{"elb_port":80,"instance_port":80,"elb_protocol":"HTTP"}' | def listener_dict_to_tuple(listener):
'''
Convert an ELB listener dict into a listener tuple used by certain parts of
the AWS ELB API.
CLI example:
.. code-block:: bash
salt myminion boto_elb.listener_dict_to_tuple '{"elb_port":80,"instance_port":80,"elb_protocol":"HTTP"}'
'''
# W... |
Create an ELB
CLI example to create an ELB:
.. code-block:: bash
salt myminion boto_elb.create myelb '["us-east-1a", "us-east-1e"]' '{"elb_port": 443, "elb_protocol": "HTTPS", ...}' region=us-east-1 | def create(name, availability_zones, listeners, subnets=None,
security_groups=None, scheme='internet-facing',
region=None, key=None, keyid=None,
profile=None):
'''
Create an ELB
CLI example to create an ELB:
.. code-block:: bash
salt myminion boto_elb.create m... |
Delete an ELB.
CLI example to delete an ELB:
.. code-block:: bash
salt myminion boto_elb.delete myelb region=us-east-1 | def delete(name, region=None, key=None, keyid=None, profile=None):
'''
Delete an ELB.
CLI example to delete an ELB:
.. code-block:: bash
salt myminion boto_elb.delete myelb region=us-east-1
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
if not exists(n... |
Create listeners on an ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.create_listeners myelb '[["HTTPS", "HTTP", 443, 80, "arn:aws:iam::11 11111:server-certificate/mycert"]]' | def create_listeners(name, listeners, region=None, key=None, keyid=None,
profile=None):
'''
Create listeners on an ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.create_listeners myelb '[["HTTPS", "HTTP", 443, 80, "arn:aws:iam::11 11111:server-certificate/... |
Delete listeners on an ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.delete_listeners myelb '[80,443]' | def delete_listeners(name, ports, region=None, key=None, keyid=None,
profile=None):
'''
Delete listeners on an ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.delete_listeners myelb '[80,443]'
'''
conn = _get_conn(region=region, key=key, keyid=keyid,... |
Apply security groups to ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.apply_security_groups myelb '["mysecgroup1"]' | def apply_security_groups(name, security_groups, region=None, key=None,
keyid=None, profile=None):
'''
Apply security groups to ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.apply_security_groups myelb '["mysecgroup1"]'
'''
conn = _get_conn(re... |
Check to see if attributes are set on an ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_attributes myelb | def get_attributes(name, region=None, key=None, keyid=None, profile=None):
'''
Check to see if attributes are set on an ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_attributes myelb
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
ret... |
Set attributes on an ELB.
name (string)
Name of the ELB instance to set attributes for
attributes
A dict of attributes to set.
Valid attributes are:
access_log (dict)
enabled (bool)
Enable storage of access logs.
s3_bucket_name (string)... | def set_attributes(name, attributes, region=None, key=None, keyid=None,
profile=None):
'''
Set attributes on an ELB.
name (string)
Name of the ELB instance to set attributes for
attributes
A dict of attributes to set.
Valid attributes are:
access_lo... |
Get the health check configured for this ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_health_check myelb | def get_health_check(name, region=None, key=None, keyid=None, profile=None):
'''
Get the health check configured for this ELB.
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_health_check myelb
'''
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
... |
Set attributes on an ELB.
CLI example to set attributes on an ELB:
.. code-block:: bash
salt myminion boto_elb.set_health_check myelb '{"target": "HTTP:80/"}' | def set_health_check(name, health_check, region=None, key=None, keyid=None,
profile=None):
'''
Set attributes on an ELB.
CLI example to set attributes on an ELB:
.. code-block:: bash
salt myminion boto_elb.set_health_check myelb '{"target": "HTTP:80/"}'
'''
conn =... |
Register instances with an ELB. Instances is either a string
instance id or a list of string instance id's.
Returns:
- ``True``: instance(s) registered successfully
- ``False``: instance(s) failed to be registered
CLI example:
.. code-block:: bash
salt myminion boto_elb.register_in... | def register_instances(name, instances, region=None, key=None, keyid=None,
profile=None):
'''
Register instances with an ELB. Instances is either a string
instance id or a list of string instance id's.
Returns:
- ``True``: instance(s) registered successfully
- ``False``... |
Deregister instances with an ELB. Instances is either a string
instance id or a list of string instance id's.
Returns:
- ``True``: instance(s) deregistered successfully
- ``False``: instance(s) failed to be deregistered
- ``None``: instance(s) not valid or not registered, no action taken
CLI... | def deregister_instances(name, instances, region=None, key=None, keyid=None,
profile=None):
'''
Deregister instances with an ELB. Instances is either a string
instance id or a list of string instance id's.
Returns:
- ``True``: instance(s) deregistered successfully
- `... |
Set the instances assigned to an ELB to exactly the list given
CLI example:
.. code-block:: bash
salt myminion boto_elb.set_instances myelb region=us-east-1 instances="[instance_id,instance_id]" | def set_instances(name, instances, test=False, region=None, key=None, keyid=None,
profile=None):
'''
Set the instances assigned to an ELB to exactly the list given
CLI example:
.. code-block:: bash
salt myminion boto_elb.set_instances myelb region=us-east-1 instances=... |
Get a list of instances and their health state
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_instance_health myelb
salt myminion boto_elb.get_instance_health myelb region=us-east-1 instances="[instance_id,instance_id]" | def get_instance_health(name, region=None, key=None, keyid=None, profile=None, instances=None):
'''
Get a list of instances and their health state
CLI example:
.. code-block:: bash
salt myminion boto_elb.get_instance_health myelb
salt myminion boto_elb.get_instance_health myelb region... |
Create an ELB policy.
.. versionadded:: 2016.3.0
CLI example:
.. code-block:: bash
salt myminion boto_elb.create_policy myelb mypolicy LBCookieStickinessPolicyType '{"CookieExpirationPeriod": 3600}' | def create_policy(name, policy_name, policy_type, policy, region=None,
key=None, keyid=None, profile=None):
'''
Create an ELB policy.
.. versionadded:: 2016.3.0
CLI example:
.. code-block:: bash
salt myminion boto_elb.create_policy myelb mypolicy LBCookieStickinessPolic... |
Delete an ELB policy.
.. versionadded:: 2016.3.0
CLI example:
.. code-block:: bash
salt myminion boto_elb.delete_policy myelb mypolicy | def delete_policy(name, policy_name, region=None, key=None, keyid=None,
profile=None):
'''
Delete an ELB policy.
.. versionadded:: 2016.3.0
CLI example:
.. code-block:: bash
salt myminion boto_elb.delete_policy myelb mypolicy
'''
conn = _get_conn(region=region, ... |
Set the policies of an ELB listener.
.. versionadded:: 2016.3.0
CLI example:
.. code-block:: Bash
salt myminion boto_elb.set_listener_policy myelb 443 "[policy1,policy2]" | def set_listener_policy(name, port, policies=None, region=None, key=None,
keyid=None, profile=None):
'''
Set the policies of an ELB listener.
.. versionadded:: 2016.3.0
CLI example:
.. code-block:: Bash
salt myminion boto_elb.set_listener_policy myelb 443 "[policy... |
Add the tags on an ELB
.. versionadded:: 2016.3.0
name
name of the ELB
tags
dict of name/value pair tags
CLI Example:
.. code-block:: bash
salt myminion boto_elb.set_tags my-elb-name "{'Tag1': 'Value', 'Tag2': 'Another Value'}" | def set_tags(name, tags, region=None, key=None, keyid=None, profile=None):
'''
Add the tags on an ELB
.. versionadded:: 2016.3.0
name
name of the ELB
tags
dict of name/value pair tags
CLI Example:
.. code-block:: bash
salt myminion boto_elb.set_tags my-elb-name ... |
Add the tags on an ELB
name
name of the ELB
tags
list of tags to remove
CLI Example:
.. code-block:: bash
salt myminion boto_elb.delete_tags my-elb-name ['TagToRemove1', 'TagToRemove2'] | def delete_tags(name, tags, region=None, key=None, keyid=None, profile=None):
'''
Add the tags on an ELB
name
name of the ELB
tags
list of tags to remove
CLI Example:
.. code-block:: bash
salt myminion boto_elb.delete_tags my-elb-name ['TagToRemove1', 'TagToRemove2']... |
helper function to build a tag parameter list to send | def _build_tag_param_list(params, tags):
'''
helper function to build a tag parameter list to send
'''
keys = sorted(tags.keys())
i = 1
for key in keys:
value = tags[key]
params['Tags.member.{0}.Key'.format(i)] = key
if value is not None:
params['Tags.member.{... |
Retrieve all the metadata tags associated with your ELB(s).
:type load_balancer_names: list
:param load_balancer_names: An optional list of load balancer names.
:rtype: list
:return: A list of :class:`boto.ec2.elb.tag.Tag` objects | def _get_all_tags(conn, load_balancer_names=None):
'''
Retrieve all the metadata tags associated with your ELB(s).
:type load_balancer_names: list
:param load_balancer_names: An optional list of load balancer names.
:rtype: list
:return: A list of :class:`boto.ec2.elb.tag.Tag` objects
'''
... |
Create new metadata tags for the specified resource ids.
:type load_balancer_names: list
:param load_balancer_names: A list of load balancer names.
:type tags: dict
:param tags: A dictionary containing the name/value pairs.
If you want to create only a tag name, the
v... | def _add_tags(conn, load_balancer_names, tags):
'''
Create new metadata tags for the specified resource ids.
:type load_balancer_names: list
:param load_balancer_names: A list of load balancer names.
:type tags: dict
:param tags: A dictionary containing the name/value pairs.
I... |
Delete metadata tags for the specified resource ids.
:type load_balancer_names: list
:param load_balancer_names: A list of load balancer names.
:type tags: list
:param tags: A list containing just tag names for the tags to be
deleted. | def _remove_tags(conn, load_balancer_names, tags):
'''
Delete metadata tags for the specified resource ids.
:type load_balancer_names: list
:param load_balancer_names: A list of load balancer names.
:type tags: list
:param tags: A list containing just tag names for the tags to be
... |
Repack packages specified using "pkgs" argument to pkg states into a single
dictionary | def _repack_pkgs(pkgs, normalize=True):
'''
Repack packages specified using "pkgs" argument to pkg states into a single
dictionary
'''
if normalize and 'pkg.normalize_name' in __salt__:
_normalize_name = __salt__['pkg.normalize_name']
else:
_normalize_name = lambda pkgname: pkgna... |
Accepts list of dicts (or a string representing a list of dicts) and packs
the key/value pairs into a single dict.
``'[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'`` would become
``{"foo": "salt://foo.rpm", "bar": "salt://bar.rpm"}``
normalize : True
Normalize the package name by rem... | def pack_sources(sources, normalize=True):
'''
Accepts list of dicts (or a string representing a list of dicts) and packs
the key/value pairs into a single dict.
``'[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'`` would become
``{"foo": "salt://foo.rpm", "bar": "salt://bar.rpm"}``
nor... |
Parses the input to pkg.install and returns back the package(s) to be
installed. Returns a list of packages, as well as a string noting whether
the packages are to come from a repository or a binary package.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.parse_targets | def parse_targets(name=None,
pkgs=None,
sources=None,
saltenv='base',
normalize=True,
**kwargs):
'''
Parses the input to pkg.install and returns back the package(s) to be
installed. Returns a list of packages, as well ... |
Common interface for obtaining the version of installed packages.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.version vim
salt '*' pkg_resource.version foo bar baz
salt '*' pkg_resource.version 'python*' | def version(*names, **kwargs):
'''
Common interface for obtaining the version of installed packages.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.version vim
salt '*' pkg_resource.version foo bar baz
salt '*' pkg_resource.version 'python*'
'''
ret = {}
v... |
Add a package to a dict of installed packages.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.add_pkg '{}' bind 9 | def add_pkg(pkgs, name, pkgver):
'''
Add a package to a dict of installed packages.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.add_pkg '{}' bind 9
'''
try:
pkgs.setdefault(name, []).append(pkgver)
except AttributeError as exc:
log.exception(exc) |
Accepts a dict obtained from pkg.list_pkgs() and sorts in place the list of
versions for any packages that have multiple versions installed, so that
two package lists can be compared to one another.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.sort_pkglist '["3.45", "2.13"]' | def sort_pkglist(pkgs):
'''
Accepts a dict obtained from pkg.list_pkgs() and sorts in place the list of
versions for any packages that have multiple versions installed, so that
two package lists can be compared to one another.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.so... |
Takes a dict of package name/version information and joins each list of
installed versions into a string.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.stringify 'vim: 7.127' | def stringify(pkgs):
'''
Takes a dict of package name/version information and joins each list of
installed versions into a string.
CLI Example:
.. code-block:: bash
salt '*' pkg_resource.stringify 'vim: 7.127'
'''
try:
for key in pkgs:
pkgs[key] = ','.join(pkgs... |
Formats packages according to parameters for list_pkgs. | def format_pkg_list(packages, versions_as_list, attr):
'''
Formats packages according to parameters for list_pkgs.
'''
ret = copy.deepcopy(packages)
if attr:
requested_attr = {'epoch', 'version', 'release', 'arch', 'install_date', 'install_date_time_t'}
if attr != 'all':
... |
Formats a version string for list_pkgs. | def format_version(epoch, version, release):
'''
Formats a version string for list_pkgs.
'''
full_version = '{0}:{1}'.format(epoch, version) if epoch else version
if release:
full_version += '-{0}'.format(release)
return full_version |
Force var to be a set | def _make_set(var):
'''
Force var to be a set
'''
if var is None:
return set()
if not isinstance(var, list):
if isinstance(var, six.string_types):
var = var.split()
else:
var = list(var)
return set(var) |
Verify that the variable is in the ``make.conf`` and has the provided
settings. If value is set, contains and excludes will be ignored.
name
The variable name. This will automatically be converted to upper
case since variables in ``make.conf`` are in upper case
value
Enforce that t... | def present(name, value=None, contains=None, excludes=None):
'''
Verify that the variable is in the ``make.conf`` and has the provided
settings. If value is set, contains and excludes will be ignored.
name
The variable name. This will automatically be converted to upper
case since varia... |
Verify that the variable is not in the ``make.conf``.
name
The variable name. This will automatically be converted to upper
case since variables in ``make.conf`` are in upper case | def absent(name):
'''
Verify that the variable is not in the ``make.conf``.
name
The variable name. This will automatically be converted to upper
case since variables in ``make.conf`` are in upper case
'''
ret = {'changes': {},
'comment': '',
'name': name,
... |
Return information for the specified user
CLI Example:
.. code-block:: bash
salt '*' shadow.info root | def info(name):
'''
Return information for the specified user
CLI Example:
.. code-block:: bash
salt '*' shadow.info root
'''
if HAS_SPWD:
try:
data = spwd.getspnam(name)
ret = {
'name': data.sp_nam,
'passwd': data.sp_pwd... |
Set the maximum number of days during which a password is valid. See man
passwd.
CLI Example:
.. code-block:: bash
salt '*' shadow.set_maxdays username 90 | def set_maxdays(name, maxdays):
'''
Set the maximum number of days during which a password is valid. See man
passwd.
CLI Example:
.. code-block:: bash
salt '*' shadow.set_maxdays username 90
'''
pre_info = info(name)
if maxdays == pre_info['max']:
return True
cmd =... |
Set the minimum number of days between password changes. See man passwd.
CLI Example:
.. code-block:: bash
salt '*' shadow.set_mindays username 7 | def set_mindays(name, mindays):
'''
Set the minimum number of days between password changes. See man passwd.
CLI Example:
.. code-block:: bash
salt '*' shadow.set_mindays username 7
'''
pre_info = info(name)
if mindays == pre_info['min']:
return True
cmd = 'passwd -n {... |
.. versionadded:: 2015.8.8
Delete the password from name user
CLI Example:
.. code-block:: bash
salt '*' shadow.del_password username | def del_password(name):
'''
.. versionadded:: 2015.8.8
Delete the password from name user
CLI Example:
.. code-block:: bash
salt '*' shadow.del_password username
'''
cmd = 'passwd -d {0}'.format(name)
__salt__['cmd.run'](cmd, python_shell=False, output_loglevel='quiet')
u... |
Set the password for a named user. The password must be a properly defined
hash, the password hash can be generated with this command:
``openssl passwd -1 <plaintext password>``
CLI Example:
.. code-block:: bash
salt '*' shadow.set_password root $1$UYCIxa628.9qXjpQCjM4a.. | def set_password(name, password):
'''
Set the password for a named user. The password must be a properly defined
hash, the password hash can be generated with this command:
``openssl passwd -1 <plaintext password>``
CLI Example:
.. code-block:: bash
salt '*' shadow.set_password root $... |
Set the number of days of warning before a password change is required.
See man passwd.
CLI Example:
.. code-block:: bash
salt '*' shadow.set_warndays username 7 | def set_warndays(name, warndays):
'''
Set the number of days of warning before a password change is required.
See man passwd.
CLI Example:
.. code-block:: bash
salt '*' shadow.set_warndays username 7
'''
pre_info = info(name)
if warndays == pre_info['warn']:
return Tru... |
Checkout the ext_pillar sources and compile the resulting pillar SLS | def ext_pillar(minion_id, pillar, *repos): # pylint: disable=unused-argument
'''
Checkout the ext_pillar sources and compile the resulting pillar SLS
'''
opts = copy.deepcopy(__opts__)
opts['pillar_roots'] = {}
opts['__git_pillar'] = True
git_pillar = salt.utils.gitfs.GitPillar(
opt... |
Helper function to execute the command
:param str cmd: the command to run
:param str at_time: If passed, the cmd will be scheduled.
Returns: bool | def _execute_command(cmd, at_time=None):
'''
Helper function to execute the command
:param str cmd: the command to run
:param str at_time: If passed, the cmd will be scheduled.
Returns: bool
'''
if at_time:
cmd = 'echo \'{0}\' | at {1}'.format(cmd, _cmd_quote(at_time))
return ... |
Set the remote login (SSH) to either on or off.
:param bool enable: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if successful, False if not
:rtype: bool
CLI Exampl... | def set_remote_login(enable):
'''
Set the remote login (SSH) to either on or off.
:param bool enable: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if successful, Fal... |
Set whether the server responds to events sent by other computers (such as
AppleScripts)
:param bool enable: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if successful, ... | def set_remote_events(enable):
'''
Set whether the server responds to events sent by other computers (such as
AppleScripts)
:param bool enable: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False resp... |
Set the computer name
:param str name: The new computer name
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' system.set_computer_name "Mike's Mac" | def set_computer_name(name):
'''
Set the computer name
:param str name: The new computer name
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' system.set_computer_name "Mike's Mac"
'''
cmd = 'systemsetup -setcomputername "... |
Set the local subnet name
:param str name: The new local subnet name
.. note::
Spaces are changed to dashes. Other special characters are removed.
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
The following will be set as 'Mikes-Mac... | def set_subnet_name(name):
'''
Set the local subnet name
:param str name: The new local subnet name
.. note::
Spaces are changed to dashes. Other special characters are removed.
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
... |
Set the current startup disk to the indicated path. Use
``system.list_startup_disks`` to find valid startup disks on the system.
:param str path: The valid startup disk path
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-block:: bash
salt '*' system.set_... | def set_startup_disk(path):
'''
Set the current startup disk to the indicated path. Use
``system.list_startup_disks`` to find valid startup disks on the system.
:param str path: The valid startup disk path
:return: True if successful, False if not
:rtype: bool
CLI Example:
.. code-bl... |
Set the number of seconds after which the computer will start up after a
power failure.
.. warning::
This command fails with the following error:
``Error, IOServiceOpen returned 0x10000003``
The setting is not updated. This is an apple bug. It seems like it may
only work on c... | def set_restart_delay(seconds):
'''
Set the number of seconds after which the computer will start up after a
power failure.
.. warning::
This command fails with the following error:
``Error, IOServiceOpen returned 0x10000003``
The setting is not updated. This is an apple bug.... |
Get whether or not the keyboard should be disabled when the X Serve
enclosure lock is engaged.
:param bool enable: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
True and False respectively
:return: True if succes... | def set_disable_keyboard_on_lock(enable):
'''
Get whether or not the keyboard should be disabled when the X Serve
enclosure lock is engaged.
:param bool enable: True to enable, False to disable. "On" and "Off" are
also acceptable values. Additionally you can pass 1 and 0 to represent
Tr... |
Set the kernel to boot in 32 or 64 bit mode on next boot.
.. note::
When this function fails with the error ``changes to kernel
architecture failed to save!``, then the boot arch is not updated.
This is either an Apple bug, not available on the test system, or a
result of system fil... | def set_boot_arch(arch='default'):
'''
Set the kernel to boot in 32 or 64 bit mode on next boot.
.. note::
When this function fails with the error ``changes to kernel
architecture failed to save!``, then the boot arch is not updated.
This is either an Apple bug, not available on the... |
Create target group if not present.
name
(string) - The name of the target group.
protocol
(string) - The protocol to use for routing traffic to the targets
port
(int) - The port on which the targets receive traffic. This port is used unless
you specify a port override when ... | def create_target_group(name,
protocol,
port,
vpc_id,
region=None,
key=None,
keyid=None,
profile=None,
health_check_protocol='HT... |
Delete target group.
name
(string) - Target Group Name or Amazon Resource Name (ARN).
returns
(bool) - True on success, False on failure.
CLI example:
.. code-block:: bash
salt myminion boto_elbv2.delete_target_group arn:aws:elasticloadbalancing:us-west-2:644138682826:target... | def delete_target_group(name,
region=None,
key=None,
keyid=None,
profile=None):
'''
Delete target group.
name
(string) - Target Group Name or Amazon Resource Name (ARN).
returns
(bool) - Tru... |
Check to see if an target group exists.
CLI example:
.. code-block:: bash
salt myminion boto_elbv2.target_group_exists arn:aws:elasticloadbalancing:us-west-2:644138682826:targetgroup/learn1give1-api/414788a16b5cf163 | def target_group_exists(name,
region=None,
key=None,
keyid=None,
profile=None):
'''
Check to see if an target group exists.
CLI example:
.. code-block:: bash
salt myminion boto_elbv2.target_group_e... |
Get the curret health check status for targets in a target group.
CLI example:
.. code-block:: bash
salt myminion boto_elbv2.describe_target_health arn:aws:elasticloadbalancing:us-west-2:644138682826:targetgroup/learn1give1-api/414788a16b5cf163 targets=["i-isdf23ifjf"] | def describe_target_health(name,
targets=None,
region=None,
key=None,
keyid=None,
profile=None):
'''
Get the curret health check status for targets in a target group.
CLI e... |
Register targets to a target froup of an ALB. ``targets`` is either a
instance id string or a list of instance id's.
Returns:
- ``True``: instance(s) registered successfully
- ``False``: instance(s) failed to be registered
CLI example:
.. code-block:: bash
salt myminion boto_elbv2.r... | def register_targets(name,
targets,
region=None,
key=None,
keyid=None,
profile=None):
'''
Register targets to a target froup of an ALB. ``targets`` is either a
instance id string or a list of instance id... |
Describes the specified load balancer or all of your load balancers.
Returns: list
CLI example:
.. code-block:: bash
salt myminion boto_elbv2.describe_load_balancers
salt myminion boto_elbv2.describe_load_balancers alb_name
salt myminion boto_elbv2.describe_load_balancers "[alb_n... | def describe_load_balancers(names=None,
load_balancer_arns=None,
region=None,
key=None,
keyid=None,
profile=None):
'''
Describes the specified load balancer or all of your ... |
Describes the specified target groups or all of your target groups. By default,
all target groups are described. Alternatively, you can specify one of the
following to filter the results: the ARN of the load balancer, the names of
one or more target groups, or the ARNs of one or more target groups.
Ret... | def describe_target_groups(names=None,
target_group_arns=None,
load_balancer_arn=None,
region=None,
key=None,
keyid=None,
profile=None):
'''
Describes... |
Retrives a parameter from SSM Parameter Store
.. versionadded:: Neon
.. code-block:: text
salt-call boto_ssm.get_parameter test-param withdescription=True | def get_parameter(name, withdecryption=False, resp_json=False, region=None, key=None, keyid=None, profile=None):
'''
Retrives a parameter from SSM Parameter Store
.. versionadded:: Neon
.. code-block:: text
salt-call boto_ssm.get_parameter test-param withdescription=True
'''
conn = __... |
Sets a parameter in the SSM parameter store
.. versionadded:: Neon
.. code-block:: text
salt-call boto_ssm.put_parameter test-param test_value Type=SecureString KeyId=alias/aws/ssm Description='test encrypted key' | def put_parameter(Name,
Value,
Description=None,
Type='String',
KeyId=None,
Overwrite=False,
AllowedPattern=None,
region=None,
key=None,
keyid=None,
... |
Removes a parameter from the SSM parameter store
.. versionadded:: Neon
.. code-block:: text
salt-call boto_ssm.delete_parameter test-param | def delete_parameter(Name, region=None, key=None, keyid=None, profile=None):
'''
Removes a parameter from the SSM parameter store
.. versionadded:: Neon
.. code-block:: text
salt-call boto_ssm.delete_parameter test-param
'''
conn = __utils__['boto3.get_connection']('ssm', region=region... |
Encode a string as base64 using the "modern" Python interface.
Among other possible differences, the "modern" encoder does not include
newline ('\\n') characters in the encoded output. | def base64_b64encode(instr):
'''
Encode a string as base64 using the "modern" Python interface.
Among other possible differences, the "modern" encoder does not include
newline ('\\n') characters in the encoded output.
'''
return salt.utils.stringutils.to_unicode(
base64.b64encode(salt.u... |
Decode a base64-encoded string using the "modern" Python interface. | def base64_b64decode(instr):
'''
Decode a base64-encoded string using the "modern" Python interface.
'''
decoded = base64.b64decode(salt.utils.stringutils.to_bytes(instr))
try:
return salt.utils.stringutils.to_unicode(
decoded,
encoding='utf8' if salt.utils.platform.i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.