Forum: CFEngine Help Subject: copy only if file exists Author: sauer Link to topic: https://cfengine.com/forum/read.php?3,23189,23189#msg-23189
So, on some systems, there is a symlink in /usr/local/sbin/cf-twin which points at cf-agent. It was put there a while ago to suppress some log warnings. Pretend that I can't just delete the thing, because this is still a general question. I want to replace the symlink or the file itself with a copy of cf-agent, but I only want to do that if the cf-twin file/symlink exists. If there is no cf-twin now, I don't want to create one. I thought this would work: "/usr/local/sbin/cf-twin" create => "false", #move_obstructions => "true", copy_from => local_cp( "/usr/local/sbin/cf-agent" ); But regardless of whether or not move_obstructions is uncommented, this creates cf-twin as a copy of cf-agent every time. It also creates it with permissions 600, but I can deal with that elsewhere. :) I would've thought that "create => false" would suppress creating the file. Is this a bug, or am I just doin' it wrong? Yeah, I could define a class if the file exists, and only do this if that class is set. But this would be marginally easier to read. :) _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine