Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2895 - apply updates to environments on puppet class import #955

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/tasks/puppet.rake
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,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 @@ -119,9 +121,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