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

Allow setting package options such as version/refresh for all sls #315

Closed
wants to merge 1 commit into from

Conversation

dafyddj
Copy link
Contributor

@dafyddj dafyddj commented Jun 2, 2017

Tested on Debian and Windows.

For more flexibility with setting pkg options, I'm using the sls_block macro that I saw in nginx.ng formula.

@aboe76
Copy link
Member

aboe76 commented Jun 2, 2017

@dafyddj will test it this weekend and but so far it looks good. @iggy could you also take a look?

@aboe76
Copy link
Member

aboe76 commented Jun 3, 2017

tested on the following systems:

  • archlinux (OK)
  • opensuse Leap 42.2 (OK)
  • opensuse tumbleweed (OK)
  • debian 8 (OK)
  • debian 9 (OK)
  • ubuntu 17.04 (OK)
  • ubuntu 16.04 (OK)
  • centos 7 (OK)
  • fedora 25 (OK)
  • redhat 7 (OK)
  • freebsd 11.0 (OK)

So far no issues.

@aboe76 aboe76 requested a review from iggy June 8, 2017 08:38
@aboe76
Copy link
Member

aboe76 commented Jun 13, 2017

@0xf10e would you be so kind to review this, I think another set of eyes is always better.

@javierbertoli
Copy link
Member

javierbertoli commented Jun 13, 2017

I like the idea of being able to pass free options to the pkg resource, but the formula installs ~8 different packages and, if I'm getting this correctly, this PR adds a single package.opts dict to all the packages being installed, right? So it's assuming the different packages will always need the same options?

How about modify it like this, so options can be set on a per-package/service basis?

  • salt/defaults.yaml
salt_master:
 package:
   name: salt-master
   opt1: ...
   opt2: ...
 service:
   name: salt-master
   opt3: ...
   opt4: ...
salt_minion:
 package:
   name: salt-minion
   opt5: ...
   opt6: ....

and then, modify the states like:

  • salt/minion.sls
{% from "salt/map.jinja" import salt_settings, sls_block with context %}
salt-minion:
{% if salt_settings.install_packages %}
  pkg.installed:
    {{ sls_block(salt_settings.salt_minion.package) }}
{% endif %}
  service.running:
    {{ sls_block(salt_settings.salt_minion.service) }}

@dafyddj
Copy link
Contributor Author

dafyddj commented Jun 23, 2017

@javierbertoli I can see your point, but for my use case (version), I would prefer a common option, so I will leave this PR as it is.

@aboe76
Copy link
Member

aboe76 commented Jul 26, 2017

@dafyddj and @javierbertoli , I think you both have valid points, but the sls_block will open up more then the version option, so I am inclined to think the solution @javierbertoli gave is a better one.

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

Successfully merging this pull request may close these issues.

3 participants