Skip to content

Top file enhancements - #24878

Merged
cachedout merged 10 commits into
saltstack:developfrom
cachedout:issue_12483
Aug 11, 2015
Merged

cachedout merged 10 commits into
saltstack:developfrom
cachedout:issue_12483

Conversation

@cachedout

Copy link
Copy Markdown
Contributor

Refs #12483

This is designed to make it easier to manage the currently undefined and effectively broken handling of multiple top files across mutiple environments.

This PR introduces some new configuration options: top_file_merging_strategy and env_order. They are both documented in the updated reference page.

This is currently a work-in-progress and will sit in the PR queue for a while so that people can provide feedback before we get it merged.

Comment thread salt/state.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put a check here to not include envs that do not exist in the return from the self.client.envs() call

@cachedout

Copy link
Copy Markdown
Contributor Author

Note: Add top_file_merging_strategy to mopts!

@jfindlay jfindlay added Expert Change pending-changes The pull request needs additional changes before it can be merged pending-discussion The issue or pull request needs more discussion before it can be closed or merged Core relates to code central or existential to Salt labels Jun 23, 2015
@cachedout cachedout changed the title [WIP NO MERGE] Top file enhancements Top file enhancements Jun 23, 2015
@mathom

mathom commented Jun 23, 2015

Copy link
Copy Markdown

Hey, I just tried out the top_file_merge: False option but it seems to still be merging my topfiles:

    Detected conflicting IDs, SLS IDs need to be globally unique.
    The conflicting ID is 'consul-service' and is found in SLS 'base:consul.install' and SLS 'pr_23:consul.install'

My topfiles look like:

{{env}}:
    '*':
        - common
    'consul-*':
        - common
        - consul.cluster

@arthurzenika

Copy link
Copy Markdown

Thanks for this implementation, we bumped into #12483 and from our point of view the top_file_merging_strategy: False would be our approach (modularity and simplicity). We'll try to find some time to test this on our setup to give you more informed feedback.

Reading some comments on #12483 this fix seems important.

@cachedout

Copy link
Copy Markdown
Contributor Author

Go Go Jenkins!

@cachedout

Copy link
Copy Markdown
Contributor Author

@mathom Sorry for the big delay in responding! That config value was actually incorrect and based on a previous approach I had, which I forgot to remove. I've updated the default config with the proper value. top_file_merging_strategy: same, should accomplish I think you're seeking.

Mike Place added 6 commits August 7, 2015 10:43
Add new option for top_file_merging_strategy to config

Add master config file option

Adding additional tests

Lexicographical test works

Make default strategy

Simplify to just an option about whether or not to merge

Changes

Implement ordered top files

Implement merge strategies and default top files

Lint

Doc rewrite and start on ordering

Remove debugging

Moving to env_order

Adding env_order

Still writing tests

More tests and docs
@cachedout cachedout removed pending-changes The pull request needs additional changes before it can be merged pending-discussion The issue or pull request needs more discussion before it can be closed or merged labels Aug 7, 2015
Comment thread doc/ref/states/top.rst Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These hostnames with the env contained within the ID were probably intentional. If you don't pin a minion to an env with the methods you mention below in "Choosing an Environment" then the environment is chosen from the top file. The result of this change means the webserver* minions are now in all the dev, qa, and prod environments!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I ended up removing these because I felt like they were making the documentation too difficult to understand.

@whiteinge

Copy link
Copy Markdown
Contributor

Wrapping one's head around top file compilation is headache-inducing; it's very possible I'm doing something wrong. Question about env_order. Given the config:

environment: staging

env_order:
  - staging
  - base

Shouldn't the top and bottom results be identical?

% salt 'kevin' state.show_top saltenv=base
kevin:
    ----------
    base:
        - wait

% salt 'kevin' state.show_top saltenv=staging
kevin:
    ----------
    staging:
        - foo

% salt 'kevin' state.show_top
kevin:
    ----------
    staging:
        - foo

@cachedout

Copy link
Copy Markdown
Contributor Author

@whiteinge First match wins, not the last match. Should it be the other way around? First match made sense to me, but maybe I'm being silly. :-/

@whiteinge

whiteinge commented Aug 10, 2015 via email

Copy link
Copy Markdown
Contributor

@cachedout

Copy link
Copy Markdown
Contributor Author

@whiteinge Ah, K. Thanks. Investigating.

@meggiebot meggiebot added the bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch label Aug 10, 2015
Spelling and top-file-only aditions
@rallytime

Copy link
Copy Markdown
Contributor

Note to self: Should go back to 2015.8.

cachedout pushed a commit that referenced this pull request Aug 11, 2015
@cachedout
cachedout merged commit 889b4d2 into saltstack:develop Aug 11, 2015
@rallytime rallytime added Bugfix - [Done] back-ported and removed bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch labels Aug 11, 2015
jfindlay added a commit that referenced this pull request Aug 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core relates to code central or existential to Salt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants