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

When creating directory that is included from agent config, strip filename or glob at the end #145

Merged
merged 1 commit into from
Apr 16, 2021

Conversation

ghormoon
Copy link

@ghormoon ghormoon commented Apr 15, 2021

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

  • [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.

Related issues and/or pull requests

#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:
- /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?

@hatifnatt hatifnatt merged commit 25de37e into saltstack-formulas:master Apr 16, 2021
@hatifnatt
Copy link
Collaborator

Thanks @ghormoon !

@saltstack-formulas-travis

🎉 This PR is included in version 1.0.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants