INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
.. versionchanged:: 2015. 8. 0 Returns True if successful raises an error if not.
def archive(cwd, output, rev='HEAD', prefix=None, git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None, **kwargs): ''' .. versionchanged:: 2015.8.0 Returns ``True`` if...
Interface to git - branch ( 1 ) _
def branch(cwd, name=None, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-branch(1)`_ cwd The path to the git checkout name Name of the branc...
Interface to git - checkout ( 1 ) _
def checkout(cwd, rev=None, force=False, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-checkout(1)`_ cwd The path to the git c...
Interface to git - clone ( 1 ) _
def clone(cwd, url=None, # Remove default value once 'repository' arg is removed name=None, opts='', git_opts='', user=None, password=None, identity=None, https_user=None, https_pass=None, ignore_retcode=False, ...
Interface to git - commit ( 1 ) _
def commit(cwd, message, opts='', git_opts='', user=None, password=None, filename=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-commit(1)`_ cwd The path to the git checkout messag...
Get the value of a key in the git configuration file
def config_get(key, cwd=None, user=None, password=None, ignore_retcode=False, output_encoding=None, **kwargs): ''' Get the value of a key in the git configuration file key The name of the configuration key to ...
r.. versionadded:: 2015. 8. 0
def config_get_regexp(key, value_regex=None, cwd=None, user=None, password=None, ignore_retcode=False, output_encoding=None, **kwargs): r''' .. versionadded::...
.. versionchanged:: 2015. 8. 0 Return the value ( s ) of the key being set
def config_set(key, value=None, multivar=None, cwd=None, user=None, password=None, ignore_retcode=False, output_encoding=None, **kwargs): ''' .. versionchanged:: 2015.8.0 Return the va...
.. versionadded:: 2015. 8. 0
def config_unset(key, value_regex=None, cwd=None, user=None, password=None, ignore_retcode=False, output_encoding=None, **kwargs): ''' .. versionadded:: 2015.8.0 Unset a key in the git con...
Returns the current branch name of a local checkout. If HEAD is detached return the SHA1 of the revision which is currently checked out.
def current_branch(cwd, user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Returns the current branch name of a local checkout. If HEAD is detached, return the SHA1 of the revision which is currently checked ...
Returns the git - describe ( 1 ) _ string ( or the SHA1 hash if there are no tags ) for the given revision.
def describe(cwd, rev='HEAD', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Returns the `git-describe(1)`_ string (or the SHA1 hash if there are no tags) for the given revision. cwd The path to the git...
.. versionadded:: 2015. 8. 12 2016. 3. 3 2016. 11. 0
def diff(cwd, item1=None, item2=None, opts='', git_opts='', user=None, password=None, no_index=False, cached=False, paths=None, output_encoding=None): ''' .. versionadded:: 2015.8.12,2016.3.3,2016.11.0 Interface to `g...
.. versionadded:: 2019. 2. 0
def discard_local_changes(cwd, path='.', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2019.2.0 Runs a ``git checkout -- <path>`` ...
.. versionchanged:: 2015. 8. 2 Return data is now a dictionary containing information on branches and tags that were added/ updated
def fetch(cwd, remote=None, force=False, refspecs=None, opts='', git_opts='', user=None, password=None, identity=None, ignore_retcode=False, saltenv='base', output_encoding=None): ''' .. versionchanged:...
Interface to git - init ( 1 ) _
def init(cwd, bare=False, template=None, separate_git_dir=None, shared=None, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-init(1)`_ cwd The...
.. versionadded:: 2015. 8. 0
def is_worktree(cwd, user=None, password=None, output_encoding=None): ''' .. versionadded:: 2015.8.0 This function will attempt to determine if ``cwd`` is part of a worktree by checking its ``.git`` to see if it is a file containing a reference to ano...
.. versionadded:: 2015. 8. 0
def list_branches(cwd, remote=False, user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2015.8.0 Return a list of branches cwd The path to the git checkout r...
.. versionadded:: 2015. 8. 0
def list_tags(cwd, user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2015.8.0 Return a list of tags cwd The path to the git checkout user User under which to run the git command. By ...
.. versionadded:: 2015. 8. 0
def list_worktrees(cwd, stale=False, user=None, password=None, output_encoding=None, **kwargs): ''' .. versionadded:: 2015.8.0 Returns information on worktrees .. versionchanged:: 2015.8.4 Version 2....
Interface to git - ls - remote ( 1 ) _. Returns the upstream hash for a remote reference.
def ls_remote(cwd=None, remote='origin', ref=None, opts='', git_opts='', user=None, password=None, identity=None, https_user=None, https_pass=None, ignore_retcode=False, ...
Interface to git - merge ( 1 ) _
def merge(cwd, rev=None, opts='', git_opts='', user=None, password=None, identity=None, ignore_retcode=False, output_encoding=None, **kwargs): ''' Interface to `git-merge(1)`_ cwd The path to the git checkout ...
.. versionadded:: 2015. 8. 0
def merge_base(cwd, refs=None, octopus=False, is_ancestor=False, independent=False, fork_point=None, opts='', git_opts='', user=None, password=None, ignore_retcode=False,...
.. versionadded:: 2015. 8. 0
def merge_tree(cwd, ref1, ref2, base=None, user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2015.8.0 Interface to `git-merge-tree(1)`_, shows the merge result...
Interface to git - push ( 1 ) _
def push(cwd, remote=None, ref=None, opts='', git_opts='', user=None, password=None, identity=None, ignore_retcode=False, saltenv='base', output_encoding=None, **kwargs): ''' Interface to `git-push(1)`_ cwd ...
Interface to git - rebase ( 1 ) _
def rebase(cwd, rev='master', opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-rebase(1)`_ cwd The path to the git checkout rev : master The re...
Get the fetch and push URL for a specific remote
def remote_get(cwd, remote='origin', user=None, password=None, redact_auth=True, ignore_retcode=False, output_encoding=None): ''' Get the fetch and push URL for a specific remote cwd The path to the git checko...
.. versionadded:: 2015. 8. 0
def remote_refs(url, heads=False, tags=False, user=None, password=None, identity=None, https_user=None, https_pass=None, ignore_retcode=False, output_encoding=None, ...
cwd The path to the git checkout
def remote_set(cwd, url, remote='origin', user=None, password=None, https_user=None, https_pass=None, push_url=None, push_https_user=None, push_https_pass=None, ignore_re...
Get fetch and push URLs for each remote in a git checkout
def remotes(cwd, user=None, password=None, redact_auth=True, ignore_retcode=False, output_encoding=None): ''' Get fetch and push URLs for each remote in a git checkout cwd The path to the git checkout user User under which to ...
Interface to git - reset ( 1 ) _ returns the stdout from the git command
def reset(cwd, opts='', git_opts='', user=None, password=None, identity=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-reset(1)`_, returns the stdout from the git command cwd The path to the git checkout...
.. versionadded:: 2015. 8. 0
def rev_parse(cwd, rev=None, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2015.8.0 Interface to `git-rev-parse(1)`_ cwd The pa...
Returns the SHA1 hash of a given identifier ( hash branch tag HEAD etc. )
def revision(cwd, rev='HEAD', short=False, user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Returns the SHA1 hash of a given identifier (hash, branch, tag, HEAD, etc.) cwd The path to the git che...
Interface to git - rm ( 1 ) _
def rm_(cwd, filename, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-rm(1)`_ cwd The path to the git checkout filename The location of the file/directory to remo...
Interface to git - stash ( 1 ) _ returns the stdout from the git command
def stash(cwd, action='save', opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-stash(1)`_, returns the stdout from the git command cwd The path to the git checkout...
.. versionchanged:: 2015. 8. 0 Return data has changed from a list of lists to a dictionary
def status(cwd, user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionchanged:: 2015.8.0 Return data has changed from a list of lists to a dictionary Returns the changes to the repository cwd The path to the git...
.. versionchanged:: 2015. 8. 0 Added the command argument to allow for operations other than update to be run on submodules and deprecated the init argument. To do a submodule update with init = True moving forward use command = update opts = -- init
def submodule(cwd, command, opts='', git_opts='', user=None, password=None, identity=None, ignore_retcode=False, saltenv='base', output_encoding=None, **kwargs): ''' .. ver...
.. versionadded:: 2015. 8. 0
def symbolic_ref(cwd, ref, value=None, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2015.8.0 Interfac...
.. versionadded:: 2018. 3. 4
def tag(cwd, name, ref='HEAD', message=None, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encoding=None): ''' .. versionadded:: 2018.3.4 Interface to `git-tag(1)`_, adds and removes tags. cwd ...
.. versionadded:: 2015. 8. 0
def version(versioninfo=False): ''' .. versionadded:: 2015.8.0 Returns the version of Git installed on the minion versioninfo : False If ``True``, return the version in a versioninfo list (e.g. ``[2, 5, 0]``) CLI Example: .. code-block:: bash salt myminion git.versio...
.. versionadded:: 2015. 8. 0
def worktree_add(cwd, worktree_path, ref=None, reset_branch=None, force=None, detach=False, opts='', git_opts='', user=None, password=None, ignore_ret...
.. versionadded:: 2015. 8. 0
def worktree_prune(cwd, dry_run=False, verbose=True, expire=None, opts='', git_opts='', user=None, password=None, ignore_retcode=False, output_encodi...
.. versionadded:: 2015. 8. 0
def worktree_rm(cwd, user=None, output_encoding=None): ''' .. versionadded:: 2015.8.0 Recursively removes the worktree located at ``cwd``, returning ``True`` if successful. This function will attempt to determine if ``cwd`` is actually a worktree by invoking :py:func:`git.is_worktree <salt.modu...
.. versionadded:: 2016. 11. 0.. versionchanged:: 2016. 11. 2 The rarfile_ Python module is now supported for listing the contents of rar archives. This is necessary on minions with older releases of the rar CLI tool which do not support listing the contents in a parsable format.
def list_(name, archive_format=None, options=None, strip_components=None, clean=False, verbose=False, saltenv='base', source_hash=None): ''' .. versionadded:: 2016.11.0 .. versionchanged:: 2016.11.2 The rarfile_ Python module is n...
Expands a user - provided specification of source files into a list of paths.
def _expand_sources(sources): ''' Expands a user-provided specification of source files into a list of paths. ''' if sources is None: return [] if isinstance(sources, six.string_types): sources = [x.strip() for x in sources.split(',')] elif isinstance(sources, (float, six.integer...
.. note::
def tar(options, tarfile, sources=None, dest=None, cwd=None, template=None, runas=None): ''' .. note:: This function has changed for version 0.17.0. In prior versions, the ``cwd`` and ``template`` arguments must be specified, with the source directories/files coming as a space-s...
Uses the gzip command to create gzip files
def gzip(sourcefile, template=None, runas=None, options=None): ''' Uses the gzip command to create gzip files template : None Can be set to 'jinja' or another supported template engine to render the command arguments before execution: .. code-block:: bash salt '*' arch...
Uses the gunzip command to unpack gzip files
def gunzip(gzipfile, template=None, runas=None, options=None): ''' Uses the gunzip command to unpack gzip files template : None Can be set to 'jinja' or another supported template engine to render the command arguments before execution: .. code-block:: bash salt '*' ar...
.. versionadded:: 2015. 5. 0 In versions 2014. 7. x and earlier this function was known as archive. zip.
def cmd_zip(zip_file, sources, template=None, cwd=None, runas=None): ''' .. versionadded:: 2015.5.0 In versions 2014.7.x and earlier, this function was known as ``archive.zip``. Uses the ``zip`` command to create zip files. This command is part of the `Info-ZIP`_ suite of tools, and is ...
Uses the zipfile Python module to create zip files
def zip_(zip_file, sources, template=None, cwd=None, runas=None, zip64=False): ''' Uses the ``zipfile`` Python module to create zip files .. versionchanged:: 2015.5.0 This function was rewritten to use Python's native zip file support. The old functionality has been preserved in the new fun...
.. versionadded:: 2015. 5. 0 In versions 2014. 7. x and earlier this function was known as archive. unzip.
def cmd_unzip(zip_file, dest, excludes=None, options=None, template=None, runas=None, trim_output=False, password=None): ''' .. versionadded:: 2015.5.0 In versions 2014.7.x and earlier, this function was kn...
Uses the zipfile Python module to unpack zip files
def unzip(zip_file, dest, excludes=None, options=None, template=None, runas=None, trim_output=False, password=None, extract_perms=True): ''' Uses the ``zipfile`` Python module to unpack zip files .. versionchanged:: 2015.5.0 ...
.. versionadded:: 2016. 11. 0
def is_encrypted(name, clean=False, saltenv='base', source_hash=None): ''' .. versionadded:: 2016.11.0 Returns ``True`` if the zip archive is password-protected, ``False`` if not. If the specified file is not a ZIP archive, an error will be raised. name The path / URL of the archive to che...
Uses rar for Linux _ to create rar files
def rar(rarfile, sources, template=None, cwd=None, runas=None): ''' Uses `rar for Linux`_ to create rar files .. _`rar for Linux`: http://www.rarlab.com/ rarfile Path of rar file to be created sources Comma-separated list of sources to include in the rar file. Sources can ...
Uses rar for Linux _ to unpack rar files
def unrar(rarfile, dest, excludes=None, template=None, runas=None, trim_output=False): ''' Uses `rar for Linux`_ to unpack rar files .. _`rar for Linux`: http://www.rarlab.com/ rarfile Name of rar file to be unpacked dest The destination directory into which to **unpack** the rar ...
Process markup in the: param: filenames and: param: zipfile variables ( NOT the files under the paths they ultimately point to ) according to the markup format provided by: param: template.
def _render_filenames(filenames, zip_file, saltenv, template): ''' Process markup in the :param:`filenames` and :param:`zipfile` variables (NOT the files under the paths they ultimately point to) according to the markup format provided by :param:`template`. ''' if not template: return (f...
Trim the file list for output.
def _trim_files(files, trim_output): ''' Trim the file list for output. ''' count = 100 if not isinstance(trim_output, bool): count = trim_output if not(isinstance(trim_output, bool) and trim_output is False) and len(files) > count: files = files[:count] files.append("Li...
retrieve the auth_token from nsot
def _get_token(url, email, secret_key): ''' retrieve the auth_token from nsot :param url: str :param email: str :param secret_key: str :return: str ''' url = urlparse.urljoin(url, 'authenticate') data_dict = {"email": email, "secret_key": secret_key} query = salt.utils.http.quer...
check whether or not this minion should have this external pillar returned
def _check_regex(minion_id, regex): ''' check whether or not this minion should have this external pillar returned :param minion_id: str :param minion_regex: list :return: bool ''' get_pillar = False for pattern in regex: log.debug('nsot external pillar comparing %s with %s', mi...
if a device is given query nsot for that specific device otherwise return all devices
def _query_nsot(url, headers, device=None): ''' if a device is given, query nsot for that specific device, otherwise return all devices :param url: str :param headers: dict :param device: None or str :return: ''' url = urlparse.urljoin(url, 'devices') ret = {} if not device:...
retrieve a dict of a device that exists in nsot
def _proxy_info(minion_id, api_url, email, secret_key, fqdn_separator): ''' retrieve a dict of a device that exists in nsot :param minion_id: str :param api_url: str :param email: str :param secret_key: str :param fqdn_separator: str :return: dict ''' device_info = {} if fqd...
retrieve a list of all devices that exist in nsot
def _all_nsot_devices(api_url, email, secret_key): ''' retrieve a list of all devices that exist in nsot :param api_url: str :param email: str :param secret_key: str :return: dict ''' token = _get_token(api_url, email, secret_key) all_devices = {} if token: headers = {'A...
Query NSoT API for network devices
def ext_pillar(minion_id, pillar, api_url, email, secret_key, fqdn_separator=None, all_devices_regex=None, minion_regex=None): ''' Query NSoT API for network devices ''' ret = {} if minion_id == ...
Return the changes
def _check_cron(user, path, mask, cmd): ''' Return the changes ''' arg_mask = mask.split(',') arg_mask.sort() lst = __salt__['incron.list_tab'](user) for cron in lst['crons']: if path == cron['path'] and cron['cmd'] == cmd: ...
Verifies that the specified incron job is present for the specified user. For more advanced information about what exactly can be set in the cron timing parameters check your incron system s documentation. Most Unix - like systems incron documentation can be found via the incrontab man page: man 5 incrontab.
def present(name, path, mask, cmd, user='root'): ''' Verifies that the specified incron job is present for the specified user. For more advanced information about what exactly can be set in the cron timing parameters, check your incron system's documentati...
Add an item or items to a queue
def insert(queue, items, backend='sqlite'): ''' Add an item or items to a queue CLI Example: .. code-block:: bash salt-run queue.insert myqueue myitem salt-run queue.insert myqueue "['item1', 'item2', 'item3']" salt-run queue.insert myqueue myitem backend=sqlite salt-r...
Return a list of Salt Queues on the backend
def list_queues(backend='sqlite'): ''' Return a list of Salt Queues on the backend CLI Example: .. code-block:: bash salt-run queue.list_queues salt-run queue.list_queues backend=sqlite ''' queue_funcs = salt.loader.queues(__opts__) cmd = '{0}.list_queues'.format(backend) ...
Provide the number of items in a queue
def list_length(queue, backend='sqlite'): ''' Provide the number of items in a queue CLI Example: .. code-block:: bash salt-run queue.list_length myqueue salt-run queue.list_length myqueue backend=sqlite ''' queue_funcs = salt.loader.queues(__opts__) cmd = '{0}.list_length...
Pop one or more or all items from a queue
def pop(queue, quantity=1, backend='sqlite', is_runner=False): ''' Pop one or more or all items from a queue CLI Example: .. code-block:: bash salt-run queue.pop myqueue salt-run queue.pop myqueue 6 salt-run queue.pop myqueue all salt-run queue.pop myqueue 6 backend=sq...
Pop items off a queue and create an event on the Salt event bus to be processed by a Reactor.
def process_queue(queue, quantity=1, backend='sqlite', is_runner=False): ''' Pop items off a queue and create an event on the Salt event bus to be processed by a Reactor. CLI Example: .. code-block:: bash salt-run queue.process_queue myqueue salt-run queue.process_queue myqueue 6 ...
Get consistent opts for the queued runners
def __get_queue_opts(queue=None, backend=None): ''' Get consistent opts for the queued runners ''' if queue is None: queue = __opts__.get('runner_queue', {}).get('queue') if backend is None: backend = __opts__.get('runner_queue', {}).get('backend', 'pgjsonb') return {'backend': b...
Insert a reference to a runner into the queue so that it can be run later.
def insert_runner(fun, args=None, kwargs=None, queue=None, backend=None): ''' Insert a reference to a runner into the queue so that it can be run later. fun The runner function that is going to be run args list or comma-seperated string of args to send to fun kwargs dictio...
Process queued runners
def process_runner(quantity=1, queue=None, backend=None): ''' Process queued runners quantity number of runners to process queue queue to insert the runner reference into backend backend that to use for the queue CLI Example: .. code-block:: bash salt-ru...
yamlify arg and ensure it s outermost datatype is a list
def _parse_args(arg): ''' yamlify `arg` and ensure it's outermost datatype is a list ''' yaml_args = salt.utils.args.yamlify_arg(arg) if yaml_args is None: return [] elif not isinstance(yaml_args, list): return [yaml_args] else: return yaml_args
Publish a command from the minion out to other minions publications need to be enabled on the Salt master and the minion needs to have permission to publish the command. The Salt master will also prevent a recursive publication loop this means that a minion cannot command another minion to command another minion as tha...
def _publish( tgt, fun, arg=None, tgt_type='glob', returner='', timeout=5, form='clean', wait=False, via_master=None): ''' Publish a command from the minion out to other minions, publications need to be enabled on the Salt master and th...
Publish a command from the minion out to other minions.
def publish(tgt, fun, arg=None, tgt_type='glob', returner='', timeout=5, via_master=None): ''' Publish a command from the minion out to other minions. Publications need to be enabled on the Salt master and the minion needs to have ...
Return the full data about the publication this is invoked in the same way as the publish function
def full_data(tgt, fun, arg=None, tgt_type='glob', returner='', timeout=5): ''' Return the full data about the publication, this is invoked in the same way as the publish function CLI Example: .. code-block:: bash salt ...
Execute a runner on the master and return the data from the runner function
def runner(fun, arg=None, timeout=5): ''' Execute a runner on the master and return the data from the runner function CLI Example: .. code-block:: bash salt publish.runner manage.down ''' arg = _parse_args(arg) if 'master_uri' not in __opts__: return 'No access to mas...
Execute kadmin commands
def __execute_kadmin(cmd): ''' Execute kadmin commands ''' ret = {} auth_keytab = __opts__.get('auth_keytab', None) auth_principal = __opts__.get('auth_principal', None) if __salt__['file.file_exists'](auth_keytab) and auth_principal: return __salt__['cmd.run_all']( 'ka...
Get all principals
def list_principals(): ''' Get all principals CLI Example: .. code-block:: bash salt 'kde.example.com' kerberos.list_principals ''' ret = {} cmd = __execute_kadmin('list_principals') if cmd['retcode'] != 0 or cmd['stderr']: ret['comment'] = cmd['stderr'].splitlines()...
Get princial details
def get_principal(name): ''' Get princial details CLI Example: .. code-block:: bash salt 'kdc.example.com' kerberos.get_principal root/admin ''' ret = {} cmd = __execute_kadmin('get_principal {0}'.format(name)) if cmd['retcode'] != 0 or cmd['stderr']: ret['comment'] ...
List policies
def list_policies(): ''' List policies CLI Example: .. code-block:: bash salt 'kdc.example.com' kerberos.list_policies ''' ret = {} cmd = __execute_kadmin('list_policies') if cmd['retcode'] != 0 or cmd['stderr']: ret['comment'] = cmd['stderr'].splitlines()[-1] ...
Current privileges
def get_privs(): ''' Current privileges CLI Example: .. code-block:: bash salt 'kdc.example.com' kerberos.get_privs ''' ret = {} cmd = __execute_kadmin('get_privs') if cmd['retcode'] != 0 or cmd['stderr']: ret['comment'] = cmd['stderr'].splitlines()[-1] ret['...
Create Principal
def create_principal(name, enctypes=None): ''' Create Principal CLI Example: .. code-block:: bash salt 'kdc.example.com' kerberos.create_principal host/example.com ''' ret = {} krb_cmd = 'addprinc -randkey' if enctypes: krb_cmd += ' -e {0}'.format(enctypes) krb_...
Delete Principal
def delete_principal(name): ''' Delete Principal CLI Example: .. code-block:: bash salt 'kdc.example.com' kerberos.delete_principal host/example.com@EXAMPLE.COM ''' ret = {} cmd = __execute_kadmin('delprinc -force {0}'.format(name)) if cmd['retcode'] != 0 or cmd['stderr']: ...
Create keytab
def create_keytab(name, keytab, enctypes=None): ''' Create keytab CLI Example: .. code-block:: bash salt 'kdc.example.com' kerberos.create_keytab host/host1.example.com host1.example.com.keytab ''' ret = {} krb_cmd = 'ktadd -k {0}'.format(keytab) if enctypes: krb_cmd...
Ensures that the named host is present with the given ip
def present(name, ip, clean=False): # pylint: disable=C0103 ''' Ensures that the named host is present with the given ip name The host to assign an ip to ip The ip addr(s) to apply to the host. Can be a single IP or a list of IP addresses. clean : False Remove any...
Ensure that the named host is absent
def absent(name, ip): # pylint: disable=C0103 ''' Ensure that the named host is absent name The host to remove ip The ip addr(s) of the host to remove ''' ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''} if not isinstance...
Ensure that only the given hostnames are associated with the given IP address.
def only(name, hostnames): ''' Ensure that only the given hostnames are associated with the given IP address. .. versionadded:: 2016.3.0 name The IP address to associate with the given hostnames. hostnames Either a single hostname or a list of hostnames to associate wi...
Returns revision ID of repo
def _rev(repo): ''' Returns revision ID of repo ''' try: repo_info = dict(six.iteritems(CLIENT.info(repo['repo']))) except (pysvn._pysvn.ClientError, TypeError, KeyError, AttributeError) as exc: log.error( 'Error retrieving revision ID for svnfs remote %s ' ...
Return the list of svn remotes and their configuration information
def init(): ''' Return the list of svn remotes and their configuration information ''' bp_ = os.path.join(__opts__['cachedir'], 'svnfs') new_remote = False repos = [] per_remote_defaults = {} for param in PER_REMOTE_OVERRIDES: per_remote_defaults[param] = \ six.text_...
Remove cache directories for remotes no longer configured
def _clear_old_remotes(): ''' Remove cache directories for remotes no longer configured ''' bp_ = os.path.join(__opts__['cachedir'], 'svnfs') try: cachedir_ls = os.listdir(bp_) except OSError: cachedir_ls = [] repos = init() # Remove actively-used remotes from list fo...
Completely clear svnfs cache
def clear_cache(): ''' Completely clear svnfs cache ''' fsb_cachedir = os.path.join(__opts__['cachedir'], 'svnfs') list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/svnfs') errors = [] for rdir in (fsb_cachedir, list_cachedir): if os.path.exists(rdir): try: ...
Clear update. lk
def clear_lock(remote=None): ''' Clear update.lk ``remote`` can either be a dictionary containing repo configuration information, or a pattern. If the latter, then remotes for which the URL matches the pattern will be locked. ''' def _do_clear_lock(repo): def _add_error(errlist, rep...
Execute an svn update on all of the repos
def update(): ''' Execute an svn update on all of the repos ''' # data for the fileserver event data = {'changed': False, 'backend': 'svnfs'} # _clear_old_remotes runs init(), so use the value from there to avoid a # second init() data['changed'], repos = _clear_old_remotes()...
Check if an environment is exposed by comparing it against a whitelist and blacklist.
def _env_is_exposed(env): ''' Check if an environment is exposed by comparing it against a whitelist and blacklist. ''' if __opts__['svnfs_env_whitelist']: salt.utils.versions.warn_until( 'Neon', 'The svnfs_env_whitelist config option has been renamed to ' ...
Return a list of refs that can be used as environments
def envs(ignore_cache=False): ''' Return a list of refs that can be used as environments ''' if not ignore_cache: env_cache = os.path.join(__opts__['cachedir'], 'svnfs/envs.p') cache_match = salt.fileserver.check_env_cache(__opts__, env_cache) if cache_match is not None: ...
Return the root of the directory corresponding to the desired environment or None if the environment was not found.
def _env_root(repo, saltenv): ''' Return the root of the directory corresponding to the desired environment, or None if the environment was not found. ''' # If 'base' is desired, look for the trunk if saltenv == 'base': trunk = os.path.join(repo['repo'], repo['trunk']) if os.path...
Find the first file to match the path and ref. This operates similarly to the roots file sever but with assumptions of the directory structure based on svn standard practices.
def find_file(path, tgt_env='base', **kwargs): # pylint: disable=W0613 ''' Find the first file to match the path and ref. This operates similarly to the roots file sever but with assumptions of the directory structure based on svn standard practices. ''' fnd = {'path': '', 'rel': ''}...
Return a file hash the hash type is set in the master config file
def file_hash(load, fnd): ''' Return a file hash, the hash type is set in the master config file ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if not all(x in load for x in ('path', 'saltenv')): return '' saltenv = load['saltenv'] if ...
Return a dict containing the file lists for files dirs emptydirs and symlinks
def _file_lists(load, form): ''' Return a dict containing the file lists for files, dirs, emptydirs and symlinks ''' if 'env' in load: # "env" is not supported; Use "saltenv". load.pop('env') if 'saltenv' not in load or load['saltenv'] not in envs(): return [] list_cach...