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

Can not figure out how to add and env_keep line to an included file. #32

Open
rahedges opened this issue Apr 8, 2016 · 1 comment
Open

Comments

@rahedges
Copy link

rahedges commented Apr 8, 2016

I have file that I'm trying to include. The non-salt version looks like this:

jenkins` ALL=NOPASSWD: /usr/sbin/cowbuilder, /usr/sbin/chroot, /usr/bin/pbuilder
Defaults env_keep+="DEB_* DIST ARCH ADT BUILDBRANCHSTR APPVERSIONSTR  DEB_KEEP_BUILD_ENV"

I have figured out how to write the first line in a pillar, but can get the syntax right for the env_keep+= line. Does anyone have any suggestions?

Currently I am trying a pillar like this:

sudoers:
  includedir: /etc/sudoers.d
  included_files:
    /etc/sudoers.d/91-jenkins:
      users:
        jenkins:
          - 'ALL=NOPASSWD: /usr/sbin/cowbuilder'
          - 'All=NOPASSWD: /usr/sbin/chroot'
          - 'ALL=NOPASSWD: /usr/bin/pbuilder'
      defaults:
        - env_keep='"DEB_* DIST ARCH ADT BUILDBRANCHSTR APPVERSIONSTR  DEB_KEEP_BUILD_ENV"'

I have tried several other versions of this, but get the error:

Unable to manage file: Jinja variable 'list object' has no attribute 'get'
Without the "env_keep" line the pillar is processed properly.

@madrisan
Copy link

You should just add one line at a time:

sudoers:
  includedir: /etc/sudoers.d
  included_files:
    /etc/sudoers.d/91-jenkins:
      users:
        jenkins:
          - 'ALL=NOPASSWD: /usr/sbin/cowbuilder'
          - 'All=NOPASSWD: /usr/sbin/chroot'
          - 'ALL=NOPASSWD: /usr/bin/pbuilder'
      defaults:
        generic:
          - env_keep += "DEB_*"
          - env_keep += "DIST"
          - env_keep += "ARCH"
          - env_keep += "ADT"
          - env_keep += "BUILDBRANCHSTR"
          - env_keep += "APPVERSIONSTR"
          - env_keep += "DEB_KEEP_BUILD_ENV"      

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants