Forum: CFEngine Help
Subject: Re: CFEngine Help: fileexists() on remote host
Author: zont1
Link to topic: https://cfengine.com/forum/read.php?3,24033,24037#msg-24037

Hi,

That's what I've been looking for. Thanks.

But... It doesn't work properly.

My code looks like this:

body agent control
{
    files_single_copy => { ".*" };
}

bundle agent domain
{

vars:

    "default"       string => "$(g.syncfiles)/default";
    "sysctl_conf"   slist => { "$(g.syncfiles)/$(profile)/etc/sysctl.conf", 
"$(default)/etc/sysctl.conf" };
...

files:

        "/etc/sysctl.conf"
            comment     => "Copy $(this.promiser) file for $(profile)",
            perms       => mog("0644", "root", "wheel"),
            copy_from   => remote_dcp("$(sysctl_conf)", "$(g.policyhost)"),
            classes     => if_repaired("start_sysctl");
...


After several running of cf-agent on the client I've got the following:

# cf-agent -I
 -> Updated /etc/sysctl.conf from source /opt/sync/profile1/etc/sysctl.conf on 
master.domain.org
 -> Object /etc/sysctl.conf had permission 600, changed it to 644
 -> Skipping single-copied file /etc/sysctl.conf
 -> Executing '/etc/rc.d/sysctl start' ...(timeout=-678,owner=-1,group=-1)
 -> Completed execution of /etc/rc.d/sysctl start
# cf-agent -I
# cf-agent -I
# cf-agent -I
# cf-agent -I
 -> Updated /etc/sysctl.conf from source /opt/sync/default/etc/sysctl.conf on 
master.domain.org
 -> Object /etc/sysctl.conf had permission 600, changed it to 644

Config file triggered to default profile, but why? Is there any idea?

Also $(this.promiser) doesn't work for that case. Example:


vars:

    "default"     string => "$(g.syncfiles)/default";
    "fileslist"   slist => { "$(g.syncfiles)/$(profile)$(this.promiser)", 
"$(default)$(this.promiser)" };
...

files:

        "/etc/sysctl.conf"
            comment     => "Copy $(this.promiser) file for $(profile)",
            perms       => mog("0644", "root", "wheel"),
            copy_from   => remote_dcp("$(fileslist)", "$(g.policyhost)"),
            classes     => if_repaired("start_sysctl");
...



Cf-agent just report about that:
Can't stat /opt/sync/profile1$(this.promiser) in files.copyfrom promise
Can't stat /opt/sync/default$(this.promiser) in files.copyfrom promise

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to