modules/mu/mommacat.rb in cloud-mu-3.3.2 vs modules/mu/mommacat.rb in cloud-mu-3.4.0
- old
+ new
@@ -545,11 +545,11 @@
# @param data [Hash]: The resource's metadata.
# @param triggering_node [MU::Cloud]: A cloud object calling this notify, usually on behalf of itself
# @param remove [Boolean]: Remove this resource from the deploy structure, instead of adding it.
# @return [void]
def notify(type, key, data, mu_name: nil, remove: false, triggering_node: nil, delayed_save: false)
- no_write = (@no_artifacts or caller.grep(/\/mommacat\.rb:\d+:in `notify'/))
+ no_write = (@no_artifacts or !caller.grep(/\/mommacat\.rb:\d+:in `notify'/).empty?)
begin
if !no_write
if !MU::MommaCat.lock("deployment-notification", deploy_id: @deploy_id, retries: 10)
raise MuError, "Failed to get deployment-notifcation lock for #{@deploy_id}"
@@ -558,11 +558,17 @@
if !@need_deploy_flush or @deployment.nil? or @deployment.empty?
loadDeploy(true) # make sure we're saving the latest and greatest
end
- _shortclass, _cfg_name, type, _classname, attrs = MU::Cloud.getResourceNames(type, false)
+ @timestamp ||= @deployment['timestamp']
+ @seed ||= @deployment['seed']
+ @appname ||= @deployment['appname']
+ @handle ||= @deployment['handle']
+
+ _shortclass, _cfg_name, mu_type, _classname, attrs = MU::Cloud.getResourceNames(type, false)
+ type = mu_type if mu_type
has_multiples = attrs[:has_multiples] ? true : false
mu_name ||= if !data.nil? and !data["mu_name"].nil?
data["mu_name"]
elsif !triggering_node.nil? and !triggering_node.mu_name.nil?
@@ -572,10 +578,11 @@
MU.log "MU::MommaCat.notify called to modify deployment struct for a type (#{type}) with :has_multiples, but no mu_name available to look under #{key}. Call was #{caller(1..1)}", MU::WARN, details: data
return
end
@need_deploy_flush = true
+ @last_modified = Time.now
if !remove
if data.nil?
MU.log "MU::MommaCat.notify called to modify deployment struct, but no data provided", MU::WARN
return
@@ -901,9 +908,10 @@
end
###########################################################################
###########################################################################
def setThreadContextToMe
+
["appname", "environment", "timestamp", "seed", "handle"].each { |var|
@deployment[var] ||= instance_variable_get("@#{var}".to_sym)
if @deployment[var]
if var != "handle"
MU.setVar(var, @deployment[var].upcase)