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-nss: replace LC::Check with FileWriter #810

Merged
merged 2 commits into from
Aug 22, 2016

Conversation

ned21
Copy link
Contributor

@ned21 ned21 commented Jul 13, 2016

Use FileWriter instead of LC::Check and add a simple unit test of the
behaviour.

@ned21 ned21 added this to the 16.8 milestone Jul 13, 2016
@@ -0,0 +1,15 @@
object template simple;

#function pkg_repl = { null; };
Copy link
Member

Choose a reason for hiding this comment

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

remove if unused

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be nice to test the schema too by including config.pan but I can't remember why this didn't work now - I wrote the code too long ago. :( What's recommended best practice here?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

user-defined validation failed
element path: '/software/components/nss/version'
element value: 16.2.1-SNAPSHOT

because the component type only allows digits in this field.

Copy link
Member

Choose a reason for hiding this comment

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

use 'version' ?= '${no-snapshot-version}';

function pkg_repl = { null; };
include 'components/nss/config';
"/software/components/nss/dependencies/pre" = null;
# a version of 16.2.1-SNAPSHOT fails validation so unset
Copy link
Member

Choose a reason for hiding this comment

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

please remove again

Use FileWriter instead of LC::Check and add a simple unit test of the
behaviour.

Also minor clean up to the logging to use info instead of just log(),
and do not output a confusing statement in --noaction mode.

Minor whitespace clean up.
if ($result) {
$self->log("updated /etc/nsswitch.conf");
$self->info("updated /etc/nsswitch.conf") unless $NoAction;
Copy link
Member

Choose a reason for hiding this comment

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

this looks like some idiom to add to CAF, but also related to quattor/CAF#100.
in any case, most components do not make this distinction (and it should be handeled on e.g. CAF level).

anyway, what is interesting is that the tests pass without any definition of $NoAction (i expected use strict or use warning to at least make some noise)

Copy link
Member

Choose a reason for hiding this comment

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

wrt NoAction, in the old components code, we extend the NCM::Component namespace by diretc manipulation of ISA, and the $NoAction variable is the one set here: https://github.com/quattor/ncm-ncd/blob/master/src/main/perl/Component.pm#L15
if you would switch to the use parent qw(NCM::Component), this would fail, and you would have to use $CAF::Object::NoAction. as the NoAction is read most of the time, this is ok.

@ned21
Copy link
Contributor Author

ned21 commented Aug 20, 2016

Anything to be done here to get this into 16.8?

"/software/components/${project.artifactId}/active" ?= true ;
"/software/components/${project.artifactId}/dispatch" ?= false ;
"/software/components/${project.artifactId}/version" = "${project.version}";
"/software/components/${project.artifactId}/active" ?= true ;
Copy link
Member

Choose a reason for hiding this comment

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

copy paste the code in the comment referenced above, e.g. to use prefix here

@stdweird
Copy link
Member

small remark wrt to the pan template cleanup. can you also open an issue in CAF to provide something generic to handle noaction-releated reporting like the $self->info("updated /etc/nsswitch.conf") unless $NoAction;
is ready to merge otherwise

@ned21
Copy link
Contributor Author

ned21 commented Aug 22, 2016

config.pan updated and quattor/CAF#185 opened.

@stdweird
Copy link
Member

@ned21 thx
LGTM

@stdweird stdweird merged commit 0328b2f into quattor:master Aug 22, 2016
@ned21 ned21 deleted the ncm-nss-tests branch February 15, 2017 12:56
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.

2 participants