Class: Katello::DockerTag

Inherits:
Model
  • Object
show all
Includes:
Concerns::PulpDatabaseUnit, ScopedSearchExtensions
Defined in:
app/models/katello/docker_tag.rb

Constant Summary collapse

CONTENT_TYPE =
'docker_tag'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Concerns::PulpDatabaseUnit

#backend_data, #library_repositories, #remove_from_repository

Methods inherited from Model

#destroy!

Class Method Details

.completer_scope_optionsObject



76
77
78
# File 'app/models/katello/docker_tag.rb', line 76

def self.completer_scope_options
  {"#{Katello::Repository.table_name}" => lambda { |repo_class| repo_class.docker_type } }
end

.import_for_repository(repository, options = {}) ⇒ Object



61
62
63
64
# File 'app/models/katello/docker_tag.rb', line 61

def self.import_for_repository(repository, options = {})
  super(repository, options)
  ::Katello::DockerMetaTag.import_meta_tags([repository])
end

.with_identifiers(ids) ⇒ Object



72
73
74
# File 'app/models/katello/docker_tag.rb', line 72

def self.with_identifiers(ids)
  self.where(:id => ids)
end

Instance Method Details

#associated_meta_tagObject



37
38
39
# File 'app/models/katello/docker_tag.rb', line 37

def associated_meta_tag
  schema1_meta_tag || schema2_meta_tag
end

#associated_meta_tag_identifierObject



41
42
43
# File 'app/models/katello/docker_tag.rb', line 41

def associated_meta_tag_identifier
  associated_meta_tag.try(:id)
end

#cleanup_meta_tagsObject



80
81
82
83
84
85
86
87
88
# File 'app/models/katello/docker_tag.rb', line 80

def cleanup_meta_tags
  if schema1_meta_tag && schema1_meta_tag.schema2.blank?
    schema1_meta_tag.destroy
  end

  if schema2_meta_tag && schema2_meta_tag.schema1.blank?
    schema2_meta_tag.destroy
  end
end

#content_view_versionObject



29
30
31
# File 'app/models/katello/docker_tag.rb', line 29

def content_view_version
  repositories.first.content_view_version
end

#docker_manifestObject



45
46
47
# File 'app/models/katello/docker_tag.rb', line 45

def docker_manifest
  docker_taggable
end

#docker_manifest_idObject



49
50
51
# File 'app/models/katello/docker_tag.rb', line 49

def docker_manifest_id
  docker_taggable_id
end

#docker_manifest_listObject



53
54
55
# File 'app/models/katello/docker_tag.rb', line 53

def docker_manifest_list
  docker_taggable
end

#docker_manifest_list_idObject



57
58
59
# File 'app/models/katello/docker_tag.rb', line 57

def docker_manifest_list_id
  docker_taggable_id
end

#environmentObject



25
26
27
# File 'app/models/katello/docker_tag.rb', line 25

def environment
  repositories.first.environment
end

#productObject



33
34
35
# File 'app/models/katello/docker_tag.rb', line 33

def product
  repositories.first.product
end


66
67
68
69
70
# File 'app/models/katello/docker_tag.rb', line 66

def related_tags
  # tags in the same repo group with the same name
  self.class.where(:id => RepositoryDockerTag.where(:repository_id => repositories.first.group).select(:docker_tag_id),
                   :name => name)
end

#relative_pathObject



21
22
23
# File 'app/models/katello/docker_tag.rb', line 21

def relative_path
  repositories.first.relative_path
end

#repositoryObject



17
18
19
# File 'app/models/katello/docker_tag.rb', line 17

def repository
  repositories.first
end