Bug #2729
closedinitial promises for node are not properly set.
Description
Every time a node runs cf-agent, it tries to run promises common/1.0/cf-serverd.cf.
But, when ran for the first time, the promises always have an error as it tries to run a server configuration promises.
As it is not configured for the node, that promise can't be parse by cf-agent, so the execution is stopped before anything can be done and we can't do anything with that node.
When removing that promises from the inputs in "promises.cf", the agent runs perfectly and the promises are repaired.
We should have a system that prevents a node from calling that initial promises.
Updated by Nicolas PERRON over 12 years ago
As you said, the initial promises for the nodes can't be executed:
[root@centos-6-64 ~]# /var/rudder/cfengine-community/bin/cf-agent -KI rudder> /var/rudder/cfengine-community/inputs/common/1.0/cf-served.cf:71,4: syntax error, near token '%' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,2: Something defined outside of a block or missing punctuation in input, near token '%' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,2: syntax error, near token '%' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,32: Something defined outside of a block or missing punctuation in input, near token 'POLICY_SERVER_ALLOWE' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,32: syntax error, near token 'POLICY_SERVER_ALLOWE' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,33: Something defined outside of a block or missing punctuation in input, near token '%' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,33: syntax error, near token '%' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,34: Something defined outside of a block or missing punctuation in input, near token '%' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:1,34: syntax error, near token '%' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:2,3: Something defined outside of a block or missing punctuation in input, near token '}' rudder> /var/rudder/cfengine-community/inputs/common/1.0/cfengine_stdlib.cf:2,3: syntax error, near token '}' Fatal cfengine error: Too many errors cf-agent was not able to get confirmation of promises from cf-promises, so going to failsafe Can't stat /var/rudder/share/$(g.uuid)/rules/cfengine-community in files.copyfrom promise
It seems that the promises set in the inputs included some promises which shouldn't have to be executed for the nodes but are parsed.
Updated by Nicolas PERRON over 12 years ago
- Status changed from New to Pending technical review
- % Done changed from 0 to 100
It works
Updated by Matthieu CERDA over 12 years ago
Looks OK, and seems to work on a vagrant test VM.
Updated by Nicolas PERRON about 12 years ago
The last commit (http://www.rudder-project.org/redmine/projects/policy-templates/repository/revisions/09516405adef0597bc2b510d62a03cb840f6730b) need a technical review
Updated by Nicolas PERRON about 12 years ago
Initially, %POLICY_SERVER_HOSTNAME% was set in the initial promise of cf-served.cf . This can't work since %POLICY_SERVER_HOSTNAME% is a template variable replaced by the use of rudder-init.sh which is only used on server. Besides, writing the same hostname several times is not DRY at all.
I have modified the code in order to use the cfserverd variable from update.st which is correctly set at once for the nodes (from /var/rudder/cfengine-community/policy_server.dat) and the server (initially %POLICY_SERVER_HOSTNAME% and set by rudder-init.sh).
Updated by Jonathan CLARKE about 12 years ago
- Status changed from Pending technical review to Released
- Target version changed from 2.4.0~beta3 to 2.4.0~beta5
Looks good to me, thanks Nicolas!