Module Expr Str ImportFrom alias Import alias Import alias Import alias Import alias ImportFrom alias Import alias identifier ImportFrom alias Import alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Str FunctionDef arguments args defaults body Expr Str If BoolOpAnd CompareIn Str NameLoad CompareIn Str NameLoad body Return NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore ListLoad Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body With Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr With Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad For NameStore NameLoad body If Call AttributeLoad NameLoad attr NameLoad body Continue Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad NameLoad With Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameStore body While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Break If Call AttributeLoad NameLoad attr Str body Assign NameStore SubscriptLoad NameLoad Slice Num If CompareEq NameLoad NameLoad body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore Dict Str Str Str Str NameLoad NameLoad Dict Str Assign NameStore TupleLoad Str Str Str If CompareNotIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad Call AttributeLoad Str attr NameLoad Return NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr Str body AugAssignAdd NameStore Str If CompareIs NameLoad NameLoad body Assign NameStore NameLoad If BoolOpAnd NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Str attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str Str NameLoad NameLoad If Call NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr SubscriptLoad NameLoad Index Num Return NameLoad orelse If BoolOpOr Call SubscriptLoad NameLoad Index Str NameLoad Call SubscriptLoad NameLoad Index Str NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad Return NameLoad Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str Str NameLoad Call AttributeLoad Str attr Call AttributeLoad NameLoad attr Str Str NameLoad NameLoad If SubscriptLoad NameLoad Index Str body Assign NameStore NameLoad orelse TryExcept body Assign NameStore SubscriptLoad Call SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad Index Num handlers ExceptHandler type NameLoad name NameStore body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str AttributeLoad NameLoad attr Return NameLoad If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body If SubscriptLoad NameLoad Index Str body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr IfExp UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr Str Str NameLoad Return NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call SubscriptLoad NameLoad Index Str Str NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad TryExcept body Assign NameStore SubscriptLoad NameLoad Index Call NameLoad Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Pass TryExcept body If UnaryOpNot SubscriptLoad NameLoad Index Str body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return NameLoad handlers ExceptHandler type NameLoad body If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return NameLoad orelse Expr Call AttributeLoad NameLoad attr Str NameLoad If SubscriptLoad NameLoad Index Str body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr IfExp UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr Str Str NameLoad NameLoad Return NameLoad Expr Call SubscriptLoad NameLoad Index Str NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad If CompareEq NameLoad Str body Assign NameStore Call SubscriptLoad NameLoad Index Str NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Call SubscriptLoad NameLoad Index Str NameLoad NameLoad keyword NameLoad orelse If CompareIs NameLoad NameLoad body With Call NameLoad Call AttributeLoad NameLoad attr NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore ListLoad Str Assign NameStore Str Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If Call AttributeLoad NameLoad attr Str body Expr Call AttributeLoad NameLoad attr NameLoad orelse If CompareGt NameLoad Num body Expr Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Str Str Assign NameStore BinOpAdd NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr ListLoad Str NameLoad Assign NameStore Call SubscriptLoad NameLoad Index Str NameLoad keyword NameLoad keyword NameLoad If CompareNotEq SubscriptLoad NameLoad Index Str Num body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad If CompareIn Str Call SubscriptLoad NameLoad Index Str Str keyword NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str orelse Assign NameStore SubscriptLoad NameLoad Index Str If UnaryOpNot NameLoad body Assign NameStore Str If BoolOpOr NameLoad NameLoad body Assign NameStore Call SubscriptLoad NameLoad Index Str Str NameLoad keyword NameLoad keyword NameLoad keyword ListLoad Str Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If CompareGt Call NameLoad NameLoad Num body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Str ListLoad NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index Str Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If BoolOpAnd NameLoad NameLoad body Expr Call NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num orelse Expr Call SubscriptLoad NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list
N/A N/A 
Extract an archive

