cfengine - CFE syntax errors -
trying write cfengine3 promise take entire directory , move down 1 level.
i've used policy hub distribute promise, i've not yet folded active promise.cf
here's promise:
body common control { bundlesequence => { dirstructure }; } #find out existance of directories if filesystem old structure or new #set classes each instance. if old, copy down 1 level. #if new file system already, pat on bundle agent dirstructure { classes: "oldfilestructure"expression => isdir("/old/dir/structure/"); "newfilestructure" expression => isdir("/new/dir/structure/"); reports: oldfilestructure:: "system has old file structure.."; newfilestructure:: "system has new file structure.."; methods: oldfilestructure:: "migratedirectories" usebundle => movedirectories } bundle agent movedirectories { files: "/new/dir/" copy_from => local_cp ("/old/dir/structure/."); depth_search => recurse ("inf"); }
i've used this "isdir" source , this example local_cp, both cfe base promise on. when invoked, following error output , i'm trying figure out why.
:/var/cfengine/inputs/standalone# cf-agent --no-lock --inform --file ./file_structure.cf ./file_structure.cf:41:12: error: syntax error depth_search => recurse ("inf"); ^ ./file_structure.cf:41:12: error: expected promiser string, got 'depth_search' depth_search => recurse ("inf"); ^ ./file_structure.cf:41:15: error: expected ';', got '=>' depth_search => recurse ("inf"); ^ ./file_structure.cf:41:23: error: expected promiser string, got 'recurse' depth_search => recurse ("inf"); ^ ./file_structure.cf:41:25: error: expected ';', got '(' depth_search => recurse ("inf"); ^ ./file_structure.cf:41:31: error: expected ';', got ')' depth_search => recurse ("inf"); ^ ./file_structure.cf:41:32: error: expected promiser string, got ';' depth_search => recurse ("inf"); ^ ./file_structure.cf:42:1: error: expected ';', got '}' }
files: "/new/dir/" copy_from => local_cp ("/old/dir/structure/."); depth_search => recurse ("inf"); }
you have semicolon @ end of copy_from line.
a semicolon ;
identifies end of promise. try switching semicolon @ end of copy_from line comma ,
.
files: "/new/dir/" copy_from => local_cp ("/old/dir/structure/."), depth_search => recurse ("inf"); }
additionally may want check out transformer
attribute. may or may not use case.\
bundle agent example { files: "/old/dir/structure" -> { "jira:example-1234" } transformer => "/bin/mv /old/dir/structure /new/dir/structure", comment => "the standard use new location because x, y, z. bad thing q or u might happen if not managed properly."; }
Comments
Post a Comment