voxpupuli / modulesync

Synchronize common files across your Git repositories.
Apache License 2.0
105 stars 49 forks source link

print warning when module from filter isn't in managed_modules.yml #78

Open bastelfreak opened 8 years ago

bastelfreak commented 8 years ago

I tried to update two modules today that weren't in our managed_modules.yml:

bastelfreak@bastelfreak-ws ~/modulesync_config $ bundle exec msync update -f hiera --message "modulesync 0.6.2" 
bastelfreak@bastelfreak-ws ~/modulesync_config $ bundle exec msync update -f jenkins --message "modulesync 0.6.2" 
bastelfreak@bastelfreak-ws ~/modulesync_config $

the output is nothing, which is very missleading. A warning/message would be cool instead.

james-powis commented 7 years ago

I suspect the problem is the use of a filter rather than a strict parameter...

https://github.com/voxpupuli/modulesync/blob/master/lib/modulesync.rb#L50

ways I can see this working is to add an option to provide a specific module which would could work without existing in the managed_modules.yml file... but this feels a bit risky... so perhaps validation of presence is desired...

alternatively an error could be thrown if nothing is found via:

raise 'filter did not match any of the modules in managed_modules.yml' if managed_modules.empty?

I would be happy to submit a PR for either solution

bittner commented 6 years ago

@james-powis The word "filter" suggests like we're actually filtering a list of modules (not overriding), so the latter solution resonates with the usage pattern. :+1: