salt.runners.cache#
Return cached data from minions
- salt.runners.cache.clear_all(tgt=None, tgt_type='glob')#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Clear the cached pillar, grains, and mine data of the targeted minions
CLI Example:
salt-run cache.clear_all
- salt.runners.cache.clear_git_lock(role, remote=None, **kwargs)#
New in version 2015.8.2.
Remove the update locks for Salt components (gitfs, git_pillar, winrepo) which use gitfs backend code from salt.utils.gitfs.
Note
Running
cache.clear_allwill not include this function as it does for pillar, grains, and mine.Additionally, executing this function with a
roleofgitfsis equivalent to runningsalt-run fileserver.clear_lock backend=git.- role
Which type of lock to remove (
gitfs,git_pillar, orwinrepo)- remote
If specified, then any remotes which contain the passed string will have their lock cleared. For example, a
remotevalue of github will remove the lock from all github.com remotes.- typeupdate,checkout,mountpoint
The types of lock to clear. Can be one or more of
update,checkout, andmountpoint, and can be passed either as a comma-separated or Python list.New in version 2015.8.8.
Changed in version 2018.3.0:
mountpointlock type added
CLI Examples:
salt-run cache.clear_git_lock gitfs salt-run cache.clear_git_lock git_pillar salt-run cache.clear_git_lock git_pillar type=update salt-run cache.clear_git_lock git_pillar type=update,checkout salt-run cache.clear_git_lock git_pillar type='["update", "mountpoint"]'
- salt.runners.cache.clear_grains(tgt=None, tgt_type='glob')#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Clear the cached grains data of the targeted minions
CLI Example:
salt-run cache.clear_grains
- salt.runners.cache.clear_mine(tgt=None, tgt_type='glob')#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Clear the cached mine data of the targeted minions
CLI Example:
salt-run cache.clear_mine
- salt.runners.cache.clear_mine_func(tgt=None, tgt_type='glob', clear_mine_func_flag=None)#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Clear the cached mine function data of the targeted minions
CLI Example:
salt-run cache.clear_mine_func tgt='*' clear_mine_func_flag='network.interfaces'
- salt.runners.cache.clear_pillar(tgt=None, tgt_type='glob')#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Clear the cached pillar data of the targeted minions
CLI Example:
salt-run cache.clear_pillar
- salt.runners.cache.cloud(tgt, provider=None)#
Return cloud cache data for target.
Note
Only works with glob matching
- tgt
Glob Target to match minion ids
- provider
Cloud Provider
CLI Example:
salt-run cache.cloud 'salt*' salt-run cache.cloud glance.example.org provider=openstack
- salt.runners.cache.fetch(bank, key, cachedir=None)#
Fetch data from a salt.cache bank.
CLI Example:
salt-run cache.fetch cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/
- salt.runners.cache.flush(bank, key=None, cachedir=None)#
Remove the key from the cache bank with all the key content. If no key is specified remove the entire bank with all keys and sub-banks inside.
CLI Examples:
salt-run cache.flush cloud/active/ec2/myec2 cachedir=/var/cache/salt/ salt-run cache.flush cloud/active/ec2/myec2 myminion cachedir=/var/cache/salt/
- salt.runners.cache.grains(tgt, tgt_type='glob', **kwargs)#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Return cached grains of the targeted minions.
- tgt
Target to match minion ids.
Changed in version 2017.7.5,2018.3.0: The
tgtargument is now required to display cached grains. If not used, the function will not return grains. This optional argument will become mandatory in the Salt3001release.- tgt_type
The type of targeting to use for matching, such as
glob,list, etc.
CLI Example:
salt-run cache.grains '*'
- salt.runners.cache.list_(bank, cachedir=None)#
Lists entries stored in the specified bank.
CLI Example:
salt-run cache.list cloud/active/ec2/myec2 cachedir=/var/cache/salt/
- salt.runners.cache.migrate(src_driver='localfs', dst_driver='mmap_cache', bank=None, cachedir=None, dry_run=False)#
Migrate cache data from one backend driver to another.
By default migrates from
localfstommap_cache, which is the typical upgrade path when switching thecacheoption in/etc/salt/master.- src_driver
Source cache driver name (default:
localfs).- dst_driver
Destination cache driver name (default:
mmap_cache).- bank
Restrict migration to a specific bank (and all its sub-banks). If omitted, all banks under
cachedirare migrated.- cachedir
Cache root directory. Defaults to
opts['cachedir'].- dry_run
If
True, scan and count entries without writing anything.
CLI Examples:
# Preview what would be migrated salt-run cache.migrate dry_run=True # Migrate everything from localfs to mmap_cache salt-run cache.migrate # Migrate a single bank salt-run cache.migrate bank=minions/alpha # Migrate between other driver pairs salt-run cache.migrate src_driver=localfs dst_driver=mmap_cache
- salt.runners.cache.mine(tgt=None, tgt_type='glob', **kwargs)#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Return cached mine data of the targeted minions
CLI Example:
salt-run cache.mine
- salt.runners.cache.pillar(tgt=None, tgt_type='glob', **kwargs)#
Changed in version 2017.7.0: The
expr_formargument has been renamed totgt_type, earlier releases must useexpr_form.Return cached pillars of the targeted minions if tgt is set. If tgt is not set will return cached pillars for all minions.
CLI Example:
salt-run cache.pillar
- salt.runners.cache.store(bank, key, data, cachedir=None)#
Lists entries stored in the specified bank.
CLI Example:
salt-run cache.store mycache mykey 'The time has come the walrus said'