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

ncm-cron: cleanup and switch to 00-tqu #1124

Merged
merged 2 commits into from
Aug 30, 2017
Merged

Conversation

stdweird
Copy link
Member

@stdweird stdweird commented Jun 14, 2017

Requires quattor/CAF#230

@stdweird stdweird added this to the 17.6 milestone Jun 14, 2017
=cut


# TODO: switch to 17.3.1 for listdir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reminder to fix this before merging

@stdweird
Copy link
Member Author

@ned21 i piushed the fix. now that 17.3 i out, i can make 17.3.1 rpms for myself


use constant CRON_LOGFILE_SUBDIR => "/var/log/";
# TODO: double check if this is true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the doubt here? Any chance of confirming this before merging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, yes. there is/was some LC code in here, i will have to doublecheck.

# NCM-CRON START:
# NCM-CRON END:
my $crondir = $osname eq "solaris" ? $CRONDIR_SOLARIS : $CRONDIR_LINUX;
my $all_files = $self->listdir($crondir,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, note to self: this is ugly, probably deserves it's own option (listing a dir and returning all files sounds very common for cfgmgt toolkit)

if ($to_unlink =~ m{^($linux_crondir/.*$cron_entry_regexp)$}) {
$to_unlink = $1; # $to_unlink is now untainted
if ($path =~ m{^($CRONDIR_LINUX/.*$cron_entry_regexp)$}) {
my $to_unlink = $1; # $to_unlink is now untainted
$self->info("Deleting $to_unlink");
LC::Check::absence($to_unlink, file => "True");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: replace with CAF::Path

@ttyS4
Copy link
Contributor

ttyS4 commented Jun 19, 2017

Can someone summarize what this change is about?
Maybe it is just me, but "00-tqu" does not mean anything to me :-)

@stdweird
Copy link
Member Author

@ttyS4 i'm doing cleanup of all components, see http://www.quattor.org/documentation/2017/02/10/components-spring17-cleaning.html
00-tqu is a common unittest that tests module loading, documentation test, perlcrtitic, non-fatal perltidy and TT render tests (if any).
normally this is cleanup only, unless there are commits that suggest otherwise.

@stdweird
Copy link
Member Author

@ned21 remarks addressed

@ned21
Copy link
Contributor

ned21 commented Jun 20, 2017

The Jenkins machine's SSL cert expired so I can't view the results to see why it failed

# NCM-CRON END:
my $crondir = $osname eq "solaris" ? $CRONDIR_SOLARIS : $CRONDIR_LINUX;

# Files only. See remark about LC::Check::absence below
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is confusing. I have to search forward to find another comment (which may well get deleted in the future) to understand it. If I have understood the comment correctly then I think a better way to say it would be:

# Files only. Do not modify listdir() call to return of directories unless 
# CAF::Path::cleanup has also been modified to support directories.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but cleanup should be modified to support a mode where only files are deleted, and anything else is ignored/skipped (that's what the old absence(Files => True) is about

if ($path =~ m{^($CRONDIR_LINUX/.*$cron_entry_regexp)$}) {
my $to_unlink = $1; # $to_unlink is now untainted
# This used to be done with LC::Check::absence(file => True)
# but this is a loop over files only, so it's safe to use CAF::Path::cleanup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the consequences of a directory ending up in here so bad that it should be explicitly checked whether it's a directory or a file before passing to cleanup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be backwards incompatible, but i don't think this is bad.

@stdweird
Copy link
Member Author

@ned21 comment modified, i hope it is clearer now

@ned21
Copy link
Contributor

ned21 commented Jun 28, 2017

Thanks. I'm good with this - just need to pass the tests now :)

@jrha
Copy link
Member

jrha commented Aug 30, 2017

@hpcugentbot retest this please

@jrha
Copy link
Member

jrha commented Aug 30, 2017

@ned21 passes tests, are you happy to approve?

@ned21 ned21 merged commit 2cdf354 into quattor:master Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants