diff --git a/lib/kadeploy3/common/environment.rb b/lib/kadeploy3/common/environment.rb index e7d5b6e5b1b8c583c8de3307fc80f417f8b0ed95..6d8ec6aa0ffb45e6095a9e72ddf89a1c519b052b 100644 --- a/lib/kadeploy3/common/environment.rb +++ b/lib/kadeploy3/common/environment.rb @@ -336,7 +336,7 @@ class Environment ) end @options['kexec'] = cp.value('kexec', [TrueClass, FalseClass], true) - @options['trust_env'] = cp.value('trust_previous_env', [TrueClass, FalseClass, nil], nil) + @options['trust_env'] = cp.value('trust_previous_env', String, 'default', ['default','always','never']) end end diff --git a/lib/kadeploy3/server/stepdeploy.rb b/lib/kadeploy3/server/stepdeploy.rb index baebb8e1be03beb395828dfc1a10a5df2e619ab3..173f08051847e5b5c20ed7eadf8ff8db347f4ba4 100644 --- a/lib/kadeploy3/server/stepdeploy.rb +++ b/lib/kadeploy3/server/stepdeploy.rb @@ -242,7 +242,7 @@ module Macrostep end class DeployBootNewEnvClassical < DeployBootNewEnv - DESC = "Reboot to the deployed environment without kexec. Used when a cluster does not support kexec." + DESC = "Reboot to the deployed environment without kexec." def steps() [ [:switch_pxe, "deploy_to_deployed_env"], diff --git a/lib/kadeploy3/server/workflow.rb b/lib/kadeploy3/server/workflow.rb index 049553d22e38aac1c9088a3f50f2f15a15f81032..1915b7b2bc9f889d7c270b0ebbf418cc9269e97c 100644 --- a/lib/kadeploy3/server/workflow.rb +++ b/lib/kadeploy3/server/workflow.rb @@ -431,7 +431,7 @@ module Workflow end def last_deploy_is_trusted?() - return true if context[:execution].always_trust_env || context[:execution].environment.options['trust_env'] + return true if context[:execution].always_trust_env || context[:execution].environment.options['trust_env'] == 'always' nodes_state_before_start = Nodes::get_states(context[:database], @nodes.set.map(&:hostname)) @nodes.set.all? do |n| node_state = nodes_state_before_start[n.hostname] || {} @@ -474,13 +474,13 @@ module Workflow end # SetDeploymentMiniOS step macrosteps[0].to_a.each do |instance| - if (context[:execution].dont_trust_env || context[:execution].environment.options['trust_env'] == false || !last_deploy_is_trusted?) && instance[0] == 'SetDeploymentMiniOSTrusted' + if (context[:execution].dont_trust_env || context[:execution].environment.options['trust_env'] == 'never' || !last_deploy_is_trusted?) && instance[0] == 'SetDeploymentMiniOSTrusted' instance[0] = 'SetDeploymentMiniOSUntrusted' instance[1] = 0 instance[2] = eval("(#{context[:cluster].timeout_reboot_classical})+200").to_i debug_message_reason = if context[:execution].dont_trust_env "trusting the last deployment is disabled for this deployment" - elsif context[:execution].environment.options['trust_env'] == false + elsif context[:execution].environment.options['trust_env'] == 'never' "trusting the last deployment is disabled for this environment" elsif !last_deploy_is_trusted? "the last deployment is not trusted" @@ -519,10 +519,15 @@ module Workflow instance, "Using classical reboot instead of kexec since the filesystem is not supported by the deployment environment (#{macrosteps[2].name})" ) - elsif context[:execution].disable_kexec || context[:execution].environment.options['kexec'] == false + elsif context[:execution].disable_kexec setclassical.call( instance, - "Using classical reboot instead of kexec (#{macrosteps[2].name})" + "Using classical reboot instead of kexec as requested by the deployment (#{macrosteps[2].name})" + ) + elsif context[:execution].environment.options['kexec'] == false + setclassical.call( + instance, + "Using classical reboot instead of kexec as requested by the environment description (#{macrosteps[2].name})" ) end