Search is not available for this dataset
text
stringlengths
75
104k
def set_change(name, change): ''' 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 '*' ...
def set_expire(name, expire): ''' 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 '*' sh...
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: ``python -c "import crypt; print crypt.crypt('password', ciphersalt)"`` .. note:: When constructing the ``ciphersalt`...
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.token = token # close the connection, if not authenticated if not self.application.auth....
def on_message(self, message): """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. """ log.debug('Got websocket m...
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['cors_origin'])) else: return super(...
def on_message(self, message): """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. """ log.debug('Got websocket m...
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 = 'supervisorctl' if not bin_env: which_result = __salt__['cmd.which_bin']([cmd]) if which_result is None: ...
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
def start(name='all', user=None, conf_file=None, bin_env=None): ''' 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 ...
def reread(user=None, conf_file=None, bin_env=None): ''' 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 Exa...
def update(user=None, conf_file=None, bin_env=None, name=None): ''' 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 in...
def status(name=None, user=None, conf_file=None, bin_env=None): ''' 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 Exam...
def status_raw(name=None, user=None, conf_file=None, bin_env=None): ''' 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 ...
def custom(command, user=None, conf_file=None, bin_env=None): ''' 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...
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): conf_file = path break ...
def options(name, conf_file=None): ''' .. 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 '*' super...
def rotate(name, **kwargs): ''' Add a log to the logadm configuration name : string alias for entryname kwargs : boolean|string|int optional additional flags and parameters ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} ...
def remove(name, log_file=None): ''' 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. ''' ret = {'name': name, 'cha...
def add_rule(name, localport, protocol='tcp', action='allow', dir='in', remoteip='any'): ''' 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". ...
def delete_rule(name, localport=None, protocol=None, dir=None, remoteip=None): ''' Delete an existing firewall rule identified by name and optionally by ports, protocols, direction, and remote IP. .. versionadded:: Neon Args: name (str):...
def enabled(name='allprofiles'): ''' 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 ...
def post_message(message, channel=None, username=None, api_url=None, hook=None): ''' Send a message to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :pa...
def post_event(event, channel=None, username=None, api_url=None, hook=None): ''' Send an event to a Mattermost channel. :param channel: The channel name, either will work. :param username: The username of the poster. :param event: ...
def read_secret(path, key=None): ''' 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('s...
def write_secret(path, **kwargs): ''' 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" ''' log.debug('Writing vault secrets for %s at %s', __grains__['...
def write_raw(path, raw): ''' 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"}' ''' log.debug('Writing vault secrets for %s at %s', __grains__['...
def present(name, level, devices, **kwargs): ''' 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 d...
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 ''' if not isinstance(hjson_data, six.string_types): hjson_data = hjson_data.read() if hjson_data.startswit...
def function_present(name, FunctionName, Runtime, Role, Handler, ZipFile=None, S3Bucket=None, S3Key=None, S3ObjectVersion=None, Description='', Timeout=3, MemorySize=128, Permissions=None, RoleRetries=5, region=None, key=None, keyid=Non...
def alias_present(name, FunctionName, Name, FunctionVersion, Description='', region=None, key=None, keyid=None, profile=None): ''' Ensure alias exists. name The name of the state definition. FunctionName Name of the function for which you want to create an alias. ...
def event_source_mapping_present(name, EventSourceArn, FunctionName, StartingPosition, Enabled=True, BatchSize=100, region=None, key=None, keyid=None, profile=None): ''' Ensure event source mapping exists. na...
def event_source_mapping_absent(name, EventSourceArn, FunctionName, region=None, key=None, keyid=None, profile=None): ''' Ensure event source mapping with passed properties is absent. name The name of the state definition. EventSourceArn ARN of the event...
def list_balancers(profile, **libcloud_kwargs): ''' 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:: ba...
def list_protocols(profile, **libcloud_kwargs): ''' 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 pr...
def create_balancer(name, port, protocol, profile, algorithm=None, members=None, **libcloud_kwargs): ''' 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 po...
def destroy_balancer(balancer_id, profile, **libcloud_kwargs): ''' 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 ...
def get_balancer_by_name(name, profile, **libcloud_kwargs): ''' 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 d...
def balancer_attach_member(balancer_id, ip, port, profile, extra=None, **libcloud_kwargs): ''' 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 p...
def balancer_detach_member(balancer_id, member_id, profile, **libcloud_kwargs): ''' 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 f...
def list_balancer_members(balancer_id, profile, **libcloud_kwargs): ''' 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 argumen...
def extra(method, profile, **libcloud_kwargs): ''' 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_k...
def install(name, link, path, priority): ''' 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 ...
def remove(name, path): ''' 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. ...
def auto(name): ''' .. 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) ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} ...
def set_(name, path): ''' .. 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...
def present(name, type, url, access=None, user=None, password=None, database=None, basic_auth=None, basic_auth_user=None, basic_auth_password=None, tls_auth=None, json_data=None, ...
def absent(name, orgname=None, profile='grafana'): ''' 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 i...
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 ''' if 'eauth' not in load: return '' fstr = '{0}.auth'.format(load['eauth']) if fstr not in self.a...
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 timing attacks ''' if 'eauth' not in load: return False fstr = '{0}.auth'.format(load['eauth']) if...
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() - start if f_time > self.max_fail: self.max_fa...
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: use acl declared in master config. ''' if 'eauth' not in load: return None mod = self.opts['eauth_acl_module'] ...
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 ldap auth module expands entries ''' if 'eauth' not in load: return auth_list fstr = '{0}.process_acl'.format(...
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 False fstr = '{0}.groups'.format(load['eauth']) if fstr not in self.auth: retur...
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: return True if isinstance(expire_override, collectio...
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 = load.pop('token_expire', self.opts['token_expire']) el...
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, tok) if not tdata: return {} rm_tok = False if 'exp...
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)
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['token']) # Bail if the token is empty or if the eauth type specified is not allowed if not ...
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 'eauth' not in load: log.warning('Authentication failure of type "eauth" occurred.') return False ...
def authenticate_key(self, load, key): ''' 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 get_auth_list(self, load, token=None): ''' 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 ha...
def check_authentication(self, load, auth_type, key=None, show_username=False): ''' .. 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 ...
def auth_data(self): ''' 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: ...
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 generating auth token: %s', exc) yield {} ...
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 = self.loadauth.load_name(load) if not ((n...
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'): sub_auth = sub_auth[load['eauth']] good = self.ckminions.any_auth( f...
def rights(self, form, load): ''' 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 ''' adat...
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 authentication system has not been specified') return ret fstr = '{0}.auth'.format(ea...
def token_cli(self, eauth, load): ''' Create the token from the CLI and request the correct data to authenticate via the passed authentication mechanism ''' load['cmd'] = 'mk_token' load['eauth'] = eauth tdata = self._send_token_request(load) if 'token' no...
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
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(region=region, key=key, keyid=keyid, profile=profile) res = {} NextToken = '' while NextToken is...
def describe_topic(name, region=None, key=None, keyid=None, profile=None): ''' 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 ''' topics = list_topics(region=region, key=key, keyi...
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 mytopic region=us-east-1 ''' topics = list_topics(region=region, key=key, keyid=keyid, profile=profile) return name in li...
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 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: ret = conn.create_topic(...
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 ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) try: conn.delete_topic(To...
def get_topic_attributes(TopicArn, region=None, key=None, keyid=None, profile=None): ''' 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...
def set_topic_attributes(TopicArn, AttributeName, AttributeValue, 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 list_subscriptions_by_topic(TopicArn, region=None, key=None, keyid=None, profile=None): ''' 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 ''' conn = _get_conn(region=region, key=key, ke...
def get_subscription_attributes(SubscriptionArn, region=None, key=None, keyid=None, profile=None): ''' Returns all of the properties of a subscription. CLI example:: salt myminion boto3_sns.get_subscription_attributes somesubscription region=us-west-1 ''' conn = _get_conn(region=region, ke...
def subscribe(TopicArn=None, Protocol=None, Endpoint=None, region=None, key=None, keyid=None, profile=None, **kwargs): ''' Subscribe to a Topic. CLI example:: salt myminion boto3_sns.subscribe mytopic https https://www.example.com/sns-endpoint ''' conn = _get_conn(region=regi...
def unsubscribe(SubscriptionArn, region=None, key=None, keyid=None, profile=None): ''' Unsubscribe a specific SubscriptionArn of a topic. CLI Example: .. code-block:: bash salt myminion boto3_sns.unsubscribe my_subscription_arn region=us-east-1 ''' if not SubscriptionArn.startswith('a...
def needs_reboot(): ''' 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() ''' # Initialize the Py...
def list(self): ''' 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>, ...
def summary(self): ''' 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>, '...
def updates(self): ''' 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 ...
def refresh(self): ''' 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_upda...
def available(self, skip_hidden=True, skip_installed=True, skip_mandatory=False, skip_reboot=False, software=True, drivers=True, categories=None, severities=None): ''' ...
def search(self, search_string): ''' 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 GUI...
def download(self, updates): ''' 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. Re...
def install(self, updates): ''' 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 instan...
def uninstall(self, updates): ''' 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 A...
def _run(self, cmd): ''' 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 ''' if isinstance(cmd, six.string_types): cmd = salt.u...
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 structure ''' if not isinstance(yaml_data, string_types): yaml_data = yaml_data.read() with warnings.catch_wa...
def write(domain, key, value, type='string', user=None): ''' 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 ...
def read(domain, key, user=None): ''' 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 ke...
def delete(domain, key, user=None): ''' 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 f...
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(name) ret = {'name': name, 'changes': {}, 'result': True, ...
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, 'changes': {}, 'result': True, 'comment': 'Compu...
def hostname(name): ''' .. versionadded:: 2016.3.0 Manage the hostname of the computer name The hostname to set ''' ret = { 'name': name, 'changes': {}, 'result': True, 'comment': '' } current_hostname = __salt__['system.get_hostname']() if...