Module: ForemanPuppet::Extensions::ParametersHost
- Extended by:
- ActiveSupport::Concern
- Included in:
- PuppetclassesController
- Defined in:
- app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb
Defined Under Namespace
Modules: PatchedClassMethods, PatchedMethods
Instance Method Summary
collapse
Instance Method Details
#process_deprecated_attributes!(params, top_level_hash = 'host') ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb', line 60
def process_deprecated_attributes!(params, top_level_hash = 'host')
%w[puppetclass config_group].each do |relation|
ids = params.delete("#{relation}_ids".to_sym)
names = params.delete("#{relation}_names".to_sym)
plains = params.delete(relation.pluralize.to_sym)
next unless ids || names || plains
::Foreman::Deprecation.api_deprecation_warning("param #{top_level_hash}[#{relation}_*] has been deprecated in favor of #{top_level_hash}[puppet_attributes][#{relation}_*]")
params[:puppet_attributes] ||= {}
params[:puppet_attributes]["#{relation}_ids".to_sym] ||= ids if ids
params[:puppet_attributes]["#{relation}_names".to_sym] ||= names if names
params[:puppet_attributes][relation.pluralize.to_sym] ||= plains if plains
end
end
|
#process_deprecated_environment_params!(params, top_level_hash = 'host') ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb', line 46
def process_deprecated_environment_params!(params, top_level_hash = 'host')
env_id = params.delete(:environment_id)
env_name = params.delete(:environment_name)
env = params.delete(:environment)
return unless env_id || env_name || env
::Foreman::Deprecation.api_deprecation_warning("param #{top_level_hash}[environment_*] has been deprecated in favor of #{top_level_hash}[puppet_attributes][environment_*]")
params[:puppet_attributes] ||= {}
params[:puppet_attributes][:environment_id] ||= env_id if env_id
params[:puppet_attributes][:environment_name] ||= env_name if env_name
params[:puppet_attributes][:environment] ||= env if env
end
|
#process_deprecated_puppet_params!(params, top_level_hash = controller_name.singularize) ⇒ Object
41
42
43
44
|
# File 'app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb', line 41
def process_deprecated_puppet_params!(params, top_level_hash = controller_name.singularize)
process_deprecated_environment_params!(params, top_level_hash)
process_deprecated_attributes!(params, top_level_hash)
end
|