Using cfengine 3.0.1 and cfengine 3 svn 328:
Objective: find unowned files and assign them a default owner.
Problem: search_owners doesn't seem to really accept regexes, as documented 
examples suggest. Search_groups suffers this same malady. It's difficult to see 
how the required objective could be met without at least working character 
classes and the "+" operator.

Test case:
body common control {
        bundlesequence => { "s" };
}
bundle agent s {
 files:
        "/"
                file_select => noowner,
                perms => pnoowner,
                action => warn;
}

body file_select noowner {
        search_owners => { "[a-zA-Z0-9_.]+" };
        file_result => "!owner";
}

body action warn{
        action_policy => "warn";
}

body perms pnoowner {
        owners => { "root" };
        groups => { "root" };
}


Cf-promises -v -f ./test7.cf:
.
.
.
cf3   > Parsing file ./test7.cf
cf3:./test7.cf:13,38: Scalar item in search_owners => { [a-zA-Z0-9_.]+ } in 
rvalue is out of bounds (value should match pattern [a-zA-Z0-9_$.-]+), near 
token '}'
.
.
.


Cf-promises -d2 -f ./test7.cf:
.
.
.
------------------------------------------------
 - Checking inline constraint/arg file_select[(ext body)] => mappedval 
(bundle/body)
 ------------------------------------------------
Nothing to check for body reference
end CheckConstraintTypeMatch---------
  Post Check Constraint files: search_owners => {'[a-zA-Z0-9_.]+'}
 ------------------------------------------------
 - Checking inline constraint/arg search_owners[slist] => mappedval (l) 
[a-zA-Z0-9_$.-]+
 ------------------------------------------------
 ------------------------------------------------
 - Checking inline constraint/arg search_owners[slist] => mappedval (s) 
[a-zA-Z0-9_$.-]+
 ------------------------------------------------

CheckParseString(search_owners => [a-zA-Z0-9_.]+/[a-zA-Z0-9_$.-]+)
Deleting scope match
Object match exists
Adding scope data match
Regex [a-zA-Z0-9_$.-]+ did not match ([a-zA-Z0-9_.]+) exactly, but it matched a 
part of it.
IsCf3VarString([a-zA-Z0-9_.]+) - syntax verify
Found 0 variables in ([a-zA-Z0-9_.]+)
Validation: Scalar item in search_owners => { [a-zA-Z0-9_.]+ } in rvalue is out 
of bounds (value should match pattern [a-zA-Z0-9_$.-]+)
end CheckConstraintTypeMatch---------
  Post Check Constraint files: file_result =>!owner
.
.
.
--
Chris Faehl
Hosting Engineering Systems Manager, RightNow Technologies

_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to