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

aii-ks: fix logging of pre and post script actions for EL7 #218

Merged
merged 2 commits into from
Nov 10, 2016

Conversation

jouvin
Copy link
Contributor

@jouvin jouvin commented Oct 31, 2016

Fixes #120

@jouvin jouvin added this to the 16.10 milestone Oct 31, 2016
@@ -692,13 +692,12 @@ sub log_action {
}

if ($consolelogging) {
push(@logactions, '# Make sure messages show up on the serial console',
"tail -f $logfile > /dev/console &");
push(@logactions, "tee $logfile", "tee /dev/pts/0");
Copy link
Member

Choose a reason for hiding this comment

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

i guess tail -f $logfile > /dev/pts/0 doesn't do the trick?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion! I didn't try, I will do it. Clearly if at the end this is just the matter of changin console to pts/0, it would be an easy change...

return join("\n", @logactions)
# push(@logactions,"drainsleep=$drainsleep"); # add trailing newline
# push(@logactions,''); # add trailing newline
return join(" | ", @logactions)
Copy link
Member

Choose a reason for hiding this comment

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

the remote logging feature generates after exec

(tail -f /tmp/pre-log.log | awk '{print "<190>AII: "$0; fflush(); system("usleep 1000 >& /dev/null");}' | nc -u gastly.gastly.os 515) &

i'm not sure how to replace this more pipes

@jouvin
Copy link
Contributor Author

jouvin commented Nov 2, 2016

@stdweird you're right! The problem is that /dev/console on EL7 has a new behaviour and that /dev/pts/0 must be used instead... Unfortunately, /dev/pts/0 doesn't exist at this point in the installation on EL6... so it is not as easy as replacing one by the other. The last commit provides a fixes tested successfully on EL6 (SL) and EL7 (Cent0S).

@jouvin
Copy link
Contributor Author

jouvin commented Nov 2, 2016

One of the unit test checking for the present of /dev/console still has to be fixed!

# resulting in unreadable messages on the console. /dev/pts/0 must be used instead.
# But on prior versions, /dev/pts/0 doesn't exist at installation time and cannot be used.
# The following code allows to use /dev/pts/0 if it exists else to revert to /dev/console.
push(@logactions, "console='/dev/console'");
Copy link
Member

Choose a reason for hiding this comment

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

there is no harm in always setting these variables early on, even if no consolelogging is used. this will allow a cleaner if/else construct, because this is a bit ugly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure to understand your point. Why it would be clearer to have it earlier? This variable definition in the %pre script is useful only if you use console logging, there is no real point in adding them otherwise. I would find it more confusing to have this defined unconditionally, both in the ks.pm code and the resulting %pre script...

Copy link
Member

Choose a reason for hiding this comment

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

it's a bit hackish. but i saw that i did similar hack for the wait time, so i'm not going to complain any further 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😄 In fact this is not that much a hack... These pre/post scripts are built using generated code and the resulting code is quite ok...

@jouvin
Copy link
Contributor Author

jouvin commented Nov 2, 2016

I don't really understand why the unit test kickstart_pre is failing (regexps/pre_noblock_logging). Any attempt to do the same test in a test perl script seems to work... Help would be greatly appreciated!

BTW, all these unit tests seem very fragile... On my SL6 machine, many (16) subtests of kickstart_pre are failing as kickstart_mounts, despite they success on Jenkins. I have the feeling we rely on something very installation-specific...

@jouvin
Copy link
Contributor Author

jouvin commented Nov 2, 2016

I managed to get the unit test 'kickstart_prepassing successfully after removing the following line fromregexps/pre_noblock_logging`:

^\[ -e /dev/pts/0 \] && console='/dev/pts/0'$

I am not sure what was wrong in it but I am not completely convinced of the value of testing each line this way...

@stdweird
Copy link
Member

stdweird commented Nov 2, 2016

the lines are tested to make sure they are not deleted/modified unintentionally. the test fails because you have -c instead of -e?
also, always run the tests with clean, and run them with verbose output, so we can help debugging.

@stdweird
Copy link
Member

stdweird commented Nov 2, 2016

inparticular, use quattor/quattor.github.com#146 (comment) to run the tests.

@jouvin
Copy link
Contributor Author

jouvin commented Nov 2, 2016

@stdweird I must really apologize for this -c versus -e mistake... I changed the initial -e to -c but tested the regexp on a machine where I forgot to update ks.pm... Unit tests are great 😄

@jouvin
Copy link
Contributor Author

jouvin commented Nov 2, 2016

For the record, the problems with kickstart_pre unit tests not related to this PR have been understood: it was caused by a too old ncm-lib-blockdevice. See #218 (comment).

@stdweird
Copy link
Member

stdweird commented Nov 2, 2016

@jouvin if you have tested this, can you remove the [WIP] in the title?

@jouvin jouvin changed the title [WIP] aii-ks: fix logging of pre and post script actions for EL7 aii-ks: fix logging of pre and post script actions for EL7 Nov 2, 2016
@stdweird
Copy link
Member

stdweird commented Nov 2, 2016

LGTM
@jouvin can you cleanup the description again? should probably only mention the issue it fixes

@jrha jrha merged commit 70dae2a into quattor:master Nov 10, 2016
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.

3 participants