Search is not available for this dataset
text
stringlengths
75
104k
def unset_quota_volume(name, path): ''' Unset quota on glusterfs volume name Name of the gluster volume path Folder path for restriction in volume CLI Example: .. code-block:: bash salt '*' glusterfs.unset_quota_volume <volume> <path> ''' cmd = 'volume quota ...
def list_quota_volume(name): ''' List quotas of glusterfs volume name Name of the gluster volume CLI Example: .. code-block:: bash salt '*' glusterfs.list_quota_volume <volume> ''' cmd = 'volume quota {0}'.format(name) cmd += ' list' root = _gluster_xml(cmd) ...
def get_op_version(name): ''' .. versionadded:: 2019.2.0 Returns the glusterfs volume op-version name Name of the glusterfs volume CLI Example: .. code-block:: bash salt '*' glusterfs.get_op_version <volume> ''' cmd = 'volume get {0} cluster.op-version'.format(name)...
def get_max_op_version(): ''' .. versionadded:: 2019.2.0 Returns the glusterfs volume's max op-version value Requires Glusterfs version > 3.9 CLI Example: .. code-block:: bash salt '*' glusterfs.get_max_op_version ''' if _get_version() < (3, 10,): return False, 'Gluste...
def set_op_version(version): ''' .. versionadded:: 2019.2.0 Set the glusterfs volume op-version version Version to set the glusterfs volume op-version CLI Example: .. code-block:: bash salt '*' glusterfs.set_op_version <volume> ''' cmd = 'volume set all cluster.op-v...
def _check_valid_version(): ''' Check the version of Bower to ensure this module will work. Currently bower must be at least version 1.3. ''' # pylint: disable=no-member bower_version = _LooseVersion( __salt__['cmd.run']('bower --version')) valid_version = _LooseVersion('1.3') # ...
def _construct_bower_command(bower_command): ''' Create bower command line string ''' if not bower_command: raise CommandExecutionError( 'bower_command, e.g. install, must be specified') cmd = ['bower'] + shlex.split(bower_command) cmd.extend(['--config.analytics', 'false', ...
def install(pkg, dir, pkgs=None, runas=None, env=None): ''' Install a Bower package. If no package is specified, the dependencies (from bower.json) of the package in the given directory will be installed. pkg A package name in any format acce...
def default_config(): ''' Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks and return a default config file which will be valid for the Minion. Hosts running systemd >= 207 will use ``/etc/sysctl.d...
def show(config_file=False): ''' Return a list of sysctl parameters for this minion config: Pull the data from the system configuration file instead of the live data. CLI Example: .. code-block:: bash salt '*' sysctl.show ''' ret = {} if config_file: # If the ...
def assign(name, value): ''' Assign a single sysctl parameter for this minion CLI Example: .. code-block:: bash salt '*' sysctl.assign net.ipv4.ip_forward 1 ''' value = six.text_type(value) if six.PY3: tran_tab = name.translate(''.maketrans('./', '/.')) else: ...
def persist(name, value, config=None): ''' Assign and persist a simple sysctl parameter for this minion. If ``config`` is not specified, a sensible default will be chosen using :mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`. CLI Example: .. code-block:: bash s...
def ext_pillar(minion_id, pillar, # pylint: disable=W0613 collection='pillar', id_field='_id', re_pattern=None, re_replace='', fields=None): ''' Connect to a mongo database and read per-node pillar information. Param...
def _conv_name(x): ''' If this XML tree has an xmlns attribute, then etree will add it to the beginning of the tag, like: "{http://path}tag". ''' if '}' in x: comps = x.split('}') name = comps[1] return name return x
def _to_dict(xmltree): ''' Converts an XML ElementTree to a dictionary that only contains items. This is the default behavior in version 2017.7. This will default to prevent unexpected parsing issues on modules dependant on this. ''' # If this object has no children, the for..loop below will ret...
def _to_full_dict(xmltree): ''' Returns the full XML dictionary including attributes. ''' xmldict = {} for attrName, attrValue in xmltree.attrib.items(): xmldict[attrName] = attrValue if not xmltree.getchildren(): if not xmldict: # If we don't have attributes, we sh...
def _no_op(name, **kwargs): ''' No-op state to support state config via the stateconf renderer. ''' return dict(name=name, result=True, changes={}, comment='')
def _get_state(inspect_results): ''' Helper for deriving the current state of the container from the inspect results. ''' if inspect_results.get('State', {}).get('Paused', False): return 'paused' elif inspect_results.get('State', {}).get('Running', False): return 'running' el...
def _docker_client(wrapped): ''' Decorator to run a function that requires the use of a docker.Client() instance. ''' @functools.wraps(wrapped) def wrapper(*args, **kwargs): ''' Ensure that the client is present ''' kwargs = __utils__['args.clean_kwargs'](**kwargs...
def _refresh_mine_cache(wrapped): ''' Decorator to trigger a refresh of salt mine data. ''' @functools.wraps(wrapped) def wrapper(*args, **kwargs): ''' refresh salt mine on exit. ''' returned = wrapped(*args, **__utils__['args.clean_kwargs'](**kwargs)) if _che...
def _change_state(name, action, expected, *args, **kwargs): ''' Change the state of a container ''' pre = state(name) if action != 'restart' and pre == expected: return {'result': False, 'state': {'old': expected, 'new': expected}, 'comment': ('Container \'{0}...
def _get_md5(name, path): ''' Get the MD5 checksum of a file from a container ''' output = run_stdout(name, 'md5sum {0}'.format(pipes.quote(path)), ignore_retcode=True) try: return output.split()[0] except IndexError: # Destination ...
def _get_exec_driver(): ''' Get the method to be used in shell commands ''' contextkey = 'docker.exec_driver' if contextkey not in __context__: from_config = __salt__['config.get'](contextkey, None) # This if block can be removed once we make docker-exec a default # option, a...
def _get_top_level_images(imagedata, subset=None): ''' Returns a list of the top-level images (those which are not parents). If ``subset`` (an iterable) is passed, the top-level images in the subset will be returned, otherwise all top-level images will be returned. ''' try: parents = [im...
def _scrub_links(links, name): ''' Remove container name from HostConfig:Links values to enable comparing container configurations correctly. ''' if isinstance(links, list): ret = [] for l in links: ret.append(l.replace('/{0}/'.format(name), '/', 1)) else: ret...
def _size_fmt(num): ''' Format bytes as human-readable file sizes ''' try: num = int(num) if num < 1024: return '{0} bytes'.format(num) num /= 1024.0 for unit in ('KiB', 'MiB', 'GiB', 'TiB', 'PiB'): if num < 1024.0: return '{0:3.1f}...
def _client_wrapper(attr, *args, **kwargs): ''' Common functionality for running low-level API calls ''' catch_api_errors = kwargs.pop('catch_api_errors', True) func = getattr(__context__['docker.client'], attr, None) if func is None or not hasattr(func, '__call__'): raise SaltInvocation...
def _build_status(data, item): ''' Process a status update from a docker build, updating the data structure ''' stream = item['stream'] if 'Running in' in stream: data.setdefault('Intermediate_Containers', []).append( stream.rstrip().split()[-1]) if 'Successfully built' in st...
def _import_status(data, item, repo_name, repo_tag): ''' Process a status update from docker import, updating the data structure ''' status = item['status'] try: if 'Downloading from' in status: return elif all(x in string.hexdigits for x in status): # Status ...
def _pull_status(data, item): ''' Process a status update from a docker pull, updating the data structure. For containers created with older versions of Docker, there is no distinction in the status updates between layers that were already present (and thus not necessary to download), and those whi...
def _push_status(data, item): ''' Process a status update from a docker push, updating the data structure ''' status = item['status'].lower() if 'id' in item: if 'already pushed' in status or 'already exists' in status: # Layer already exists already_pushed = data.set...
def _error_detail(data, item): ''' Process an API error, updating the data structure ''' err = item['errorDetail'] if 'code' in err: try: msg = ': '.join(( item['errorDetail']['code'], item['errorDetail']['message'] )) except Ty...
def _get_create_kwargs(skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, client_args=None, **kwargs): ''' Take input kwargs and return a kwargs dict to pass to docker-py's create_container() funct...
def compare_containers(first, second, ignore=None): ''' .. versionadded:: 2017.7.0 .. versionchanged:: 2018.3.0 Renamed from ``docker.compare_container`` to ``docker.compare_containers`` (old function name remains as an alias) Compare two containers' Config and and HostConfig and return...
def compare_container_networks(first, second): ''' .. versionadded:: 2018.3.0 Returns the differences between two containers' networks. When a network is only present one of the two containers, that network's diff will simply be represented with ``True`` for the side of the diff in which the networ...
def compare_networks(first, second, ignore='Name,Id,Created,Containers'): ''' .. versionadded:: 2018.3.0 Compare two networks and return any differences between the two first Name or ID of first container second Name or ID of second container ignore : Name,Id,Created,Containe...
def connected(name, verbose=False): ''' .. versionadded:: 2018.3.0 Return a list of running containers attached to the specified network name Network name verbose : False If ``True``, return extended info about each container (IP configuration, etc.) CLI Example: ...
def login(*registries): ''' .. versionadded:: 2016.3.7,2016.11.4,2017.7.0 Performs a ``docker login`` to authenticate to one or more configured repositories. See the documentation at the top of this page to configure authentication credentials. Multiple registry URLs (matching those configured...
def depends(name): ''' Returns the containers and images, if any, which depend on the given image name Name or ID of image **RETURN DATA** A dictionary containing the following keys: - ``Containers`` - A list of containers which depend on the specified image - ``Images`` - A lis...
def diff(name): ''' Get information on changes made to container's filesystem since it was created. Equivalent to running the ``docker diff`` Docker CLI command. name Container name or ID **RETURN DATA** A dictionary containing any of the following keys: - ``Added`` - A list of ...
def exists(name): ''' Check if a given container exists name Container name or ID **RETURN DATA** A boolean (``True`` if the container exists, otherwise ``False``) CLI Example: .. code-block:: bash salt myminion docker.exists mycontainer ''' contextkey = 'dock...
def history(name, quiet=False): ''' Return the history for an image. Equivalent to running the ``docker history`` Docker CLI command. name Container name or ID quiet : False If ``True``, the return data will simply be a list of the commands run to build the container. ...
def images(verbose=False, **kwargs): ''' Returns information about the Docker images on the Minion. Equivalent to running the ``docker images`` Docker CLI command. all : False If ``True``, untagged images will also be returned verbose : False If ``True``, a ``docker inspect`` will ...
def inspect(name): ''' .. versionchanged:: 2017.7.0 Volumes and networks are now checked, in addition to containers and images. This is a generic container/image/volume/network inspecton function. It will run the following functions in order: - :py:func:`docker.inspect_container ...
def inspect_image(name): ''' Retrieves image information. Equivalent to running the ``docker inspect`` Docker CLI command, but will only look for image information. .. note:: To inspect an image, it must have been pulled from a registry or built locally. Images on a Docker registry whic...
def list_containers(**kwargs): ''' Returns a list of containers by name. This is different from :py:func:`docker.ps <salt.modules.dockermod.ps_>` in that :py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results organized by container ID. all : False If ``True``, stopped con...
def list_tags(): ''' Returns a list of tagged images CLI Example: .. code-block:: bash salt myminion docker.list_tags ''' ret = set() for item in six.itervalues(images()): if not item.get('RepoTags'): continue ret.update(set(item['RepoTags'])) retur...
def resolve_image_id(name): ''' .. versionadded:: 2018.3.0 Given an image name (or partial image ID), return the full image ID. If no match is found among the locally-pulled images, then ``False`` will be returned. CLI Examples: .. code-block:: bash salt myminion docker.resolve_i...
def resolve_tag(name, **kwargs): ''' .. versionadded:: 2017.7.2 .. versionchanged:: 2018.3.0 Instead of matching against pulled tags using :py:func:`docker.list_tags <salt.modules.dockermod.list_tags>`, this function now simply inspects the passed image name using :py:func:`d...
def logs(name, **kwargs): ''' .. versionchanged:: 2018.3.0 Support for all of docker-py's `logs()`_ function's arguments, with the exception of ``stream``. Returns the logs for the container. An interface to docker-py's `logs()`_ function. name Container name or ID std...
def port(name, private_port=None): ''' Returns port mapping information for a given container. Equivalent to running the ``docker port`` Docker CLI command. name Container name or ID .. versionchanged:: 2019.2.0 This value can now be a pattern expression (using the ...
def ps_(filters=None, **kwargs): ''' Returns information about the Docker containers on the Minion. Equivalent to running the ``docker ps`` Docker CLI command. all : False If ``True``, stopped containers will also be returned host: False If ``True``, local host's network topology w...
def state(name): ''' Returns the state of the container name Container name or ID **RETURN DATA** A string representing the current state of the container (either ``running``, ``paused``, or ``stopped``) CLI Example: .. code-block:: bash salt myminion docker.state...
def search(name, official=False, trusted=False): ''' Searches the registry for an image name Search keyword official : False Limit results to official builds trusted : False Limit results to `trusted builds`_ **RETURN DATA** A dictionary with each key being the n...
def top(name): ''' Runs the `docker top` command on a specific container name Container name or ID CLI Example: **RETURN DATA** A list of dictionaries containing information about each process .. code-block:: bash salt myminion docker.top mycontainer salt mymi...
def version(): ''' Returns a dictionary of Docker version information. Equivalent to running the ``docker version`` Docker CLI command. CLI Example: .. code-block:: bash salt myminion docker.version ''' ret = _client_wrapper('version') version_re = re.compile(VERSION_RE) i...
def create(image, name=None, start=False, skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, client_timeout=salt.utils.docker.CLIENT_TIMEOUT, **kwargs): ''' Create a new container image Image from which ...
def run_container(image, name=None, skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, client_timeout=salt.utils.docker.CLIENT_TIMEOUT, bg=False, replace=False, ...
def copy_from(name, source, dest, overwrite=False, makedirs=False): ''' Copy a file from inside a container to the Minion name Container name source Path of the file on the container's filesystem dest Destination on the Minion. Must be an absolute path. If the destination ...
def copy_to(name, source, dest, exec_driver=None, overwrite=False, makedirs=False): ''' Copy a file from the host into a container name Container name source File to be copied to the container. Can be a local path on the Minio...
def export(name, path, overwrite=False, makedirs=False, compression=None, **kwargs): ''' Exports a container to a tar archive. It can also optionally compress that tar archive, and push it up to the Master. name Container name or ID pa...
def rm_(name, force=False, volumes=False, **kwargs): ''' Removes a container name Container name or ID force : False If ``True``, the container will be killed first before removal, as the Docker API will not permit a running container to be removed. This option is set t...
def rename(name, new_name): ''' .. versionadded:: 2017.7.0 Renames a container. Returns ``True`` if successful, and raises an error if the API returns one. If unsuccessful and the API returns no error (should not happen), then ``False`` will be returned. name Name or ID of existing con...
def build(path=None, repository=None, tag=None, cache=True, rm=True, api_response=False, fileobj=None, dockerfile=None, buildargs=None, network_mode=None, labels=None, cache_from=None, target=None): ...
def commit(name, repository, tag='latest', message=None, author=None): ''' .. versionchanged:: 2018.3.0 The repository and tag must now be passed separately using the ``repository`` and ``tag`` arguments, rather than together in the (now deprec...
def dangling(prune=False, force=False): ''' Return top-level images (those on which no other images depend) which do not have a tag assigned to them. These include: - Images which were once tagged but were later untagged, such as those which were superseded by committing a new copy of an existing...
def import_(source, repository, tag='latest', api_response=False): ''' .. versionchanged:: 2018.3.0 The repository and tag must now be passed separately using the ``repository`` and ``tag`` arguments, rather than together in the (now deprecated) ``imag...
def load(path, repository=None, tag=None): ''' .. versionchanged:: 2018.3.0 If the loaded image should be tagged, then the repository and tag must now be passed separately using the ``repository`` and ``tag`` arguments, rather than together in the (now deprecated) ``image`` argum...
def layers(name): ''' Returns a list of the IDs of layers belonging to the specified image, with the top-most layer (the one correspnding to the passed name) appearing last. name Image name or ID CLI Example: .. code-block:: bash salt myminion docker.layers centos:7 '...
def pull(image, insecure_registry=False, api_response=False, client_timeout=salt.utils.docker.CLIENT_TIMEOUT): ''' .. versionchanged:: 2018.3.0 If no tag is specified in the ``image`` argument, all tags for the image will be pulled. For this reason is it recommended to...
def push(image, insecure_registry=False, api_response=False, client_timeout=salt.utils.docker.CLIENT_TIMEOUT): ''' .. versionchanged:: 2015.8.4 The ``Id`` and ``Image`` keys are no longer present in the return data. This is due to changes in the Docker Remote API. ...
def rmi(*names, **kwargs): ''' Removes an image name Name (in ``repo:tag`` notation) or ID of image. force : False If ``True``, the image will be removed even if the Minion has containers created from that image prune : True If ``True``, untagged parent image layer...
def tag_(name, repository, tag='latest', force=False): ''' .. versionchanged:: 2018.3.0 The repository and tag must now be passed separately using the ``repository`` and ``tag`` arguments, rather than together in the (now deprecated) ``image`` argument. Tag an image into a repositor...
def networks(names=None, ids=None): ''' .. versionchanged:: 2017.7.0 The ``names`` and ``ids`` can be passed as a comma-separated list now, as well as a Python list. .. versionchanged:: 2018.3.0 The ``Containers`` key for each network is no longer always empty. List existing net...
def create_network(name, skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, client_timeout=salt.utils.docker.CLIENT_TIMEOUT, **kwargs): ''' .. versionchanged:: 2018.3.0 Support added for net...
def connect_container_to_network(container, net_id, **kwargs): ''' .. versionadded:: 2015.8.3 .. versionchanged:: 2017.7.0 Support for ``ipv4_address`` argument added .. versionchanged:: 2018.3.0 All arguments are now passed through to `connect_container_to_network()`_, allowing ...
def disconnect_container_from_network(container, network_id): ''' .. versionadded:: 2015.8.3 Disconnect container from network container Container name or ID network_id Network name or ID CLI Examples: .. code-block:: bash salt myminion docker.disconnect_contain...
def disconnect_all_containers_from_network(network_id): ''' .. versionadded:: 2018.3.0 Runs :py:func:`docker.disconnect_container_from_network <salt.modules.dockermod.disconnect_container_from_network>` on all containers connected to the specified network, and returns the names of all container...
def create_volume(name, driver=None, driver_opts=None): ''' Create a new volume .. versionadded:: 2015.8.4 name name of volume driver Driver of the volume driver_opts Options for the driver volume CLI Example: .. code-block:: bash salt myminion dock...
def pause(name): ''' Pauses a container name Container name or ID **RETURN DATA** A dictionary will be returned, containing the following keys: - ``status`` - A dictionary showing the prior state of the container as well as the new state - ``result`` - A boolean noting whe...
def restart(name, timeout=10): ''' Restarts a container name Container name or ID timeout : 10 Timeout in seconds after which the container will be killed (if it has not yet gracefully shut down) **RETURN DATA** A dictionary will be returned, containing the following...
def start_(name): ''' Start a container name Container name or ID **RETURN DATA** A dictionary will be returned, containing the following keys: - ``status`` - A dictionary showing the prior state of the container as well as the new state - ``result`` - A boolean noting whet...
def stop(name, timeout=None, **kwargs): ''' Stops a running container name Container name or ID unpause : False If ``True`` and the container is paused, it will be unpaused before attempting to stop the container. timeout Timeout in seconds after which the containe...
def unpause(name): ''' Unpauses a container name Container name or ID **RETURN DATA** A dictionary will be returned, containing the following keys: - ``status`` - A dictionary showing the prior state of the container as well as the new state - ``result`` - A boolean noting...
def wait(name, ignore_already_stopped=False, fail_on_exit_status=False): ''' Wait for the container to exit gracefully, and return its exit code .. note:: This function will block until the container is stopped. name Container name or ID ignore_already_stopped Boolean fla...
def prune(containers=False, networks=False, images=False, build=False, volumes=False, system=None, **filters): ''' .. versionadded:: 2019.2.0 Prune Docker's various subsystems .. note:: This requires docker-py version 2.1.0 or later. containers : False If ``True``, prune...
def _run(name, cmd, exec_driver=None, output=None, stdin=None, python_shell=True, output_loglevel='debug', ignore_retcode=False, use_vt=False, keep_env=None): ''' Common logic for docker.run functions ''' if exec_driver is ...
def _script(name, source, saltenv='base', args=None, template=None, exec_driver=None, stdin=None, python_shell=True, output_loglevel='debug', ignore_retcode=False, use_vt=False, keep_env=N...
def script(name, source, saltenv='base', args=None, template=None, exec_driver=None, stdin=None, python_shell=True, output_loglevel='debug', ignore_retcode=False, use_vt=False, keep_env=None): ''...
def _prepare_trans_tar(name, sls_opts, mods=None, pillar=None, extra_filerefs=''): ''' Prepares a self contained tarball that has the state to be applied in the container ''' chunks = _compile_state(sls_opts, mods) # reuse it from salt.ssh, however this function should ...
def _compile_state(sls_opts, mods=None): ''' Generates the chunks of lowdata from the list of modules ''' st_ = HighState(sls_opts) if not mods: return st_.compile_low_chunks() high_data, errors = st_.render_highstate({sls_opts['saltenv']: mods}) high_data, ext_errors = st_.state.r...
def call(name, function, *args, **kwargs): ''' Executes a Salt function inside a running container .. versionadded:: 2016.11.0 The container does not need to have Salt installed, but Python is required. name Container name or ID function Salt execution module function CL...
def apply_(name, mods=None, **kwargs): ''' .. versionadded:: 2019.2.0 Apply states! This function will call highstate or state.sls based on the arguments passed in, ``apply`` is intended to be the main gateway for all state executions. CLI Example: .. code-block:: bash salt 'dock...
def sls(name, mods=None, **kwargs): ''' Apply the states defined by the specified SLS modules to the running container .. versionadded:: 2016.11.0 The container does not need to have Salt installed, but Python is required. name Container name or ID mods : None A string co...
def sls_build(repository, tag='latest', base='opensuse/python', mods=None, dryrun=False, **kwargs): ''' .. versionchanged:: 2018.3.0 The repository and tag must now be passed separately using the ``repository`` and ``tag`` arg...
def _check(peers): '''Checks whether the input is a valid list of peers and transforms domain names into IP Addresses''' if not isinstance(peers, list): return False for peer in peers: if not isinstance(peer, six.string_types): return False if not HAS_NETADDR: # if does ...
def managed(name, peers=None, servers=None): ''' Manages the configuration of NTP peers and servers on the device, as specified in the state SLS file. NTP entities not specified in these lists will be removed whilst entities not configured on the device will be set. SLS Example: .. code-block:: y...
def add_service(protocol=None, service_address=None, scheduler='wlc'): ''' Add a virtual service. protocol The service protocol(only support tcp, udp and fwmark service). service_address The LVS service address. scheduler Algorithm for allocating TCP connections and UDP da...
def present(name, retention_hours=None, enhanced_monitoring=None, num_shards=None, do_reshard=True, region=None, key=None, keyid=None, profile=None): ''' Ensure the kinesis stream is properly configured and scaled. ...
def info(name): ''' Return information for the specified user CLI Example: .. code-block:: bash salt '*' shadow.info someuser ''' try: data = pwd.getpwnam(name) ret = { 'name': data.pw_name, 'passwd': data.pw_passwd} except KeyError: ...