Augments file def.json

15 views
Skip to first unread message

thierry thunot

unread,
Feb 27, 2023, 4:36:06 AM2/27/23
to help-cfengine
hello every body,
I have a question about augments files and how to used.
First I want to position variables in an augment file and use these variables in the def.json. especially for "admit ip"

the augment file: list.json

{
       "vars":
       {
               "liste_ip_opt_access": "192.168.10.45"
       }

}


Extract of def.json

{
       "augments":
       [
              "/var/cfengine/input/list.json"
       ],

.....
.....
"vars":
       {
              
               "dir_personnalisation":{
                               "path":"/opt",
                               "comment":"repertoire des fichiers ",
                               "handle":"server_access_grant_access_personnalisation",
                               "admit_ips":[
                                       "$(def.liste_ip_opt_access)"
                                       ]
                                       },
......

Then when i run cf-served the variable is not valued

verbose: Access control lists:
...
verbose:       Path: /opt/
verbose:               admit_ips: $(def.liste_ip_opt_access)

...

Is it possible in the def.json to use variables defined in augments file?

Nick Anderson

unread,
Feb 27, 2023, 3:04:17 PM2/27/23
to thierry thunot, help-c...@googlegroups.com

Hi Thierry,

First I want to position variables in an augment file and use these variables in the def.json. especially for "admit ip".

The notes in the def.json Augments Files documentation indicate that sys vars are expanded (unlike host_specific.json) which notes explicitly that it does not support expansion of CFEngine variables. So, perhaps we should update the wording there a bit to be more clear and say variables (except for sys vars) are not expanded.

Is it possible in the def.json to use variables defined in augments file?

No, it is not, at least those variables will not be expanded by the Augments processing, but CFEngine evaluation may expand them later.

thierry thunot

unread,
Feb 28, 2023, 1:12:15 PM2/28/23
to help-cfengine
thanks for your answer :)
Reply all
Reply to author
Forward
0 new messages