-
Notifications
You must be signed in to change notification settings - Fork 259
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
Add support for providing a dir to include_conf #151
base: master
Are you sure you want to change the base?
Conversation
58a9e59
to
791752b
Compare
Please include only files ending with ".conf" and not all files |
That's a good call and is far less messier than skipping files ending in .in ;) There's testing to ensure that the limited inclusion works as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Great idea. 100 of 100 points.
- Albeit I don't like adding new options to the
rsnapshot.conf
-file, this may be better to use as an extra option likeinclude_dir
orinclude_confdir
- no documentation at all... ugh.
- For the current PR code, this could be painful for others, using the
include_conf
-option already. - If you change the code, to use a new config-option, please document the config-option.
- For the current PR code, this could be painful for others, using the
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No documentation
I'm testing GH code review features currently. This is my first PR using this, sorry for the inconvenience with it. |
Sorry about the lack of changes to docs ... I'll get that sorted with an update I did have some thought about just extending include_conf though to handle directories ... It's a "lightest touch" with no additional options being added. users/admins who want to include don't need to special case including a directory versus including a conf snippet ... just use include_conf and let rsnapshot act appropriately. It's a fairly trivial change to add the include_conf_dir option instead ... but I just wanted to present my line of thinking first. Do you still want include_conf_dir as a separate option to include_conf ? And no problem on using this for testing the review features :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Great idea. 100 of 100 points.
- Albeit I don't like adding new options to the
rsnapshot.conf
-file, this may be better to use as an extra option likeinclude_dir
orinclude_confdir
- no documentation at all... ugh.
- For the current PR code, this could be painful for others, using the include_conf-option already.
- If you change the code, to use a new config-option, please document the config-option.
- Also hardcoding
*.conf
may not be the best. My personal favorite is, to pass a 2nd parameter to the option. This parameter will be a regex (or glob), which will be the regex for included files.
A regular use of this option would be:include_conf_dir /etc/rsnapshot.conf.d/ *.conf
Sorry, I did not get your recent answer before writing the my 'review'.
👍
I don't know why, but for some reasons, yes.
Most ppl probably expect, that |
That's fine - updating now ... I'm going to do a quick turnaround on the trivial addition of include_conf_dir which only looks for *.conf files ... and then there will be the final addition with the regex pattern after I'm a little happier and have done some testing around that |
@bebehei just in case the review stuff is confusing matters (since it has it listed as changes requested) The changes have been made - does this look good to you now or would you like any further refining? |
@bebehei As a heads up I've filed a ticket with FESCO to take over this package in Fedora, seeing as it's well out of date there and the maintainer didn't respond to an update bug. I'd really like to get this change in, if it's now acceptable to you, before pushing the next updates there next week :) |
rsnapshot-program.pl
Outdated
@@ -6716,6 +6739,28 @@ =head1 CONFIGURATION | |||
|
|||
=back | |||
|
|||
B<include_conf_dir> Include any files in this directory at this point, defaults ending in .conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
B<include_conf_dir [conf-file-pattern=*\.conf]>
would be better?
rsnapshot-program.pl
Outdated
@@ -6716,6 +6739,28 @@ =head1 CONFIGURATION | |||
|
|||
=back | |||
|
|||
B<include_conf_dir> Include any files in this directory at this point, defaults ending in .conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include any files in this directory at this point, defaults ending in .conf
Not very clear. It's not including "any files". Suggest replace with:
Include any files in this directory at this point. By default only files ending in .conf are included.
t/include_conf/include_conf.t.in
Outdated
use SysWrap; | ||
|
||
# | ||
# Write here in brief, what you want to check! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um what? Your supposed to replace that with your own doc describing your test...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And delete the rest of the instructional comments..
use SysWrap; | ||
|
||
# | ||
# Write here in brief, what you want to check! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dido.
rsnapshot-program.pl
Outdated
|
||
=over 4 | ||
|
||
This is also recursive configuration so it's important to be careful about what snippets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it "snippets" now? They're just included configuration files. Also suggest change to "... so its important included files don't cause an infinite loop".
Sorry for the noisy commenting - I thought I was doing a review but I was just commenting... LOL. Also need to squash your commits, down to one or two at most. Also note, rsnapshot will blow up on unrecognized options. Thus any new option is essentially not BWC. Pretty sure new options have been added since that |
Thanks for the comments/review (although I only just saw them, oddly I didn't get emailed) ... will make the amendments and squash the commits down in the next few days |
6e304e5
to
b6d7bf8
Compare
Apologies for this taking a while to come back to but life got in the way a bit ... I've made the changes you suggested, though i'm not sure what CS issue you were referring to before as the code was using tabs for spacing? As a heads up on an unrelated note Fedora now has 1.4.2 and we'll be pushing the release to EPEL soon. |
@bebehei @sam-at-github any further changes requested? |
@hogarthj I just pushed the CS fixes I was talking about - not sure why you couldn't see what I was talking about. One more thing: you tests are setup wrong which is why you had to add all those specific pattern to the .gitignore. I reverted the .gitignore. Please observe how other tests are setup and follow that. |
@sam-at-github whitespace blindness? or blame fatigue caused by my daughter? ;) Thanks for that - no idea how my eyes glossed over it. I tried to follow another test that was similar, which was what resulted in that. I'll take another look and clear it up to avoid the noise in gitignoe. |
Any chance this could get merged? It would be very useful for automating large operations. |
$conf_pat = '.*\.conf$'; | ||
} | ||
opendir(CONF_DIR, $value) or die $!; | ||
while (my $conf_file = readdir(CONF_DIR)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this will go all weird if any of the files in the directory themselves include an include_conf_dir
, as when it recurses it will re-use the CONF_DIR
handle. Please either test this to prove it doesn't happen, or read the entire directory into an array and then close it before processing the list of files, or use a lexically scoped handle.
With this commit a directory can be provided to include_conf (such as /etc/rsnapshot.d) and then each file inside (skipping files ending with .in to make the test situation easier) will be parsed into the config.
This then allows a base configuration and for whatever method is desired to drop files into this directory to add backup lines (as I imagine the common use case will be) to provide drop in configuration of targets.
This also adds testing for include_conf to ensure it works for no include_conf, with include_conf pointing to a file and include_conf pointing to a directory.