PR progress checklist (to be filled in by reviewers)
[ ] Changes to documentation are appropriate (or tick if not required)
[ ] Changes to tests are appropriate (or tick if not required)
[ ] Reviews completed
What type of PR is this?
Primary type
[x] [fix] A bug fix
Does this PR introduce a BREAKING CHANGE?
Potentially.
Currently all the examples seem to end with "/" if it's an directory, so should work. If user creates an include "/path/to/an/directory", it will only create "/path/to/an/", as it doesn't have a way to determine it better, than the slash at the end.
Strip the filename or glob at the end of the path, if it's not a directory
Pillar / config required to test the proposed changes
try with both a directory (ending in "/") and a file-like path in agent includes, i did with
zabbix:
lookup:
agent:
includes:
/etc/zabbix/zabbix_agent2.d/*.conf
/tmp/test/
Debug log showing how the proposed changes work
ID: /etc/zabbix/zabbix_agent2.d/*.conf
Function: file.directory
Name: /etc/zabbix/zabbix_agent2.d
Result: True
Comment: The directory /etc/zabbix/zabbix_agent2.d is in the correct state
Started: 22:48:22.035102
Duration: 2.741 ms
Changes:
ID: /tmp/test/
Function: file.directory
Name: /tmp/test
Result: True
Comment: Directory /tmp/test updated
Started: 22:48:22.038714
Duration: 3.47 ms
Changes:
----------
/tmp/test:
New Dir
Documentation checklist
no need to update examples/docs
Testing checklist
I did not write tests to this, is it necessary for such bugfix?
PR progress checklist (to be filled in by reviewers)
What type of PR is this?
Primary type
[fix]
A bug fixDoes this PR introduce a
BREAKING CHANGE
?Potentially. Currently all the examples seem to end with "/" if it's an directory, so should work. If user creates an include "/path/to/an/directory", it will only create "/path/to/an/", as it doesn't have a way to determine it better, than the slash at the end.
Related issues and/or pull requests
https://github.com/saltstack-formulas/zabbix-formula/issues/111
Describe the changes you're proposing
Strip the filename or glob at the end of the path, if it's not a directory
Pillar / config required to test the proposed changes
try with both a directory (ending in "/") and a file-like path in agent includes, i did with zabbix: lookup: agent: includes:
Debug log showing how the proposed changes work
Documentation checklist
no need to update examples/docs
Testing checklist
I did not write tests to this, is it necessary for such bugfix?