0

I started to configure cfengine3. I got difficulties when I tried to figured out, how should the first run works on client side. I created promises for the first run on the server masterfile for e.g.: bundle agent populate_instance {

        files:
                bootstrap_mode.dev::
                        "/var/local/properties/dev"
                        create => "true";
                bootstrap_mode.test::
                        "/var/local/properties/test"
                        create => "true";
                bootstrap_mode.prod::
                        "/var/local/properties/prod"
                        create => "true";

}

So, I expected that the client is going to create the the path above /var/local/properties/prod when I run first time the client

cf-agent -bootstrap xxx.xxx.xxx.xxx -Dprod

,but it doesn't create at all. The populate_instance is part of the body common control in promises.cf. I've also checked the verbosed client output and found everything fine, the soft class also was there

 verbose: BEGIN initial soft classes:
 verbose: C: added soft class dev
 verbose: END initial soft classe

s

and the hard class also exists in the output

 verbose: C: discovered hard class bootstrap_mode

So my question is, why does'n work this promises on the first run? Thanks,

peep
  • 15
  • 4
  • The --bootstrap option is used to establish trust and seed /var/cfengine/inputs with the policy from /var/cfengine/masterfiles on the hub. The policy you are actually running when you give the agent the --bootstrap option is some embedded policy. After bootstrapping you should have all the policy on the client, and you should be able to run cf-agent --define prod. Perhaps you can share your promises.cf as well. Something must actuate your populate_instance bundle (methods promise or body common control bundlesequence) – Nick Anderson Jun 15 '16 at 19:17
  • Oh...welll, it was my fault. I was expected, that all of the promises run on the bootstrap as well but they don't. When I start cf-agent -vIK -Ddev it does what it should does. So, cf-agent works just fine. Btw, I don't find the meaning of the hrd class bootstrap_mode at all, because when it presents, the promises doesn't run at all. Thanks anyway it resolved my problem. – peep Jun 16 '16 at 08:37
  • The bootstrap_mode class is defined during bootstrap. Its really an internal use thing to help differentiate between a condition where a user is bootstrapping and when the agent is trying to self-heal (failsafe mode). Both of those conditions use the same internal policy, and it is useful to differentiate between them. Also you care correct regarding bootstrap not running policy. It only tries to make sure the policy is in place. So it copies from masterfiles and then runs the update policy in case you have custom update semantics. It starts cf-execd which will run the policy later. – Nick Anderson Nov 15 '17 at 14:29

0 Answers0