Hi there!

I have a replace_patterns issue.

- In /tmp/group I have the following:

root@cfengine:~# grep zenoss /tmp/group
zenoss:x:1001:

- I have the following cfengine code:

----------
body common control {
  bundlesequence => {
    "test"
  };
}

bundle agent test {
  files:
    "/tmp/group11"
      edit_line => replace_group;
}

bundle edit_line replace_group {
  vars:
    "group_lines" string => "zenoss:x:1001:user1,user2,user3";

  replace_patterns:
    "^zenoss.*$"
      replace_with => value("$(group_lines)");
}
----------

- After running cf-agent, /tmp/group looks like this, which is what I want:

root@cfengine:~# grep zenoss /tmp/group
zenoss:x:1001:user1,user2,user3

- Nevertheless there are a lot of errors, which I don't understand. If I
remove the $ from the end of the pattern, I got the same errors and
nothing happens:

----------
community>     .........................................................
community>     Promise handle:
community>     Promise made by: ^zenoss.*$
community>     .........................................................
community>
community>  -> Looking at pattern ^zenoss.*$
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (2)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (3)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (4)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (5)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (6)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (7)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (8)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (9)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (10)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (11)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (12)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (13)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (14)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (15)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (16)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (17)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (18)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (19)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (20)
community>  -> Verifying replacement of "^zenoss.*$" with
"zenoss:x:1001:user1,user2,user3" (21)
community>  !! Too many replacements on this line
community>  -> Replaced pattern "^zenoss.*$" in /tmp/group
community>  -> << (22)"zenoss:x:1001:user1,user2,user3"
community>  -> >> (22)"zenoss:x:1001:user1,user2,user3"
community>  -> Promised replacement "zenoss:x:1001:user1,user2,user3" for
pattern "^zenoss.*$" is not properly convergent while editing /tmp/group
community> Because the regular expression "^zenoss.*$" still matches the
end-state replacement string "zenoss:x:1001:user1,user2,user3"
community> Promise (version not specified) belongs to bundle
'replace_group' in file '/var/cfengine/inputs/promises.cf' near line 163
----------

Anyone?

Kind regards,

Dennis
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to