Revision a989a617
Added by Ohad Levy about 12 years ago
- ID a989a6171e3130f50933e7d6694ab416c8f69cda
lib/foreman/controller/environments.rb | ||
---|---|---|
module Foreman::Controller::Environments
|
||
|
||
def import_environments
|
||
@changed = Environment.importClasses
|
||
begin
|
||
@changed = Environment.importClasses
|
||
rescue => e
|
||
if e.message =~ /puppet feature/i
|
||
error "We did not find a foreman proxy that can provide the information, ensure that you have at least one Proxy with the puppet feature turned on."
|
||
redirect_to "/" + controller_path and return
|
||
else
|
||
raise e
|
||
end
|
||
end
|
||
|
||
if @changed["new"].size > 0 or @changed["obsolete"].size > 0
|
||
render "common/_puppetclasses_or_envs_changed"
|
||
else
|
||
notice "No changes to your environments detected"
|
||
redirect_to "/" + controller_path
|
||
end
|
||
rescue Exception => e
|
||
error e
|
||
redirect_to "/" + controller_path
|
||
end
|
||
|
||
def obsolete_and_new
|
||
if (errors = ::Environment.obsolete_and_new(params[:changed])).empty?
|
||
notice "Succcessfully updated environments and puppetclasses from the on-disk puppet installation"
|
||
notice "Successfully updated environments and puppetclasses from the on-disk puppet installation"
|
||
else
|
||
error "Failed to update the environments and puppetclasses from the on-disk puppet installation<br/>" + errors.join("<br>")
|
||
end
|
Also available in: Unified diff
fixes #1509 - Foreman should use the proxy to import puppet classes