diff --git a/lib/astute.rb b/lib/astute.rb index 1101b917..e9a4efdd 100644 --- a/lib/astute.rb +++ b/lib/astute.rb @@ -19,6 +19,7 @@ require 'logger' require 'shellwords' require 'astute/ext/exception' +require 'astute/ext/deep_copy' require 'astute/config' require 'astute/logparser' require 'astute/orchestrator' diff --git a/lib/astute/deployment_engine/nailyfact.rb b/lib/astute/deployment_engine/nailyfact.rb index 91f7492d..a889ad1b 100644 --- a/lib/astute/deployment_engine/nailyfact.rb +++ b/lib/astute/deployment_engine/nailyfact.rb @@ -57,7 +57,7 @@ class Astute::DeploymentEngine::NailyFact < Astute::DeploymentEngine attrs_to_puppet['fixed_interface'] = get_fixed_interface(node) end - attrs_to_puppet.merge!(attrs) + attrs_to_puppet.merge!(deep_copy(attrs)) attrs_to_puppet.each do |k, v| unless v.is_a?(String) || v.is_a?(Integer) diff --git a/lib/astute/ext/deep_copy.rb b/lib/astute/ext/deep_copy.rb new file mode 100644 index 00000000..2e805820 --- /dev/null +++ b/lib/astute/ext/deep_copy.rb @@ -0,0 +1,18 @@ +# Copyright 2013 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +def deep_copy(data) + Marshal.load(Marshal.dump(data)) +end