Class: Katello::ContentViewPuppetEnvironment
- Includes:
- ForemanTasks::Concerns::ActionSubject, Glue::Pulp::Repo, Glue
- Defined in:
- app/models/katello/content_view_puppet_environment.rb
Class Method Summary collapse
- .generate_pulp_id(organization_label, env_label, view_label, version) ⇒ Object
- .in_content_view(view_id) ⇒ Object
- .in_environment(env_id) ⇒ Object
Instance Method Summary collapse
- #archive? ⇒ Boolean
- #content_type ⇒ Object
- #content_view ⇒ Object
- #generate_puppet_env_name ⇒ Object
- #generate_puppet_path ⇒ Object
- #index_content(puppet_module_uuids) ⇒ Object
- #node_syncable? ⇒ Boolean
- #organization ⇒ Object
- #unprotected ⇒ Object
Methods included from Glue
Methods inherited from Model
Class Method Details
.generate_pulp_id(organization_label, env_label, view_label, version) ⇒ Object
87 88 89 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 87 def self.generate_pulp_id(organization_label, env_label, view_label, version) [organization_label, env_label, view_label, version].compact.join("-").gsub(/[^-\w]/, "_") end |
.in_content_view(view_id) ⇒ Object
57 58 59 60 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 57 def self.in_content_view(view_id) joins(:content_view_version).where( "#{Katello::ContentViewVersion.table_name}.content_view_id" => view_id) end |
.in_environment(env_id) ⇒ Object
62 63 64 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 62 def self.in_environment(env_id) where(environment_id: env_id) end |
Instance Method Details
#archive? ⇒ Boolean
66 67 68 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 66 def archive? self.environment.nil? end |
#content_type ⇒ Object
33 34 35 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 33 def content_type Repository::PUPPET_TYPE end |
#content_view ⇒ Object
53 54 55 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 53 def content_view self.content_view_version.content_view end |
#generate_puppet_env_name ⇒ Object
79 80 81 82 83 84 85 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 79 def generate_puppet_env_name if self.environment Environment.construct_name(self.organization, self.environment, self.content_view) end end |
#generate_puppet_path ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 70 def generate_puppet_path # rubocop:disable Style/EmptyElse if self.environment File.join(SETTINGS[:katello][:puppet_repo_root], generate_puppet_env_name, 'modules') else nil #don't generate archived content view puppet environments end end |
#index_content(puppet_module_uuids) ⇒ Object
91 92 93 94 95 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 91 def index_content(puppet_module_uuids) associated_ids = PuppetModule.with_uuid(puppet_module_uuids).pluck(:id) self.puppet_modules = PuppetModule.where(:id => associated_ids) self.save! end |
#node_syncable? ⇒ Boolean
41 42 43 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 41 def node_syncable? environment end |
#organization ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 45 def organization if self.environment self.environment.organization else self.content_view.organization end end |
#unprotected ⇒ Object
37 38 39 |
# File 'app/models/katello/content_view_puppet_environment.rb', line 37 def unprotected false end |