Skip to content

Commit

Permalink
fixes #2895 - apply updates to environments on puppet class import
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Cleal authored and Sam Kottler committed Oct 18, 2013
1 parent 3035495 commit bb9d0a0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/tasks/puppet.rake
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ namespace :puppet do
else
unless args.batch
puts "Scheduled changes to your environment"
puts "Create/update environments"
for env, classes in changes["new"]
print "%-15s: %s\n" % [env, classes.inspect]
["new", "updated"].each do |c|
puts "#{c.titleize} environments"
for env, classes in changes[c]
print "%-15s: %s\n" % [env, classes.keys.to_sentence]
end
end
puts "Delete environments"
for env, classes in changes["obsolete"]
Expand All @@ -121,9 +123,8 @@ namespace :puppet do
errors = ""
# Apply the filtered changes to the database
begin
changed = { 'new' => changes["new"], 'obsolete' => changes["obsolete"] }
['new', 'obsolete'].each { |kind| changed[kind].each_key { |k| changes[kind.to_s][k] = changes[kind.to_s][k].to_json } }
errors = PuppetClassImporter.new.obsolete_and_new(changed)
['new', 'updated', 'obsolete'].each { |kind| changes[kind].each_key { |k| changes[kind.to_s][k] = changes[kind.to_s][k].to_json } }
errors = PuppetClassImporter.new.obsolete_and_new(changes)
rescue => e
errors = e.message + "\n" + e.backtrace.join("\n")
end
Expand Down

0 comments on commit bb9d0a0

Please sign in to comment.