.. versionadded:: 2014.1.0
 __future__ absolute_import N/A re N/A os N/A logging N/A tarfile contextlib closing N/A salt.ext.six six salt.exceptions CommandExecutionError N/A salt.utils N/A log N/A N/A logging getLogger __name__ N/A __virtualname__ archive __virtual__ N/A N/A N/A N/A N/A 
    Only load if the archive module is available in __salt__
     N/A N/A N/A archive.unzip __salt__ N/A archive.unrar __salt__ N/A N/A __virtualname__ N/A N/A False N/A updateChecksum N/A N/A fname target checksum N/A N/A N/A lines N/A N/A compare_string N/A N/A {0}:{1} format target checksum N/A N/A N/A N/A os path exists fname N/A N/A N/A N/A N/A salt utils fopen fname r f N/A N/A lines N/A N/A f readlines N/A N/A N/A N/A salt utils fopen fname w f N/A N/A N/A N/A f write N/A N/A {0}:{1}
 format target checksum N/A line lines N/A N/A N/A N/A line startswith target N/A N/A N/A N/A N/A f write line N/A compareChecksum N/A N/A fname target checksum N/A N/A N/A N/A N/A N/A os path exists fname N/A N/A compare_string N/A N/A {0}:{1} format target checksum N/A N/A N/A N/A salt utils fopen fname r f N/A N/A True N/A N/A current_line N/A N/A f readline N/A N/A current_line N/A N/A N/A N/A N/A current_line endswith N/A N/A current_line N/A current_line N/A -1 N/A N/A compare_string current_line N/A N/A True N/A False N/A extracted N/A N/A name source archive_format archive_user password user group tar_options zip_options source_hash if_missing keep trim_output source_hash_update N/A None None None None None None None None False False None N/A N/A 
    .. versionadded:: 2014.1.0

    State that make sure an archive is extracted in a directory.
    The downloaded archive is erased if successfully extracted.
    The archive is downloaded only if necessary.

    .. note::

        If ``if_missing`` is not defined, this state will check for ``name``
        instead.  If ``name`` exists, it will assume the archive was previously
        extracted successfully and will not extract it again.

    Example, tar with flag for lmza compression:

    .. code-block:: yaml

        graylog2-server:
          archive.extracted:
            - name: /opt/
            - source: https://github.com/downloads/Graylog2/graylog2-server/graylog2-server-0.9.6p1.tar.lzma
            - source_hash: md5=499ae16dcae71eeb7c3a30c75ea7a1a6
            - tar_options: J
            - archive_format: tar
            - if_missing: /opt/graylog2-server-0.9.6p1/

    Example, tar with flag for verbose output:

    .. code-block:: yaml

        graylog2-server:
          archive.extracted:
            - name: /opt/
            - source: https://github.com/downloads/Graylog2/graylog2-server/graylog2-server-0.9.6p1.tar.gz
            - source_hash: md5=499ae16dcae71eeb7c3a30c75ea7a1a6
            - archive_format: tar
            - tar_options: v
            - user: root
            - group: root
            - if_missing: /opt/graylog2-server-0.9.6p1/

    Example, tar with flag for lmza compression and update based if source_hash differs from what was
    previously extracted:

    .. code-block:: yaml

        graylog2-server:
          archive.extracted:
            - name: /opt/
            - source: https://github.com/downloads/Graylog2/graylog2-server/graylog2-server-0.9.6p1.tar.lzma
            - source_hash: md5=499ae16dcae71eeb7c3a30c75ea7a1a6
            - source_hash_update: true
            - tar_options: J
            - archive_format: tar
            - if_missing: /opt/graylog2-server-0.9.6p1/

    name
        Directory name where to extract the archive

    password
        Password to use with password protected zip files. Currently only zip
        files with passwords are supported.

        .. versionadded:: 2016.3.0

    source
        Archive source, same syntax as file.managed source argument.

    source_hash
        Hash of source file, or file with list of hash-to-file mappings.
        It uses the same syntax as the file.managed source_hash argument.

    source_hash_update
        Set this to true if archive should be extracted if source_hash has
        changed. This would extract regardless of the `if_missing`
        parameter.

    archive_format
        tar, zip or rar

    user
        The user to own each extracted file.

        .. versionadded:: 2015.8.0

    group
        The group to own each extracted file.

        .. versionadded:: 2015.8.0

    if_missing
        Some archives, such as tar, extract themselves in a subfolder.
        This directive can be used to validate if the archive had been
        previously extracted.

    tar_options
        Required if used with ``archive_format: tar``, otherwise optional.
        It needs to be the tar argument specific to the archive being extracted,
        such as 'J' for LZMA or 'v' to verbosely list files processed.
        Using this option means that the tar executable on the target will
        be used, which is less platform independent.
        Main operators like -x, --extract, --get, -c and -f/--file
        **should not be used** here.
        If ``archive_format`` is ``zip`` or ``rar`` and this option is not set,
        then the Python tarfile module is used. The tarfile module supports gzip
        and bz2 in Python 2.

    zip_options
        Optional when using ``zip`` archives, ignored when usign other archives
        files. This is mostly used to overwrite exsiting files with ``o``.
        This options are only used when ``unzip`` binary is used.

        .. versionadded:: 2016.3.1

    keep
        Keep the archive in the minion's cache

    trim_output
        The number of files we should output on success before the rest are trimmed, if this is
        set to True then it will default to 100

     N/A ret N/A name result changes comment name None N/A N/A valid_archives N/A tar rar zip N/A N/A archive_format valid_archives N/A N/A N/A ret N/A result False N/A N/A ret N/A comment N/A N/A {0} is not supported, valid formats are: {1} format archive_format N/A N/A , join valid_archives N/A ret N/A N/A N/A N/A name endswith / N/A N/A name / N/A N/A if_missing None N/A N/A if_missing name N/A N/A source_hash source_hash_update N/A N/A hash N/A N/A source_hash split = N/A source_file N/A N/A {0}.{1} format N/A N/A N/A os path basename source N/A hash N/A 0 N/A hash_fname N/A N/A N/A os path join N/A __opts__ N/A cachedir files __env__ source_file N/A N/A compareChecksum hash_fname name N/A hash N/A 1 N/A N/A N/A ret N/A result True N/A N/A ret N/A comment N/A N/A Hash {0} has not changed format N/A hash N/A 1 N/A ret N/A N/A N/A N/A N/A __salt__ N/A file.directory_exists if_missing N/A N/A __salt__ N/A file.file_exists if_missing N/A N/A N/A ret N/A result True N/A N/A ret N/A comment N/A N/A {0} already exists format if_missing N/A ret N/A N/A N/A log debug Input seem valid so far N/A filename N/A N/A N/A os path join N/A __opts__ N/A cachedir files __env__ N/A N/A {0}.{1} format N/A N/A re sub [:/\\] _ if_missing archive_format N/A N/A __opts__ N/A test N/A N/A source_match source N/A N/A N/A N/A source_match N/A N/A N/A __salt__ N/A file.source_list source source_hash __env__ N/A 0 N/A N/A N/A CommandExecutionError N/A exc N/A N/A N/A ret N/A result False N/A N/A ret N/A comment N/A exc strerror N/A ret N/A N/A N/A N/A N/A os path exists filename N/A N/A N/A __opts__ N/A test N/A N/A N/A ret N/A result None N/A N/A ret N/A comment N/A N/A {0} {1} would be downloaded to cache format N/A N/A N/A isinstance source_match N/A six string_types One of Archive source_match N/A ret N/A N/A N/A log debug %s is not in cache, downloading it source_match N/A file_result N/A N/A __salt__ N/A state.single file.managed filename source source source_hash source_hash makedirs True saltenv __env__ N/A N/A N/A log debug N/A N/A file.managed: {0} format file_result N/A N/A N/A file_result N/A file_result N/A N/A next N/A N/A six iterkeys file_result N/A N/A N/A AttributeError N/A N/A N/A N/A N/A N/A N/A file_result N/A result N/A N/A N/A N/A log debug N/A N/A failed to download {0} format source N/A file_result N/A N/A N/A TypeError N/A N/A N/A file_result N/A N/A N/A N/A log debug N/A N/A failed to download {0} format source N/A file_result N/A N/A N/A N/A log debug Archive %s is already in cache name N/A N/A __opts__ N/A test N/A N/A N/A ret N/A result None N/A N/A ret N/A comment N/A N/A {0} {1} would be extracted to {2} format N/A N/A N/A isinstance source_match N/A six string_types One of Archive source_match name N/A ret N/A N/A N/A __salt__ N/A file.makedirs name user user group group N/A N/A N/A log debug N/A N/A Extracting {0} to {1} format filename name N/A N/A archive_format zip N/A N/A files N/A N/A __salt__ N/A archive.unzip filename name options zip_options trim_output trim_output password password N/A N/A N/A archive_format rar N/A N/A files N/A N/A __salt__ N/A archive.unrar filename name trim_output trim_output N/A N/A N/A tar_options None N/A N/A N/A closing N/A N/A tarfile open filename r tar N/A N/A files N/A N/A tar getnames N/A N/A N/A tar extractall name N/A N/A tar_opts N/A N/A tar_options split N/A tar_cmd N/A tar N/A tar_shortopts x N/A tar_longopts N/A N/A N/A position opt N/A enumerate tar_opts N/A N/A N/A N/A opt startswith - N/A N/A N/A N/A tar_longopts append opt N/A N/A N/A position 0 N/A N/A N/A N/A tar_longopts append opt N/A N/A append_opt opt N/A append_opt N/A N/A N/A N/A append_opt replace x replace f N/A tar_shortopts N/A tar_shortopts append_opt N/A N/A N/A tar_cmd append tar_shortopts N/A N/A N/A tar_cmd extend tar_longopts N/A N/A N/A tar_cmd extend N/A -f filename N/A results N/A N/A __salt__ N/A cmd.run_all tar_cmd cwd name python_shell False N/A N/A N/A results N/A retcode 0 N/A N/A N/A ret N/A result False N/A N/A ret N/A changes results N/A ret N/A N/A bsdtar N/A N/A __salt__ N/A cmd.run tar --version python_shell False N/A N/A files N/A results N/A stderr N/A N/A files N/A results N/A stdout N/A N/A files N/A N/A files no tar output so far N/A N/A user group N/A N/A dir_result N/A N/A __salt__ N/A state.single file.directory if_missing user user group group recurse N/A user group N/A N/A N/A log debug N/A N/A file.directory: {0} format dir_result N/A N/A N/A len files 0 N/A N/A N/A ret N/A result True N/A N/A N/A ret N/A changes N/A directories_created N/A name N/A N/A N/A ret N/A changes N/A extracted_files files N/A N/A ret N/A comment N/A N/A {0} extracted to {1} format source_match name N/A N/A keep N/A N/A N/A N/A os unlink filename N/A N/A source_hash source_hash_update N/A N/A N/A updateChecksum hash_fname name N/A hash N/A 1 N/A N/A N/A N/A __salt__ N/A file.remove if_missing N/A N/A ret N/A result False N/A N/A ret N/A comment N/A N/A Can't extract content of {0} format source_match N/A ret N/A