Skip to content

Proxy minions & straight minion using the same caching directory #34446

Closed

Description

@mirceaulinic

Description of Issue/Question

We have an hierarchical setup where the master of the proxy minions is itself a straigh minion of another master. We wrote custom modules for our minions (managed by the top master), defined inside the directories as "_modules", "_states", "_retuners" etc.
For our proxy minions, we also have custom modules, some of them made public (e.g.: net, bpg etc.), again stored under the same directories: "_modules", "_grains", "_states" etc.
It turns out they are using the same caching directory (under /var/cache/salt/minion/extmods/), creating conflicts.

Although the list of external modules for the minion should be as:

# ls -la /state/var/cache/salt/minion/files/base/_modules/
total 316
drwx------  2 root root   4096 Jul  4 09:30 .
drwxr-xr-x 58 root root   4096 Jun 30 13:17 ..
-rw-------  1 root root    252 Jul  4 09:58 cfnginx.py
-rw-------  1 root root   1460 Jul  4 09:58 cfutils.py
-rw-------  1 root root  23781 Jul  4 09:58 netdns.py
-rw-------  1 root root  20989 Jul  4 09:58 parted_cf.py

In the extmods directory we find:

# ls -la /state/var/cache/salt/minion/extmods/modules/
total 140
drwx------ 2 root root  4096 Jul  4 10:16 .
drwxr-xr-x 7 root root    74 Jul  4 10:16 ..
-rw------- 1 root root  5345 Jul  4 10:01 napalm_bgp.py
-rw------- 1 root root  5915 Jul  4 10:16 napalm_bgp.pyc
-rw------- 1 root root 25038 Jul  4 10:01 napalm_network.py
-rw------- 1 root root 23363 Jul  4 10:16 napalm_network.pyc
-rw------- 1 root root  5541 Jul  4 10:01 napalm_ntp.py
-rw------- 1 root root  5103 Jul  4 10:16 napalm_ntp.pyc

Whilst the cachedir for the proxies is empty:

# ls -la /state/var/cache/salt/proxy/extmods/
total 0
drwxr-xr-x 2 root root   6 Jul  4 10:02 .
drwxr-xr-x 6 root root 118 Mar  4 18:20 ..

Although the base files are cached:

# ls -la /state/var/cache/salt/proxy/files/base/_modules/
total 100
drwx------ 2 root root  4096 Jul  4 10:06 .
drwx------ 7 root root    79 Jul  4 10:06 ..
-rw------- 1 root root  5345 Jul  4 10:06 napalm_bgp.py
-rw------- 1 root root 25038 Jul  4 10:06 napalm_network.py
-rw------- 1 root root  5541 Jul  4 10:06 napalm_ntp.py

Setup

Minion config file:

# cat /etc/salt/minion
master: <master_ns>
environment: base

Proxy config file:

# cat /etc/salt/proxy
master: localhost
pki_dir: /etc/salt/pki/proxy
cachedir: /var/cache/salt/proxy
multiprocessing: False

In the proxy master, there is is specified the caching directory for jobs and data as:

# Directory to store job and cache data
cachedir: /var/cache/salt/proxy-master

Versions Report

Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: 0.6.4
      gitpython: 2.0.5
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: 1.2.5
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.3
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.5
        machine: x86_64
         system: Linux
        version: debian 8.5

Activity

  1. cro commented on Jul 6, 2016

    @cro
    Contributor

    Yes, the default cachedir for the proxy should be changed to something else. In the meantime, if you add

    cachedir: /var/cache/salt/proxy

    to /etc/salt/proxy

    does that fix the problem?

  2. added
    bug
    P4
    severity-medium
    on Jul 6, 2016
  3. added this to the Approved milestone on Jul 6, 2016
  4. added
    RIoT
    on Jul 6, 2016
  5. self-assigned this
    on Jul 6, 2016
  6. mirceaulinic commented on Jul 6, 2016

    @mirceaulinic
    ContributorAuthor

    Hi @cro, thanks for looking at this issue!
    The proxy config file is already configured like that (please see my previous comment).
    Is there anything else I can set in the minion or proxy-master config files?

  7. cro commented on Jul 6, 2016

    @cro
    Contributor

    I apologize, I missed that. The cachedir directive should fix this, so let me dig into it a little more and see where we are not referencing it properly.

  8. mirceaulinic commented on Jul 6, 2016

    @mirceaulinic
    ContributorAuthor

    Sure, let me know if you'll need further details - I assume it's not quite easy to reproduce this particular setup.

  9. modified the milestones: C 6, Approved on Jul 18, 2016
  10. added
    ZD
    on Aug 3, 2016
  11. cro commented on Aug 3, 2016

    @cro
    Contributor

    ZD 883

  12. modified the milestones: C 5, C 6 on Aug 8, 2016
  13. mirceaulinic commented on Aug 10, 2016

    @mirceaulinic
    ContributorAuthor

    Hi @cro,

    Thank you very much for fixing this issue.

    I have a quick question, just to make sure I understand properly: to make it work for our current setup do I need to specify any value for append_minionid_config_dirs as it defaults to cachedir, or that's necessary just in case the user want to use a different dir?

    Thank you!

  14. cro commented on Aug 10, 2016

    @cro
    Contributor

    @mirceaulinic For proxy minions append_minionid_config_dirs defaults to ['cachedir'], you are
    correct. So you can leave it unset. The config option takes a list, but the list can only have pki_dir, cachedir, and extension_modules (any combination of those three, but no others).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P4Proxy-MinionRIoTZDbugseverity-medium

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions