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

Permit an absent preferences pillar data key #27

Merged

Conversation

boltronics
Copy link
Contributor

The preferences.sls file has a line like:
{% set preferences = apt.get('preferences', apt_map.preferences) %}

In my pillar sls, I had an if condition such as:

{%- if oscodename == 'jessie' %}
  preferences:
    python-tornado:
      package: python-tornado
      pin: release a=jessie-backports
      priority: 950
      explanation:
        - Dependency for salt-minion.
{%- endif %}

When instances were upgraded to stretch, the preference key was no longer used which resulted in Data failed to compile: errors when trying to run highstate (since apt.preferences is still listed there).

In theory, I could just update top.sls to also have the same if condition around the apt.preferences reference, however that approach would lead to unnecessary code duplication - particularly as more if conditions need to be added for different os releases. Instead, I propose here we set a default preferences key with the value of an empty dict so the state can complete without error but still essentially do nothing.

@aboe76 aboe76 requested a review from javierbertoli November 1, 2017 21:56
@javierbertoli javierbertoli merged commit 94403d9 into saltstack-formulas:master Nov 1, 2017
@javierbertoli
Copy link
Member

thanks guys!

@boltronics boltronics deleted the empty_preferences branch November 1, 2017 22:46
@aboe76
Copy link
Member

aboe76 commented Nov 2, 2017

@javierbertoli and @boltronics thanks for this.!

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