text
stringlengths
81
112k
Sets the time at which the password expires (in seconds since the UNIX epoch). See ``man 8 usermod`` on NetBSD and OpenBSD or ``man 8 pw`` on FreeBSD. A value of ``0`` sets the password to never expire. CLI Example: .. code-block:: bash salt '*' shadow.set_change username 1419980400 def...
Sets the time at which the account expires (in seconds since the UNIX epoch). See ``man 8 usermod`` on NetBSD and OpenBSD or ``man 8 pw`` on FreeBSD. A value of ``0`` sets the account to never expire. CLI Example: .. code-block:: bash salt '*' shadow.set_expire username 1419980400 def s...
Set the password for a named user. The password must be a properly defined hash. The password hash can be generated with this command: ``python -c "import crypt; print crypt.crypt('password', ciphersalt)"`` .. note:: When constructing the ``ciphersalt`` string, you must escape any dollar s...
Check the token, returns a 401 if the token is invalid. Else open the websocket connection def get(self, token): ''' Check the token, returns a 401 if the token is invalid. Else open the websocket connection ''' log.debug('In the websocket get method') self.toke...
Listens for a "websocket client ready" message. Once that message is received an asynchronous job is stated that yields messages to the client. These messages make up salt's "real time" event stream. def on_message(self, message): """Listens for a "websocket client ready" messag...
If cors is enabled, check that the origin is allowed def check_origin(self, origin): """ If cors is enabled, check that the origin is allowed """ mod_opts = self.application.mod_opts if mod_opts.get('cors_origin'): return bool(_check_cors_origin(origin, mod_opts['c...
Listens for a "websocket client ready" message. Once that message is received an asynchronous job is stated that yields messages to the client. These messages make up salt's "real time" event stream. def on_message(self, message): """Listens for a "websocket client ready" messag...
Return supervisorctl command to call, either from a virtualenv, an argument passed in, or from the global modules options def _get_supervisorctl_bin(bin_env): ''' Return supervisorctl command to call, either from a virtualenv, an argument passed in, or from the global modules options ''' cmd = ...
Return the command list to use def _ctl_cmd(cmd, name, conf_file, bin_env): ''' Return the command list to use ''' ret = [_get_supervisorctl_bin(bin_env)] if conf_file is not None: ret += ['-c', conf_file] ret.append(cmd) if name: ret.append(name) return ret
Start the named service. Process group names should not include a trailing asterisk. user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed CLI Example: .. co...
Reload the daemon's configuration files user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed CLI Example: .. code-block:: bash salt '*' supervisord.rer...
Reload config and add/remove/update as necessary user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed name name of the process group to update. if none then u...
List programs and its state user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed CLI Example: .. code-block:: bash salt '*' supervisord.status def sta...
Display the raw output of status user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed CLI Example: .. code-block:: bash salt '*' supervisord.status_raw...
Run any custom supervisord command user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed CLI Example: .. code-block:: bash salt '*' supervisord.custom "...
Reads the config file using configparser def _read_config(conf_file=None): ''' Reads the config file using configparser ''' if conf_file is None: paths = ('/etc/supervisor/supervisord.conf', '/etc/supervisord.conf') for path in paths: if os.path.exists(path): ...
.. versionadded:: 2014.1.0 Read the config file and return the config options for a given process name Name of the configured process conf_file path to supervisord config file CLI Example: .. code-block:: bash salt '*' supervisord.options foo def options(name, conf_file...
Add a log to the logadm configuration name : string alias for entryname kwargs : boolean|string|int optional additional flags and parameters def rotate(name, **kwargs): ''' Add a log to the logadm configuration name : string alias for entryname kwargs : boolean|strin...
Remove a log from the logadm configuration name : string entryname log_file : string (optional) log file path .. note:: If log_file is specified it will be used instead of the entry name. def remove(name, log_file=None): ''' Remove a log from the logadm configuration ...
Add a new inbound or outbound rule to the firewall policy Args: name (str): The name of the rule. Must be unique and cannot be "all". Required. localport (int): The port the rule applies to. Must be a number between 0 and 65535. Can be a range. Can specify multiple ports s...
Delete an existing firewall rule identified by name and optionally by ports, protocols, direction, and remote IP. .. versionadded:: Neon Args: name (str): The name of the rule to delete. If the name ``all`` is used you must specify additional parameters. localport (Optional[s...
Enable all the firewall profiles (Windows only) Args: profile (Optional[str]): The name of the profile to enable. Default is ``allprofiles``. Valid options are: - allprofiles - domainprofile - privateprofile - publicprofile Example: .. ...
Send a message to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param message: The message to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param...
Send an event to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param event: The event to send to the Mattermost channel. :param api_url: The Mattermost api url, if not specified in the configuration. :param ho...
Return the value of key at path in vault, or entire secret Jinja Example: .. code-block:: jinja my-secret: {{ salt['vault'].read_secret('secret/my/secret', 'some-key') }} .. code-block:: jinja {% set supersecret = salt['vault'].read_secret('secret/my/secret') %} secrets: ...
Set secret at the path in vault. The vault policy used must allow this. CLI Example: .. code-block:: bash salt '*' vault.write_secret "secret/my/secret" user="foo" password="bar" def write_secret(path, **kwargs): ''' Set secret at the path in vault. The vault policy used must allow this....
Set raw data at the path in vault. The vault policy used must allow this. CLI Example: .. code-block:: bash salt '*' vault.write_raw "secret/my/secret" '{"user":"foo","password": "bar"}' def write_raw(path, raw): ''' Set raw data at the path in vault. The vault policy used must allow thi...
Verify that the raid is present .. versionchanged:: 2014.7.0 name The name of raid device to be created level The RAID level to use when creating the raid. devices A list of devices used to build the array. kwargs Optional arguments to be passed to mdadm....
Accepts HJSON as a string or as a file object and runs it through the HJSON parser. :rtype: A Python data structure def render(hjson_data, saltenv='base', sls='', **kws): ''' Accepts HJSON as a string or as a file object and runs it through the HJSON parser. :rtype: A Python data structure ...
Ensure function exists. name The name of the state definition FunctionName Name of the Function. Runtime The Runtime environment for the function. One of 'nodejs', 'java8', or 'python2.7' Role The name or ARN of the IAM role that the function assumes when it e...
Ensure alias exists. name The name of the state definition. FunctionName Name of the function for which you want to create an alias. Name The name of the alias to be created. FunctionVersion Function version for which you are creating the alias. Description ...
Ensure event source mapping exists. name The name of the state definition. EventSourceArn The Amazon Resource Name (ARN) of the Amazon Kinesis or the Amazon DynamoDB stream that is the event source. FunctionName The Lambda function to invoke when AWS Lambda detects an even...
Ensure event source mapping with passed properties is absent. name The name of the state definition. EventSourceArn ARN of the event source. FunctionName Name of the lambda function. region Region to connect to. key Secret key to be used. keyid ...
Return a list of load balancers. :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_balancers method :type libcloud_kwargs: ``dict`` CLI Example: .. code-block:: bash salt myminion libcloud_storage.list_balancers pr...
Return a list of supported protocols. :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_protocols method :type libcloud_kwargs: ``dict`` :return: a list of supported protocols :rtype: ``list`` of ``str`` CLI Example: ...
Create a new load balancer instance :param name: Name of the new load balancer (required) :type name: ``str`` :param port: Port the load balancer should listen on, defaults to 80 :type port: ``str`` :param protocol: Loadbalancer protocol, defaults to http. :type protocol: ``str`` :par...
Destroy a load balancer :param balancer_id: LoadBalancer ID which should be used :type balancer_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's destroy_balancer method :type libcloud_kwargs: ``dict`` :return: ...
Get the details for a load balancer by name :param name: Name of a load balancer you want to fetch :type name: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_balancers method :type libcloud_kwargs: ``dict`` ...
Add a new member to the load balancer :param balancer_id: id of a load balancer you want to fetch :type balancer_id: ``str`` :param ip: IP address for the new member :type ip: ``str`` :param port: Port for the new member :type port: ``int`` :param profile: The profile key :type p...
Add a new member to the load balancer :param balancer_id: id of a load balancer you want to fetch :type balancer_id: ``str`` :param ip: IP address for the new member :type ip: ``str`` :param port: Port for the new member :type port: ``int`` :param profile: The profile key :type p...
List the members of a load balancer :param balancer_id: id of a load balancer you want to fetch :type balancer_id: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_balancer_members method :type libcloud_kwargs: ``d...
Call an extended method on the driver :param method: Driver's method name :type method: ``str`` :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's method :type libcloud_kwargs: ``dict`` CLI Example: .. code-block:: bash...
Install new alternative for defined <name> name is the master name for this link group (e.g. pager) link is the symlink pointing to /etc/alternatives/<name>. (e.g. /usr/bin/pager) path is the location of the new alternative target. NB: This file / directory...
Removes installed alternative for defined <name> and <path> or fallback to default alternative, if some defined before. name is the master name for this link group (e.g. pager) path is the location of one of the alternative target files. (e.g. /usr/bin/less) def remove(nam...
.. versionadded:: 0.17.0 Instruct alternatives to use the highest priority path for <name> name is the master name for this link group (e.g. pager) def auto(name): ''' .. versionadded:: 0.17.0 Instruct alternatives to use the highest priority path for <name> name ...
.. versionadded:: 0.17.0 Sets alternative for <name> to <path>, if <path> is defined as an alternative for <name>. name is the master name for this link group (e.g. pager) path is the location of one of the alternative target files. (e.g. /usr/bin/less) .. code-bl...
Ensure that a data source is present. name Name of the data source. type Type of the datasource ('graphite', 'influxdb' etc.). access Use proxy or direct. Default: proxy url The URL to the data source API. user Optional - user to authenticate with the dat...
Ensure that a data source is present. name Name of the data source to remove. orgname Name of the organization from which the data source should be absent. profile Configuration profile used to connect to the Grafana instance. Default is 'grafana'. def absent(name, orgnam...
Return the primary name associate with the load, if an empty string is returned then the load does not match the function def load_name(self, load): ''' Return the primary name associate with the load, if an empty string is returned then the load does not match the function ''' ...
Return the token and set the cache data for use Do not call this directly! Use the time_auth method to overcome timing attacks def __auth_call(self, load): ''' Return the token and set the cache data for use Do not call this directly! Use the time_auth method to overcome timin...
Make sure that all failures happen in the same amount of time def time_auth(self, load): ''' Make sure that all failures happen in the same amount of time ''' start = time.time() ret = self.__auth_call(load) if ret: return ret f_time = time.time() - s...
Returns ACL for a specific user. Returns None if eauth doesn't provide any for the user. I. e. None means: use acl declared in master config. def __get_acl(self, load): ''' Returns ACL for a specific user. Returns None if eauth doesn't provide any for the user. I. e. None means:...
Allows eauth module to modify the access list right before it'll be applied to the request. For example ldap auth module expands entries def __process_acl(self, load, auth_list): ''' Allows eauth module to modify the access list right before it'll be applied to the request. For example ...
Read in a load and return the groups a user is a member of by asking the appropriate provider def get_groups(self, load): ''' Read in a load and return the groups a user is a member of by asking the appropriate provider ''' if 'eauth' not in load: return Fals...
Return bool if requesting user is allowed to set custom expire def _allow_custom_expire(self, load): ''' Return bool if requesting user is allowed to set custom expire ''' expire_override = self.opts.get('token_expire_user_override', False) if expire_override is True: ...
Run time_auth and create a token. Return False or the token def mk_token(self, load): ''' Run time_auth and create a token. Return False or the token ''' if not self.authenticate_eauth(load): return {} if self._allow_custom_expire(load): token_expire = l...
Return the name associated with the token, or False if the token is not valid def get_tok(self, tok): ''' Return the name associated with the token, or False if the token is not valid ''' tdata = self.tokens["{0}.get_token".format(self.opts['eauth_tokens'])](self.opts, t...
Remove the given token from token storage. def rm_token(self, tok): ''' Remove the given token from token storage. ''' self.tokens["{0}.rm_token".format(self.opts['eauth_tokens'])](self.opts, tok)
Authenticate a user by the token specified in load. Return the token object or False if auth failed. def authenticate_token(self, load): ''' Authenticate a user by the token specified in load. Return the token object or False if auth failed. ''' token = self.get_tok(load...
Authenticate a user by the external auth module specified in load. Return True on success or False on failure. def authenticate_eauth(self, load): ''' Authenticate a user by the external auth module specified in load. Return True on success or False on failure. ''' if 'e...
Authenticate a user by the key passed in load. Return the effective user id (name) if it's different from the specified one (for sudo). If the effective user id is the same as the passed one, return True on success or False on failure. def authenticate_key(self, load, key): ''' ...
Retrieve access list for the user specified in load. The list is built by eauth module or from master eauth configuration. Return None if current configuration doesn't provide any ACL for the user. Return an empty list if the user has no rights to execute anything on this master and returns non-...
.. versionadded:: 2018.3.0 Go through various checks to see if the token/eauth/user can be authenticated. Returns a dictionary containing the following keys: - auth_list - username - error If an error is encountered, return immediately with the relevant error dictiona...
Gather and create the authorization data sets We're looking at several constructs here. Standard eauth: allow jsmith to auth via pam, and execute any command on server web1 external_auth: pam: jsmith: - web1: - .* Django eaut...
Determine if token auth is valid and yield the adata def token(self, adata, load): ''' Determine if token auth is valid and yield the adata ''' try: token = self.loadauth.get_tok(load['token']) except Exception as exc: log.error('Exception occurred when g...
Determine if the given eauth is valid and yield the adata def eauth(self, adata, load): ''' Determine if the given eauth is valid and yield the adata ''' for sub_auth in [adata]: if load['eauth'] not in sub_auth: continue try: name...
Read in the access system to determine if the validated user has requested rights def rights_check(self, form, sub_auth, name, load, eauth=None): ''' Read in the access system to determine if the validated user has requested rights ''' if load.get('eauth'): s...
Determine what type of authentication is being requested and pass authorization Note: this will check that the user has at least one right that will let the user execute "load", this does not deal with conflicting rules def rights(self, form, load): ''' Determine what type of a...
Execute the CLI options to fill in the extra data needed for the defined eauth system def cli(self, eauth): ''' Execute the CLI options to fill in the extra data needed for the defined eauth system ''' ret = {} if not eauth: print('External authentica...
Create the token from the CLI and request the correct data to authenticate via the passed authentication mechanism def token_cli(self, eauth, load): ''' Create the token from the CLI and request the correct data to authenticate via the passed authentication mechanism ''' ...
Request a token from the master def get_token(self, token): ''' Request a token from the master ''' load = {} load['token'] = token load['cmd'] = 'get_token' tdata = self._send_token_request(load) return tdata
Returns a list of the requester's topics CLI example:: salt myminion boto3_sns.list_topics def list_topics(region=None, key=None, keyid=None, profile=None): ''' Returns a list of the requester's topics CLI example:: salt myminion boto3_sns.list_topics ''' conn = _get_conn(re...
Returns details about a specific SNS topic, specified by name or ARN. CLI example:: salt my_favorite_client boto3_sns.describe_topic a_sns_topic_of_my_choice def describe_topic(name, region=None, key=None, keyid=None, profile=None): ''' Returns details about a specific SNS topic, specified by nam...
Check to see if an SNS topic exists. CLI example:: salt myminion boto3_sns.topic_exists mytopic region=us-east-1 def topic_exists(name, region=None, key=None, keyid=None, profile=None): ''' Check to see if an SNS topic exists. CLI example:: salt myminion boto3_sns.topic_exists mytop...
Create an SNS topic. CLI example:: salt myminion boto3_sns.create_topic mytopic region=us-east-1 def create_topic(Name, region=None, key=None, keyid=None, profile=None): ''' Create an SNS topic. CLI example:: salt myminion boto3_sns.create_topic mytopic region=us-east-1 ''' ...
Delete an SNS topic. CLI example:: salt myminion boto3_sns.delete_topic mytopic region=us-east-1 def delete_topic(TopicArn, region=None, key=None, keyid=None, profile=None): ''' Delete an SNS topic. CLI example:: salt myminion boto3_sns.delete_topic mytopic region=us-east-1 ''' ...
Returns all of the properties of a topic. Topic properties returned might differ based on the authorization of the user. CLI example:: salt myminion boto3_sns.get_topic_attributes someTopic region=us-west-1 def get_topic_attributes(TopicArn, region=None, key=None, keyid=None, profile=None): ''' ...
Set an attribute of a topic to a new value. CLI example:: salt myminion boto3_sns.set_topic_attributes someTopic DisplayName myDisplayNameValue def set_topic_attributes(TopicArn, AttributeName, AttributeValue, region=None, key=None, keyid=None, profile=None): ''' Set an a...
Returns a list of the subscriptions to a specific topic CLI example:: salt myminion boto3_sns.list_subscriptions_by_topic mytopic region=us-east-1 def list_subscriptions_by_topic(TopicArn, region=None, key=None, keyid=None, profile=None): ''' Returns a list of the subscriptions to a specific topi...
Returns all of the properties of a subscription. CLI example:: salt myminion boto3_sns.get_subscription_attributes somesubscription region=us-west-1 def get_subscription_attributes(SubscriptionArn, region=None, key=None, keyid=None, profile=None): ''' Returns all of the properties of a subscripti...
Subscribe to a Topic. CLI example:: salt myminion boto3_sns.subscribe mytopic https https://www.example.com/sns-endpoint def subscribe(TopicArn=None, Protocol=None, Endpoint=None, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Subscribe to a Topic. CLI example:...
Unsubscribe a specific SubscriptionArn of a topic. CLI Example: .. code-block:: bash salt myminion boto3_sns.unsubscribe my_subscription_arn region=us-east-1 def unsubscribe(SubscriptionArn, region=None, key=None, keyid=None, profile=None): ''' Unsubscribe a specific SubscriptionArn of a top...
Determines if the system needs to be rebooted. Returns: bool: True if the system requires a reboot, False if not CLI Examples: .. code-block:: bash import salt.utils.win_update salt.utils.win_update.needs_reboot() def needs_reboot(): ''' Determines if the system needs ...
Create a dictionary with the details for the updates in the collection. Returns: dict: Details about each update .. code-block:: cfg List of Updates: {'<GUID>': {'Title': <title>, 'KB': <KB>, 'GUID': <the globally uni...
Create a dictionary with a summary of the updates in the collection. Returns: dict: Summary of the contents of the collection .. code-block:: cfg Summary of Updates: {'Total': <total number of updates returned>, 'Available': <updates that are not downl...
Get the contents of ``_updates`` (all updates) and puts them in an Updates class to expose the list and summary functions. Returns: Updates: An instance of the Updates class with all updates for the system. .. code-block:: python import salt.utils.win_updat...
Refresh the contents of the ``_updates`` collection. This gets all updates in the Windows Update system and loads them into the collection. This is the part that is slow. Code Example: .. code-block:: python import salt.utils.win_update wua = salt.utils.win_upd...
Gets a list of all updates available on the system that match the passed criteria. Args: skip_hidden (bool): Skip hidden updates. Default is True skip_installed (bool): Skip installed updates. Default is True skip_mandatory (bool): Skip mandatory updates. Default ...
Search for either a single update or a specific list of updates. GUIDs are searched first, then KB numbers, and finally Titles. Args: search_string (str, list): The search string to use to find the update. This can be the GUID or KB of the update (preferred). It can ...
Download the updates passed in the updates collection. Load the updates collection using ``search`` or ``available`` Args: updates (Updates): An instance of the Updates class containing a the updates to be downloaded. Returns: dict: A dictionary containing ...
Install the updates passed in the updates collection. Load the updates collection using the ``search`` or ``available`` functions. If the updates need to be downloaded, use the ``download`` function. Args: updates (Updates): An instance of the Updates class containing a ...
Uninstall the updates passed in the updates collection. Load the updates collection using the ``search`` or ``available`` functions. .. note:: Starting with Windows 10 the Windows Update Agent is unable to uninstall updates. An ``Uninstall Not Allowed`` error is returned. If this error ...
Internal function for running commands. Used by the uninstall function. Args: cmd (str, list): The command to run Returns: str: The stdout of the command def _run(self, cmd): ''' Internal function for running commands. Used by the uninstall function. A...
Accepts YAML as a string or as a file object and runs it through the YAML parser. :rtype: A Python data structure def render(yaml_data, saltenv='base', sls='', argline='', **kws): ''' Accepts YAML as a string or as a file object and runs it through the YAML parser. :rtype: A Python data struc...
Write a default to the system CLI Example: .. code-block:: bash salt '*' macdefaults.write com.apple.CrashReporter DialogType Server salt '*' macdefaults.write NSGlobalDomain ApplePersistence True type=bool domain The name of the domain to write to key The key of th...
Write a default to the system CLI Example: .. code-block:: bash salt '*' macdefaults.read com.apple.CrashReporter DialogType salt '*' macdefaults.read NSGlobalDomain ApplePersistence domain The name of the domain to read from key The key of the given domain to read ...
Delete a default from the system CLI Example: .. code-block:: bash salt '*' macdefaults.delete com.apple.CrashReporter DialogType salt '*' macdefaults.delete NSGlobalDomain ApplePersistence domain The name of the domain to delete from key The key of the given domain...
Manage the computer's description field name The desired computer description def computer_desc(name): ''' Manage the computer's description field name The desired computer description ''' # Just in case someone decides to enter a numeric description name = six.text_type(n...
Manage the computer's name name The desired computer name def computer_name(name): ''' Manage the computer's name name The desired computer name ''' # Just in case someone decides to enter a numeric description name = six.text_type(name) ret = {'name': name, ...
.. versionadded:: 2016.3.0 Manage the hostname of the computer name The hostname to set def hostname(name): ''' .. versionadded:: 2016.3.0 Manage the hostname of the computer name The hostname to set ''' ret = { 'name': name, 'changes': {}, 'r...