Feature #32504 » noclass.patch
app/services/puppet_class_importer.rb | ||
---|---|---|
def initialize(args = { })
|
||
@foreman_classes = { }
|
||
@proxy_classes = { }
|
||
# == CERN Local patch ==
|
||
# Keep a cache to avoid hammering the proxy, as the importer gets
|
||
# all the environments from the proxy several times during the
|
||
# import process.
|
||
@proxy_envs = nil
|
||
@environment = args[:env]
|
||
if args[:proxy]
|
||
... | ... | |
changes_for_environment(env, changes)
|
||
end
|
||
# == CERN Local patch ==
|
||
# New environments are only created if classes can be imported
|
||
# for them. As we don't import classes, we have to force listing
|
||
# here the environments that are considered new so they're
|
||
# created.
|
||
new_environments.each do |env|
|
||
changes['new'][env] ||= {}
|
||
end
|
||
old_environments.each do |env|
|
||
changes['obsolete'][env] ||= []
|
||
changes['obsolete'][env] << "_destroy_" unless actual_environments.include?(env)
|
||
... | ... | |
# * +environment+: {String} containing the name of the environment
|
||
#
|
||
def proxy_classes_for(environment)
|
||
@proxy_classes[environment] ||= proxy.classes(environment)
|
||
# == CERN Local patch ==
|
||
# We don't do class assignment in Foreman so there's no need to
|
||
# import all the classes for each environment. This is a very slow
|
||
# operation (call to puppet/v3/environment_classes) that we can
|
||
# avoid.
|
||
{}
|
||
end
|
||
def new_classes_for(environment)
|
||
... | ... | |
end
|
||
def proxy_environments
|
||
proxy.environments.map(&:to_s)
|
||
# == CERN Local patch ==
|
||
# Keep a cache to avoid hammering the proxy, as the importer gets
|
||
# all the environments from the proxy several times during the
|
||
# import process.
|
||
@proxy_envs ||= proxy.environments.map(&:to_s)
|
||
end
|
||
def to_be_created_environments
|