Forum: Cfengine Help
Subject: question on creating symlinks
Author: msvob...@linkedin.com
Link to topic: https://cfengine.com/forum/read.php?3,17550,17550#msg-17550

Howdy

I’m running cfengine 3.0.4 and am trying to create a symlink from 
/root/.profile to /.profile and cant seem to get the syntax correct.    Here’s 
what I’ve got...

In my promices.cf, I’m importing the following:

inputs          => {
                   "update.cf",
                   "cfengine_stdlib.cf",
                   "verify_root.cf",


In cfengine_stdlib.cf , it defines the ln_s link_from body to create symlinks.

body link_from ln_s(x)
{
link_type => "symlink";
source => "$(x)";
when_no_source => "force";
}



In verify_root.cf, I’m executing the following:

bundle agent verify_root
{
files:
    sunos_5_10::

                "/root/.profile"
                link            =>      ln_s("/.profile");
}

I know I’m calling this incorrectly, cause I get all sorts of nasty errors on 
the client side.

# /var/cfengine/bin/cf-agent -I -K                                              
             
cf3:/var/cfengine/inputs/verify_root.cf:30,28: Constraint lvalue link is not 
allowed in bundle category 'files', near token ')'
Body type mismatch for body reference "ln_s" in promise at line 30 of 
/var/cfengine/inputs/verify_root.cf



I’ve also tried the following:

                "/root/.profile"
                ln_s("/.profile");

Which spits back a ton of syntax errors:

# /var/cfengine/bin/cf-agent -I -K
cf3:/var/cfengine/inputs/verify_root.cf:30,7: syntax error, near token '('
cf3:/var/cfengine/inputs/acct_manager.cf:1,12: Something defined outside of a 
block or missing punctuation in input, near token '/.profile"'
cf3:/var/cfengine/inputs/acct_manager.cf:1,12: syntax error, near token 
'/.profile"'
cf3:/var/cfengine/inputs/acct_manager.cf:1,13: Something defined outside of a 
block or missing punctuation in input, near token ')'
cf3:/var/cfengine/inputs/acct_manager.cf:1,13: syntax error, near token ')'
cf3:/var/cfengine/inputs/acct_manager.cf:1,14: Something defined outside of a 
block or missing punctuation in input, near token ';'
cf3:/var/cfengine/inputs/acct_manager.cf:1,14: syntax error, near token ';'
cf3:/var/cfengine/inputs/acct_manager.cf:2,1: Something defined outside of a 
block or missing punctuation in input, near token '}'
cf3:/var/cfengine/inputs/acct_manager.cf:2,1: syntax error, near token '}'



What is the correct syntax to call the ln_s body link_from stanza when trying 
to create a symlink?  Trying to read through the reference manual, this isn’t 
very clear on how this should be called.

Cheers
Mike

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

Reply via email to