Merge "Pre deploy actions"
This commit is contained in:
commit
b622d9b36d
|
@ -33,7 +33,7 @@ require 'astute/cobbler'
|
|||
require 'astute/cobbler_manager'
|
||||
require 'astute/image_provision'
|
||||
require 'astute/dump'
|
||||
require 'astute/post_deploy_actions'
|
||||
require 'astute/deploy_actions'
|
||||
require 'astute/post_deploy_actions/update_no_quorum_policy'
|
||||
require 'astute/post_deploy_actions/restart_radosgw'
|
||||
require 'astute/post_deploy_actions/update_cluster_hosts_info'
|
||||
|
|
|
@ -13,11 +13,32 @@
|
|||
# under the License.
|
||||
|
||||
module Astute
|
||||
class PostDeployActions
|
||||
class DeployActions
|
||||
|
||||
def initialize(deployment_info, context)
|
||||
@deployment_info = deployment_info
|
||||
@context = context
|
||||
@actions = []
|
||||
end
|
||||
|
||||
def process
|
||||
@actions.each { |action| action.process(@deployment_info, @context) }
|
||||
end
|
||||
end
|
||||
|
||||
class PreDeployActions < DeployActions
|
||||
|
||||
def initialize(deployment_info, context)
|
||||
super
|
||||
@actions = []
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class PostDeployActions < DeployActions
|
||||
|
||||
def initialize(deployment_info, context)
|
||||
super
|
||||
@actions = [
|
||||
UpdateNoQuorumPolicy.new,
|
||||
UploadCirrosImage.new,
|
||||
|
@ -26,12 +47,10 @@ module Astute
|
|||
]
|
||||
end
|
||||
|
||||
def process
|
||||
@actions.each { |action| action.process(@deployment_info, @context) }
|
||||
end
|
||||
end
|
||||
|
||||
class PostDeployAction
|
||||
|
||||
class DeployAction
|
||||
|
||||
def process(deployment_info, context)
|
||||
raise "Should be implemented!"
|
||||
|
@ -59,4 +78,7 @@ module Astute
|
|||
end
|
||||
end
|
||||
|
||||
class PreDeployAction < DeployAction; end
|
||||
class PostDeployAction < DeployAction; end
|
||||
|
||||
end
|
|
@ -56,6 +56,9 @@ module Astute
|
|||
|
||||
# Sync time
|
||||
sync_time(part.map{ |n| n['uid'] })
|
||||
|
||||
# Pre deploy hooks
|
||||
PreDeployActions.new(part, @ctx).process
|
||||
end
|
||||
rescue => e
|
||||
Astute.logger.error("Unexpected error #{e.message} traceback #{e.format_backtrace}")
|
||||
|
|
|
@ -41,6 +41,7 @@ describe Astute::DeploymentEngine do
|
|||
describe '#deploy' do
|
||||
|
||||
before(:each) do
|
||||
Astute::PreDeployActions.any_instance.stubs(:process).returns(nil)
|
||||
deployer.stubs(:generate_ssh_keys)
|
||||
deployer.stubs(:upload_ssh_keys)
|
||||
deployer.stubs(:sync_puppet_manifests)
|
||||
|
|
|
@ -54,6 +54,7 @@ describe "NailyFact DeploymentEngine" do
|
|||
deploy_engine.stubs(:sync_puppet_manifests).with(deploy_data.uniq { |n| n['uid'] })
|
||||
deploy_engine.stubs(:enable_puppet_deploy).with(uniq_nodes_uid)
|
||||
deploy_engine.stubs(:sync_time)
|
||||
Astute::PreDeployActions.any_instance.stubs(:process).returns(nil)
|
||||
end
|
||||
|
||||
context 'log parsing' do
|
||||
|
|
Loading…
Reference in New Issue