Module Expr Str ImportFrom alias alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias ImportFrom alias Import alias ImportFrom alias Import alias Import alias identifier ImportFrom alias Import alias Import alias ImportFrom alias ImportFrom alias Assign NameStore ListLoad Str Assign NameStore Dict Assign NameStore Dict Str Str Str Str Str Str Assign NameStore Lambda arguments args defaults Call AttributeLoad NameLoad attr NameLoad Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr BinOpMult NameLoad Num Return Call AttributeLoad Str attr SubscriptLoad NameLoad Slice NameLoad BinOpMult Str BinOpSub NameLoad NameLoad decorator_list Assign NameStore Lambda arguments args NameParam defaults Str Assign NameStore Lambda arguments args NameParam defaults Str Assign NameStore Lambda arguments args NameParam defaults Str Assign NameStore Dict Str Str Str Str Str Str Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str NameLoad NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return IfExp Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call NameLoad NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body If CompareIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad Return NameLoad orelse Return NameLoad decorator_list FunctionDef arguments args defaults vararg kwarg body Expr Str Assign NameStore Dict Assign NameStore Call AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad TryExcept body For NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Pass If Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Str body For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body If CompareIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore NameLoad If UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign NameStore Dict If Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str Str orelse If Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str Str orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str Str If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body With Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameStore body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Return Call AttributeLoad Str attr NameLoad If UnaryOpNot Call NameLoad NameLoad NameLoad body Assign NameStore Dict For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body If BoolOpAnd CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad body If CompareIn NameLoad NameLoad body Delete SubscriptDel NameLoad Index NameLoad If CompareIn NameLoad NameLoad body Delete SubscriptDel NameLoad Index NameLoad orelse Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Assign AttributeStore AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Assign AttributeStore AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad TryExcept body With Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign NameStore Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index Str Str TryExcept body With Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr Str handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign NameStore Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr Str NameLoad body Expr Call SubscriptLoad NameLoad Index Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Return Call NameLoad Dict NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad ListLoad NameLoad If BoolOpAnd UnaryOpNot Call NameLoad NameLoad NameLoad CompareIs NameLoad NameLoad body Assign NameStore ListLoad NameLoad If UnaryOpNot Call NameLoad NameLoad NameLoad body Return Call AttributeLoad Str attr NameLoad If CompareIn NameLoad NameLoad body Return Call AttributeLoad Str attr NameLoad NameLoad If Call NameLoad NameLoad NameLoad body For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad While CompareIn NameLoad NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call NameLoad NameLoad Call NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Dict NameLoad NameLoad Assign NameStore NameLoad Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad ListLoad NameLoad If UnaryOpNot Call NameLoad NameLoad NameLoad body Return Call AttributeLoad Str attr NameLoad If CompareNotIn NameLoad NameLoad body Return Call AttributeLoad Str attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad While CompareIn NameLoad NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Dict NameLoad NameLoad Assign NameStore NameLoad Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Expr Call NameLoad NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad Str NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad If BoolOpAnd NameLoad CompareIn NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad If CompareIs NameLoad NameLoad body Assign NameStore NameLoad orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body If UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Call AttributeLoad NameLoad attr NameLoad NameLoad If NameLoad body If UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Str If CompareIs NameLoad NameLoad body Assign NameStore NameLoad orelse Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num NameLoad Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num Str body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad Str attr ListComp Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad comprehension NameStore Call NameLoad NameLoad If CompareIn NameLoad NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call NameLoad NameLoad Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad orelse Expr Call NameLoad NameLoad NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad NameLoad NameLoad body Expr Str Assign NameStore Dict Str Str Str Str Dict NameLoad Assign NameStore Str If Call NameLoad NameLoad NameLoad body Assign NameStore Str orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Str Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Assign NameStore NameLoad Assign NameStore Str If CompareIs NameLoad NameLoad body Assign NameStore NameLoad orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Str orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Str If BoolOpAnd CompareIsNot NameLoad NameLoad CompareEq NameLoad NameLoad BoolOpOr CompareIsNot NameLoad NameLoad CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str Str Return NameLoad If BoolOpAnd CompareIsNot NameLoad NameLoad UnaryOpNot NameLoad body If CompareEq NameLoad Str body Assign SubscriptStore NameLoad Index Str BinOpAdd Call AttributeLoad Str attr NameLoad Str Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad orelse If BoolOpAnd CompareEq NameLoad Str CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str BinOpAdd Call AttributeLoad Str attr NameLoad Str Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad orelse Assign NameStore NameLoad orelse Assign NameStore NameLoad While CompareIn NameLoad NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call NameLoad NameLoad Dict NameLoad If Call NameLoad NameLoad NameLoad body If BoolOpAnd CompareIs NameLoad NameLoad NameLoad body If CompareIn NameLoad Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Dict NameLoad NameLoad orelse If Call NameLoad NameLoad NameLoad body Assign NameStore NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareEq NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Dict NameLoad NameLoad Assign NameStore NameLoad orelse If BoolOpAnd Call NameLoad NameLoad NameLoad CompareIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Dict NameLoad NameLoad Assign NameStore NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Dict NameLoad NameLoad orelse If BoolOpOr CompareEq NameLoad NameLoad NameLoad body Assign NameStore Dict NameLoad NameLoad orelse Assign SubscriptStore NameLoad Index Str BinOpAdd BinOpAdd Call AttributeLoad Str attr NameLoad NameLoad Call AttributeLoad Str attr NameLoad Str Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad If Call NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad orelse Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad decorator_list Assign NameStore NameLoad
N/A N/A 
Return/control aspects of the grains data
 __future__ absolute_import print_function N/A os N/A copy N/A math N/A random N/A logging N/A operator N/A collections N/A json functools reduce N/A salt.utils.compat salt.utils.odict OrderedDict N/A yaml N/A salt.ext.six six salt.ext.six.moves range N/A salt.utils N/A salt.utils.dictupdate salt.defaults DEFAULT_TARGET_DELIM salt.exceptions SaltException N/A __proxyenabled__ N/A * N/A __grains__ N/A N/A __outputter__ N/A items item setval nested nested nested N/A _infinitedict N/A N/A N/A N/A N/A N/A collections defaultdict _infinitedict N/A _non_existent_key NonExistentValueMagicNumberSpK3hnufdHfeBUXCfqVK N/A log N/A N/A logging getLogger __name__ _serial_sanitizer N/A N/A instr N/A N/A N/A Replaces the last 1/4 of a string with X's N/A length N/A len instr N/A index N/A int N/A N/A math floor N/A length 0.75 N/A N/A N/A {0}{1} format N/A instr N/A index N/A X N/A length index N/A N/A _FQDN_SANITIZER N/A N/A N/A x N/A MINION.DOMAINNAME N/A _HOSTNAME_SANITIZER N/A N/A N/A x N/A MINION N/A _DOMAINNAME_SANITIZER N/A N/A N/A x N/A DOMAINNAME N/A _SANITIZERS N/A serialnumber domain fqdn id host localhost nodename _serial_sanitizer _DOMAINNAME_SANITIZER _FQDN_SANITIZER _FQDN_SANITIZER _HOSTNAME_SANITIZER _HOSTNAME_SANITIZER _HOSTNAME_SANITIZER get N/A N/A key default delimiter ordered N/A DEFAULT_TARGET_DELIM True N/A N/A 
    Attempt to retrieve the named value from grains, if the named value is not
    available return the passed default. The default return is an empty string.

    The value can also represent a value in a nested dict using a ":" delimiter
    for the dict. This means that if a dict in grains looks like this::

        {'pkg': {'apache': 'httpd'}}

    To retrieve the value associated with the apache key in the pkg dict this
    key can be passed::

        pkg:apache


    :param delimiter:
        Specify an alternate delimiter to use when traversing a nested dict

        .. versionadded:: 2014.7.0

    :param ordered:
        Outputs an ordered dict if applicable (default: True)

        .. versionadded:: Carbon

    CLI Example:

    .. code-block:: bash

        salt '*' grains.get pkg:apache
     N/A N/A ordered True N/A N/A grains __grains__ N/A N/A grains N/A N/A json loads N/A N/A json dumps __grains__ N/A N/A N/A N/A salt utils traverse_dict_and_list grains key default delimiter N/A has_value N/A N/A key N/A N/A N/A 
    Determine whether a named value exists in the grains dictionary.

    Given a grains dictionary that contains the following structure::

        {'pkg': {'apache': 'httpd'}}

    One would determine if the apache key in the pkg dict exists by::

        pkg:apache

    CLI Example:

    .. code-block:: bash

        salt '*' grains.has_value pkg:apache
     N/A N/A N/A N/A N/A salt utils traverse_dict_and_list __grains__ key False True False N/A items N/A N/A sanitize N/A False N/A N/A 
    Return all of the minion's grains

    CLI Example:

    .. code-block:: bash

        salt '*' grains.items

    Sanitized CLI Example:

    .. code-block:: bash

        salt '*' grains.items sanitize=True
     N/A N/A N/A N/A salt utils is_true sanitize N/A N/A out N/A dict __grains__ N/A N/A key func N/A N/A six iteritems _SANITIZERS N/A N/A N/A key out N/A N/A N/A out N/A key N/A func N/A out N/A key N/A out N/A N/A __grains__ N/A item N/A N/A N/A args kwargs N/A N/A 
    Return one or more grains

    CLI Example:

    .. code-block:: bash

        salt '*' grains.item os
        salt '*' grains.item os osrelease oscodename

    Sanitized CLI Example:

    .. code-block:: bash

        salt '*' grains.item host sanitize=True
     N/A ret N/A N/A default N/A N/A kwargs get default N/A delimiter N/A N/A kwargs get delimiter DEFAULT_TARGET_DELIM N/A N/A N/A arg args N/A N/A N/A ret N/A arg N/A N/A N/A salt utils traverse_dict_and_list __grains__ arg default delimiter N/A N/A N/A KeyError N/A N/A N/A N/A N/A N/A salt utils is_true N/A N/A kwargs get sanitize N/A N/A N/A arg func N/A N/A six iteritems _SANITIZERS N/A N/A N/A arg ret N/A N/A N/A ret N/A arg N/A func N/A ret N/A arg N/A ret N/A setvals N/A N/A grains destructive N/A False N/A N/A 
    Set new grains values in the grains config file

    :param Destructive: If an operation results in a key being removed, delete the key, too. Defaults to False.

    CLI Example:

    .. code-block:: bash

        salt '*' grains.setvals "{'key1': 'val1', 'key2': 'val2'}"
     N/A new_grains grains N/A N/A N/A isinstance new_grains N/A collections Mapping N/A N/A N/A SaltException setvals grains must be a dictionary. N/A grains N/A N/A N/A N/A N/A os path isfile N/A __opts__ N/A conf_file N/A N/A gfn N/A N/A N/A os path join N/A N/A N/A os path dirname N/A __opts__ N/A conf_file grains N/A N/A N/A N/A N/A os path isdir N/A __opts__ N/A conf_file N/A N/A gfn N/A N/A N/A os path join N/A __opts__ N/A conf_file grains N/A N/A gfn N/A N/A N/A os path join N/A N/A N/A os path dirname N/A __opts__ N/A conf_file grains N/A N/A N/A N/A os path isfile gfn N/A N/A N/A N/A N/A salt utils fopen gfn rb fp_ N/A N/A N/A N/A grains N/A N/A yaml safe_load N/A N/A fp_ read N/A N/A N/A N/A yaml YAMLError N/A exc N/A N/A N/A N/A Unable to read existing grains file: {0} format exc N/A N/A N/A isinstance grains dict N/A N/A grains N/A N/A N/A key val N/A N/A six iteritems new_grains N/A N/A N/A N/A val None N/A destructive True N/A N/A N/A key grains N/A N/A N/A grains N/A key N/A N/A key __grains__ N/A N/A N/A __grains__ N/A key N/A N/A N/A grains N/A key val N/A N/A __grains__ N/A key val N/A N/A N/A yaml_reps N/A N/A copy deepcopy N/A N/A N/A yaml representer SafeRepresenter yaml_representers N/A yaml_multi_reps N/A N/A copy deepcopy N/A N/A N/A yaml representer SafeRepresenter yaml_multi_representers N/A N/A N/A N/A TypeError NameError N/A N/A yaml_reps N/A N/A N/A N/A salt utils compat deepcopy_bound N/A N/A N/A yaml representer SafeRepresenter yaml_representers N/A yaml_multi_reps N/A N/A N/A N/A salt utils compat deepcopy_bound N/A N/A N/A yaml representer SafeRepresenter yaml_multi_representers N/A N/A N/A N/A N/A yaml representer SafeRepresenter add_representer N/A collections defaultdict N/A N/A N/A yaml representer SafeRepresenter represent_dict N/A N/A N/A N/A N/A yaml representer SafeRepresenter add_representer OrderedDict N/A N/A N/A yaml representer SafeRepresenter represent_dict N/A cstr N/A N/A yaml safe_dump grains default_flow_style False N/A N/A N/A N/A yaml representer SafeRepresenter yaml_representers yaml_reps N/A N/A N/A N/A yaml representer SafeRepresenter yaml_multi_representers yaml_multi_reps N/A N/A N/A N/A N/A N/A salt utils fopen gfn w+ fp_ N/A N/A N/A N/A fp_ write cstr N/A N/A N/A N/A IOError OSError N/A N/A msg Unable to write to grains file at {0}. Check permissions. N/A N/A N/A log error N/A N/A msg format gfn N/A fn_ N/A N/A N/A os path join N/A __opts__ N/A cachedir module_refresh N/A N/A N/A N/A N/A N/A salt utils flopen fn_ w+ fp_ N/A N/A N/A N/A fp_ write N/A N/A N/A N/A IOError OSError N/A N/A msg Unable to write to cache file {0}. Check permissions. N/A N/A N/A log error N/A N/A msg format fn_ N/A N/A N/A N/A __opts__ get local False N/A N/A N/A N/A __salt__ N/A saltutil.sync_grains N/A new_grains N/A setval N/A N/A key val destructive N/A False N/A N/A 
    Set a grains value in the grains config file

    :param Destructive: If an operation results in a key being removed, delete the key, too. Defaults to False.

    CLI Example:

    .. code-block:: bash

        salt '*' grains.setval key val
        salt '*' grains.setval key "{'sub-key': 'val', 'sub-key2': 'val2'}"
     N/A N/A setvals N/A key val destructive N/A append N/A N/A key val convert delimiter N/A False DEFAULT_TARGET_DELIM N/A N/A 
    .. versionadded:: 0.17.0

    Append a value to a list in the grains config file. If the grain doesn't
    exist, the grain key is added and the value is appended to the new grain
    as a list item.

    key
        The grain key to be appended to

    val
        The value to append to the grain key

    :param convert: If convert is True, convert non-list contents into a list.
        If convert is False and the grain contains non-list contents, an error
        is given. Defaults to False.

    :param delimiter: The key can be a nested dict key. Use this parameter to
        specify the delimiter you use, instead of the default ``:``.
        You can now append values to a list in nested dictionary grains. If the
        list doesn't exist at this level, it will be created.

        .. versionadded:: 2014.7.6

    CLI Example:

    .. code-block:: bash

        salt '*' grains.append key val
     N/A grains N/A get key N/A delimiter N/A N/A N/A N/A isinstance grains list N/A convert True N/A N/A grains N/A grains N/A N/A N/A isinstance grains list N/A N/A N/A N/A The key {0} is not a valid list format key N/A N/A val grains N/A N/A N/A N/A The val {0} was already in the list {1} format val key N/A N/A isinstance val list N/A N/A item val N/A N/A N/A N/A grains append item N/A N/A N/A N/A grains append val N/A N/A delimiter key N/A N/A N/A key rest N/A N/A key rsplit delimiter 1 N/A _grain N/A get key N/A _infinitedict delimiter N/A N/A isinstance _grain dict N/A N/A N/A N/A _grain update N/A rest grains N/A grains _grain N/A N/A setval key grains N/A remove N/A N/A key val delimiter N/A DEFAULT_TARGET_DELIM N/A N/A 
    .. versionadded:: 0.17.0

    Remove a value from a list in the grains config file

    :param delimiter: The key can be a nested dict key. Use this parameter to
        specify the delimiter you use, instead of the default ``:``.
        You can now append values to a list in nested dictionary grains. If the
        list doesn't exist at this level, it will be created.

        .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' grains.remove key val
     N/A grains N/A get key N/A delimiter N/A N/A N/A isinstance grains list N/A N/A N/A N/A The key {0} is not a valid list format key N/A N/A val grains N/A N/A N/A N/A The val {0} was not in the list {1} format val key N/A N/A N/A grains remove val N/A N/A delimiter key N/A N/A N/A key rest N/A N/A key rsplit delimiter 1 N/A _grain N/A get key None delimiter N/A N/A isinstance _grain dict N/A N/A N/A N/A _grain update N/A rest grains N/A grains _grain N/A N/A setval key grains N/A delval N/A N/A key destructive N/A False N/A N/A 
    .. versionadded:: 0.17.0

    Delete a grain from the grains config file

    :param destructive: Delete the key, too. Defaults to False.

    CLI Example:

    .. code-block:: bash

        salt '*' grains.delval key
     N/A N/A setval key None destructive destructive N/A ls N/A N/A N/A N/A N/A 
    Return a list of all available grains

    CLI Example:

    .. code-block:: bash

        salt '*' grains.ls
     N/A N/A sorted __grains__ N/A filter_by N/A N/A lookup_dict grain merge default base N/A os_family None default None N/A N/A 
    .. versionadded:: 0.17.0

    Look up the given grain in a given dictionary for the current OS and return
    the result

    Although this may occasionally be useful at the CLI, the primary intent of
    this function is for use in Jinja to make short work of creating lookup
    tables for OS-specific data. For example:

    .. code-block:: jinja

        {% set apache = salt['grains.filter_by']({
            'Debian': {'pkg': 'apache2', 'srv': 'apache2'},
            'RedHat': {'pkg': 'httpd', 'srv': 'httpd'},
        }, default='Debian') %}

        myapache:
          pkg.installed:
            - name: {{ apache.pkg }}
          service.running:
            - name: {{ apache.srv }}

    Values in the lookup table may be overridden by values in Pillar. An
    example Pillar to override values in the example above could be as follows:

    .. code-block:: yaml

        apache:
          lookup:
            pkg: apache_13
            srv: apache

    The call to ``filter_by()`` would be modified as follows to reference those
    Pillar values:

    .. code-block:: jinja

        {% set apache = salt['grains.filter_by']({
            ...
        }, merge=salt['pillar.get']('apache:lookup')) %}


    :param lookup_dict: A dictionary, keyed by a grain, containing a value or
        values relevant to systems matching that grain. For example, a key
        could be the grain for an OS and the value could the name of a package
        on that particular OS.
    :param grain: The name of a grain to match with the current system's
        grains. For example, the value of the "os_family" grain for the current
        system could be used to pull values from the ``lookup_dict``
        dictionary.
    :param merge: A dictionary to merge with the results of the grain selection
        from ``lookup_dict``. This allows Pillar to override the values in the
        ``lookup_dict``. This could be useful, for example, to override the
        values for non-standard package names such as when using a different
        Python version from the default Python version provided by the OS
        (e.g., ``python26-mysql`` instead of ``python-mysql``).
    :param default: default lookup_dict's key used if the grain does not exists
        or if the grain value has no match on lookup_dict.  If unspecified
        the value is "default".

        .. versionadded:: 2014.1.0

    :param base: A lookup_dict key to use for a base dictionary.  The
        grain-selected ``lookup_dict`` is merged over this and then finally
        the ``merge`` dictionary is merged.  This allows common values for
        each case to be collected in the base and overridden by the grain
        selection dictionary and the merge dictionary.  Default is unset.

        .. versionadded:: 2015.5.0

    CLI Example:

    .. code-block:: bash

        salt '*' grains.filter_by '{Debian: Debheads rule, RedHat: I love my hat}'
        # this one will render {D: {E: I, G: H}, J: K}
        salt '*' grains.filter_by '{A: B, C: {D: {E: F,G: H}}}' 'xxx' '{D: {E: I},J: K}' 'C'
        # next one renders {A: {B: G}, D: J}
        salt '*' grains.filter_by '{default: {A: {B: C}, D: E}, F: {A: {B: G}}, H: {D: I}}' 'xxx' '{D: J}' 'F' 'default'
        # next same as above when default='H' instead of 'F' renders {A: {B: C}, D: J}
     N/A ret N/A N/A lookup_dict get N/A N/A N/A salt utils traverse_dict_and_list __grains__ grain None N/A N/A lookup_dict get default None N/A N/A base N/A base lookup_dict N/A N/A base_values N/A lookup_dict N/A base N/A N/A ret None N/A N/A ret base_values N/A N/A N/A isinstance base_values N/A collections Mapping N/A N/A N/A N/A isinstance ret N/A collections Mapping N/A N/A N/A SaltException filter_by default and look-up values must both be dictionaries. N/A ret N/A N/A N/A N/A salt utils dictupdate update N/A N/A copy deepcopy base_values ret N/A merge N/A N/A N/A N/A isinstance merge N/A collections Mapping N/A N/A N/A SaltException filter_by merge argument must be a dictionary. N/A N/A ret None N/A N/A ret merge N/A N/A N/A N/A N/A N/A salt utils dictupdate update ret N/A N/A copy deepcopy merge N/A ret N/A _dict_from_path N/A N/A path val delimiter N/A DEFAULT_TARGET_DELIM N/A N/A 
    Given a lookup string in the form of 'foo:bar:baz" return a nested
    dictionary of the appropriate depth with the final segment as a value.

    >>> _dict_from_path('foo:bar:baz', 'somevalue')
    {"foo": {"bar": {"baz": "somevalue"}}
     N/A nested_dict N/A _infinitedict N/A keys N/A N/A path rsplit delimiter N/A lastplace N/A reduce N/A operator getitem N/A keys N/A -1 nested_dict N/A N/A lastplace N/A N/A keys N/A -1 val N/A nested_dict N/A get_or_set_hash N/A N/A name length chars N/A 8 abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+) N/A N/A 
    Perform a one-time generation of a hash and write it to the local grains.
    If that grain has already been set return the value instead.

    This is useful for generating passwords or keys that are specific to a
    single minion that don't need to be stored somewhere centrally.

    State Example:

    .. code-block:: yaml

        some_mysql_user:
          mysql_user:
            - present
            - host: localhost
            - password: {{ salt['grains.get_or_set_hash']('mysql:some_mysql_user') }}

    CLI Example:

    .. code-block:: bash

        salt '*' grains.get_or_set_hash 'django:SECRET_KEY' 50

    .. warning::

        This function could return strings which may contain characters which are reserved
        as directives by the YAML parser, such as strings beginning with ``%``. To avoid
        issues when using the output of this function in an SLS file containing YAML+Jinja,
        surround the call with single quotes.
     N/A ret N/A get name None N/A N/A ret None N/A N/A val N/A N/A join N/A N/A N/A N/A N/A random SystemRandom choice chars N/A _ N/A range length N/A N/A DEFAULT_TARGET_DELIM name N/A N/A N/A root rest N/A N/A name split DEFAULT_TARGET_DELIM 1 N/A curr N/A get root N/A _infinitedict N/A val N/A _dict_from_path rest val N/A N/A N/A curr update val N/A N/A setval root curr N/A N/A N/A setval name val N/A N/A get name N/A set N/A N/A key val force destructive delimiter N/A False False DEFAULT_TARGET_DELIM N/A N/A 
    Set a key to an arbitrary value. It is used like setval but works
    with nested keys.

    This function is conservative. It will only overwrite an entry if
    its value and the given one are not a list or a dict. The ``force``
    parameter is used to allow overwriting in all cases.

    .. versionadded:: 2015.8.0

    :param force: Force writing over existing entry if given or existing
                  values are list or dict. Defaults to False.
    :param destructive: If an operation results in a key being removed,
                  delete the key, too. Defaults to False.
    :param delimiter:
        Specify an alternate delimiter to use when traversing a nested dict,
        the default being ``:``

    CLI Example:

    .. code-block:: bash

        salt '*' grains.set 'apps:myApp:port' 2209
        salt '*' grains.set 'apps:myApp' '{port: 2209}'
     N/A ret N/A comment changes result N/A True N/A _new_value_type simple N/A N/A isinstance val dict N/A N/A _new_value_type complex N/A N/A N/A isinstance val list N/A N/A _new_value_type complex N/A _non_existent N/A object N/A _existing_value N/A get key _non_existent delimiter N/A _value _existing_value N/A _existing_value_type simple N/A N/A _existing_value _non_existent N/A N/A _existing_value_type None N/A N/A N/A isinstance _existing_value dict N/A N/A _existing_value_type complex N/A N/A N/A isinstance _existing_value list N/A N/A _existing_value_type complex N/A N/A N/A _existing_value_type None N/A _existing_value val N/A N/A val None N/A destructive True N/A N/A N/A ret N/A comment Grain is already set N/A ret N/A N/A N/A _existing_value None N/A force N/A N/A N/A _existing_value_type complex N/A N/A N/A ret N/A comment N/A N/A N/A The key '{0}' exists but is a dict or a list.  format key Use 'force=True' to overwrite. N/A N/A ret N/A result False N/A ret N/A N/A N/A N/A _new_value_type complex N/A _existing_value_type None N/A N/A N/A ret N/A comment N/A N/A N/A The key '{0}' exists and the given value is a  format key dict or a list. Use 'force=True' to overwrite. N/A N/A ret N/A result False N/A ret N/A N/A _value val N/A N/A _value val N/A N/A delimiter key N/A N/A N/A key rest N/A N/A key rsplit delimiter 1 N/A _existing_value N/A get key N/A delimiter N/A N/A isinstance _existing_value dict N/A N/A N/A N/A _value None destructive N/A N/A N/A rest N/A N/A _existing_value keys N/A N/A N/A N/A _existing_value pop rest N/A N/A N/A N/A _existing_value update N/A rest _value N/A N/A N/A isinstance _existing_value list N/A N/A _list_updated False N/A N/A _index _item N/A enumerate _existing_value N/A N/A N/A _item rest N/A N/A N/A _existing_value N/A _index N/A rest _value N/A _list_updated True N/A N/A N/A N/A isinstance _item dict N/A rest _item N/A N/A N/A N/A _item update N/A rest _value N/A _list_updated True N/A N/A _list_updated N/A N/A N/A N/A _existing_value append N/A rest _value N/A N/A N/A N/A _existing_value rest force N/A N/A _existing_value N/A rest _value N/A N/A N/A ret N/A comment N/A N/A N/A N/A The key '{0}' value is '{1}',  format key _existing_value N/A N/A which is different from the provided key '{0}'.  format rest Use 'force=True' to overwrite. N/A N/A ret N/A result False N/A ret N/A _value _existing_value N/A _setval_ret N/A setval key _value destructive destructive N/A N/A isinstance _setval_ret dict N/A N/A N/A ret N/A changes _setval_ret N/A N/A N/A ret N/A comment _setval_ret N/A N/A ret N/A result False N/A ret N/A N/A fetch get