saltstack-formulas / zabbix-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
50 stars 121 forks source link

feat(agent): allow use of string Server and ServerActive #149

Closed ghormoon closed 3 years ago

ghormoon commented 3 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

None

Describe the changes you're proposing

Allow to use string as Server and ServerActive in agent. It's expecially useful if yhe master is using "pillar_merge_lists: True" as you can't change it for the spefic keys, only globally. This allows you to decide to use a way, that will actually overwrite, not merge, if you have a generic value in generic pillar, that you need to overwrite in more specific pillar. No change for people using it as a list. I doubt anyone is using the string currently, as it will produce something like "Server=h,o,s,t,n,a,m,e,.,x,x,x", which doesn't make sense (and will throw up error if the hostname.xxx has multiple instances of the same letter), so i consider it nonbreaking change.

Pillar / config required to test the proposed changes

Master with setting: pillar_merge_lists: True list way:

generic pillar:

zabbix-agent:
  server:
    - hostname1.xxx
  serveractive:
    - hostname1.xxx

specific pillar:

zabbix-agent:
  server:
    - hostname2.xxx
  serveractive:
    - hostname2.xxx

string way: generic pillar:

zabbix-agent:
  server: hostname1.xxx
  serveractive: hostname1.xxx

specific pillar:

zabbix-agent:
  server: hostname2.xxx
  serveractive: hostname2.xxx

Debug log showing how the proposed changes work

files contain:

before change: list syntax string syntax
merge true Server=hostname1.xxx,hostname2.xxx Server=h,o,s,t,n,a,m,e,2,.,x,x,x
merge false Server=hostname2.xxx Server=h,o,s,t,n,a,m,e,2,.,x,x,x
after change: list syntax string syntax
merge true Server=hostname1.xxx,hostname2.xxx Server=hostname2.xxx
merge false Server=hostname2.xxx Server=hostname2.xxx

Documentation checklist

Testing checklist

hatifnatt commented 3 years ago

Also, please add information about supported types for zabbix-agent:server, zabbix-agent:serveractive to pillar.example.

ghormoon commented 3 years ago

example added

hatifnatt commented 3 years ago

@ghormoon sorry for delay, looks good for me now. Thanks for improvement!

saltstack-formulas-travis commented 3 years ago

:tada: This PR is included in version 1.2.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: