-
Notifications
You must be signed in to change notification settings - Fork 15
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-dpmlfc: major rewrite to support DAV configuration #86
Conversation
- simplify code - update the rule-based editor by the one in ncm-xrootd
- Never add quattor comment to the pattern to ensure it works even if the line was not added by Quattor - Do not process rule if the keyword was negated - Improve logging
- Fix retrieval of global options - Ensure that `host` attribute is defined in role options
- Also adapt configure.t to new configureNode() interface
…provements/fixes - Options for a protocol can be defined globally rather than for each host - Config lines can be commented out on a per line/rule basis if the option is undef
- DPM DB config file - Certificate and private key
… fixes\ - Fix retrieval of global options (typo)'
- Update unit tests to cover each DAV rule
if ( $cond_attribute ) { | ||
# Due to Perl autovivification, testing directly exists($config_options->{$cond_option_set}->{$cond_attribute}) will spring | ||
# $config_options->{$cond_option_set} into existence if it doesn't exist. | ||
my $cond_true = exists($config_options->{$cond_option_set}) && |
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.
first exists is not needed
@stdweird what about |
- Implement suggestions by @stdweird on Dec. 30 in quattor#86
test this please |
@jouvin i added enum, tests pass again. (i forgot to do that yesterday, apologies for the delay) |
|
||
=cut | ||
|
||
sub _parse_rules { |
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.
the previous conversation was lost
I understand your point but the problem is how do you return a bunch of value from a Perl function (I know how to do it in Python!).
i would convert the curent variables in a hashref, and return the hashref
e.g.
sub _parse_one_rule
{
...
my $res = {};
$res->{value_fmt} = $value_fmt;
...
return $res;
}
(i'm not sure i understand your question though)
You basically need to return if the rule has to be applied or not and the parameter used to edit the line after the rule is parsed. That means one boolean and one hash. Do you consider that passing the hash as an argument and having it modified by the function is a good practice?
i am talking about a rule parser, i.e. something that converts
[condition->]attribute:option_set[,option_set,...];line_fmt
in
my $rule = {
condition => x,
attrinute => y,
option_set => [option1, ...],
line_fmt =>,
}
in particular, this method should retrun undef on failure and log error in case the rule is invalid, so it can be used e.g. for unittestting the rules. in particular, all rules should be valid/parsable before a single one is applied.
right now, you apply the rules one by one, and in case there is an issue, you continue, instead of doing a $fh->cancel
and return undef/stop.
…or->close() defines a return value - Ensure that set_caf_file_close_diff(1) is executed
afa17a5
to
f1777c1
Compare
With the last commit, the suggestion to have a distinct method for parsing rules has been implemented. Updated in both
As for me, this PR is ready for merging. |
BTW, deployed successfully at LAL. |
A bug was just uncovered at LAL in |
- Also removed LINE_VALUE_HOST_LIST from rule-based editor (not used anywhere, can be done with LINE_VALUE_ARRAY) - Unit tests improved - Rule-based editor updated in ncm-xrootd too
Pb fixed, new version deployed successfully at LAL, missing coverage in unit tests fixed. @jrha is there any change to have it included in 15.12, I saw that RC2 is out already, I know this is late but there are some important fixes for people using Quattor to manage DPM... |
ncm-dpmlfc: major rewrite to support DAV configuration
I spend a while thinking about this, but in the end decided that given it only touches one grid component which is known to have issues, it was better off merged. |
Thanks! |
This PR is a major rewrite of ncm-dpmlfc to support configuring DPM WebDav protocol with ncm-dpmlfc. To do this, the
ncm-xrootd
rule-based editor has been ported back to DPM to replace the original one. This rule-based editor has been slightly extended but should remain compatible with thencm-xrootd
one. The intent is to move it as a new CAF module (it probably represent 1/3 of the configuration module code currently).Another improvement in
ncm-dpmlfc
is in the schema: rather than specifying the protocol options for each node (whith usually the same options for all nodes), it is now possible to define the protocol options globally that will act as a default for each nodes where those options are not specified.In addition to this feature extension, there was an extensive rewrite of this configuration module to simplify the code. The old one was based on the assumption that both DPM and LFC could be configured on the same machine, something that has never been actually possible as both product have a (different) daemon listening the same port. This was leading to a very complicated processing of the configuration that has been streamlined. A few 100s of lines have been removed!
As part of this rewrite, unit tests have been added both for some of the rule-based editor features and for the whole
Configure
method with basically all the config files managed by the config module checked. This allowed to uncover quite a number of flaws in the original code and is a pretty good coverage of the whole code. The new version is test friendly: the fewLC::Check
calls still needed have been protected by testing$CAF::Object::NoAction. When tests are run in verbose mode, the output should produce no
ERROR` message in addition to passing the tests.This version has been deployed successfully at LAL yesterday and is almost ready for merging. The two remaining minor things to do are:
Having it part of 15.12 would be great! Thus the milestone. But I would understand that this is too late...