Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic File Roots #48132

Closed
BenjaminSchiborr opened this issue Jun 14, 2018 · 3 comments

Comments

Projects
None yet
5 participants
@BenjaminSchiborr
Copy link
Contributor

commented Jun 14, 2018

Description of Issue/Question

In our current environment we are using a mixture of information coming out of a git repository and from a local salt file server. Historically all information was always taken from the saltenv base environment (as in the master branch of the git repository and files that were locally on disk configured as the base saltenv)

However, we are moving forward to a new versioning model for git - requiring us to pull information from specific tags/branches. Thus, e.g. we call a salt runner providing a saltenv as a parameter. We have adapted our master configuration to then pull only from a git branch/tag that is equal to the saltenv.

This, however, does not seem to work with the local file server. It seems that you are required to always specify specific saltenvs for file_roots in the master config.

Example:
Imagine having a branch X in git. You are calling salt via "salt-run [...] saltenv=X". In that case anything in the local salt file server would not be found, unless you also specifically mentioned X in the master config.

Question

The question is if something like env also exists for file_roots - enabling you to specify one path on a local file server for all saltenvs?

Setup

Please find below a sanitized master configuration showing the issue:

state_top: salt://top.sls

fileserver_backend:
  - git
  - roots
file_roots:
  base:
    - /srv/salt
    - /srv/tops
pillar_roots:
  base:
    - /srv/pillar
  __env__:
    - /srv/pillar
pillarenv_from_saltenv: True

ext_pillar_first: True
ext_pillar:
  - git:
    - __env__ gitlab:Automation/salt:
      - root: pillar

gitfs_remotes:
  - gitlab:Automation/salt:
    - root: states

# Merge strategies
pillar_source_merging_strategy: recurse
top_file_merging_strategy: same
pillar_merge_lists: True

Steps to Reproduce Issue

  1. Have local file server with an sls for a runner
  2. Have a git repository with a branch X. Ensure that the runner requires something that is on branch X
  3. Ensure master config allows for dynamic usage of git branches via saltenv, but only specify base for file_roots
  4. Call salt-run with the runner against a saltenv X
  5. Salt-run will fail, because it cannot find the runner

Versions Report

Salt Version:
Salt: 2017.7.5

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
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.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.12 (default, Dec 4 2017, 14:50:18)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.2.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: Ubuntu 16.04 xenial
locale: UTF-8
machine: x86_64
release: 4.4.0-119-generic
system: Linux
version: Ubuntu 16.04 xenial

@gtmanfred

This comment has been minimized.

Copy link
Contributor

commented Jun 14, 2018

Correct, you have to specify the different env's in file_roots.

I am going to mark this as a feature request.

@terminalmage you might be interested in this request.

@gtmanfred gtmanfred added the Feature label Jun 14, 2018

@gtmanfred gtmanfred added this to the Approved milestone Jun 14, 2018

@cmclaughlin

This comment has been minimized.

Copy link
Contributor

commented Jul 5, 2018

I'd really like this too... I tried gitfs, but we have some use some formulas as git submodules and that didn't work (at least it didn't last time I checked).

If we could set a file_root "prefix" (and one for pillar_roots too), we could bust out all of our git branches into their own saltenvs (without restarting the master).

@terminalmage terminalmage self-assigned this Jul 23, 2018

sathieu added a commit to sathieu/salt that referenced this issue Dec 7, 2018

@sathieu

This comment has been minimized.

Copy link
Contributor

commented Dec 7, 2018

See #50784 for a tentative implementation.

sathieu added a commit to sathieu/salt that referenced this issue Dec 7, 2018

sathieu added a commit to sathieu/salt that referenced this issue Dec 8, 2018

sathieu added a commit to sathieu/salt that referenced this issue Dec 8, 2018

sathieu added a commit to sathieu/salt that referenced this issue Jan 17, 2019

sathieu added a commit to sathieu/salt that referenced this issue Jan 17, 2019

sathieu added a commit to sathieu/salt that referenced this issue Jan 17, 2019

sathieu added a commit to sathieu/salt that referenced this issue Jan 23, 2019

sathieu added a commit to sathieu/salt that referenced this issue Jan 23, 2019

sathieu added a commit to sathieu/salt that referenced this issue Jan 26, 2019

sathieu added a commit to sathieu/salt that referenced this issue Jan 26, 2019

@dwoz dwoz closed this in 7ca2aa4 Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.