Class: HammerCLIKatello::Repository::InfoCommand
Overview
rubocop:disable ClassLength
Instance Method Summary
collapse
validate_repo_name_requires_product_options
included
Instance Method Details
#extend_data(data) ⇒ Object
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
# File 'lib/hammer_cli_katello/repository.rb', line 155
def extend_data(data)
if data["content_type"] != "docker"
data.delete("docker_tags_whitelist")
end
if data["content_type"] == "yum" && data["gpg_key"]
data["gpg_key_name"] = data["gpg_key"]["name"]
end
setup_arch_and_os(data)
setup_sync_state(data)
setup_booleans(data)
setup_mirroring_policy(data)
setup_content_counts(data) if data["content_counts"]
data
end
|
#get_sync_status(state) ⇒ Object
222
223
224
225
226
227
228
229
|
# File 'lib/hammer_cli_katello/repository.rb', line 222
def get_sync_status(state)
sync_states = {
"failed" => _("Failed"), "success" => _("Success"), "finished" => _("Finished"),
"error" => _("Error"), "running" => _("Running"), "waiting" => _("Waiting"),
"canceled" => _("Canceled"), "not_synced" => _("Not Synced"), "warning" => _("Warning")
}
sync_states[state]
end
|
#setup_arch_and_os(data) ⇒ Object
172
173
174
175
176
177
178
|
# File 'lib/hammer_cli_katello/repository.rb', line 172
def setup_arch_and_os(data)
arch = data["arch"]
data["restrict_to_arch"] = arch == 'noarch' ? _('No restriction') : arch
os_versions = data["os_versions"] || []
data["restrict_to_os_versions"] = _('No restriction')
data["restrict_to_os_versions"] = os_versions.join(", ") unless os_versions.empty?
end
|
#setup_booleans(data) ⇒ Object
180
181
182
183
|
# File 'lib/hammer_cli_katello/repository.rb', line 180
def setup_booleans(data)
data["_redhat_repo"] = data.dig("product", "redhat") ? _("yes") : _("no")
data["_publish_via_http"] = data["unprotected"] ? _("yes") : _("no")
end
|
#setup_content_counts(data) ⇒ Object
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
# File 'lib/hammer_cli_katello/repository.rb', line 204
def setup_content_counts(data)
content_counts = data["content_counts"]
case data["content_type"]
when "yum"
data["package_total"] = content_counts["rpm"]
data["srpm_total"] = content_counts["srpm"]
data["package_group_total"] = content_counts["package_group"]
data["errata_total"] = content_counts["erratum"]
data["module_stream_total"] = content_counts["module_stream"]
when "docker"
data["docker_manifest_list_total"] = content_counts["docker_manifest_list"]
data["docker_manifest_total"] = content_counts["docker_manifest"]
data["docker_tag_total"] = content_counts["docker_tag"]
when "file"
data["file_total"] = content_counts["file"]
end
end
|
#setup_mirroring_policy(data) ⇒ Object
185
186
187
188
189
190
191
192
193
|
# File 'lib/hammer_cli_katello/repository.rb', line 185
def setup_mirroring_policy(data)
policies = {
'additive' => _("Additive"),
'mirror_content_only' => _("Content Only"),
'mirror_complete' => _("Complete Mirroring")
}
mirroring_policy = data["mirroring_policy"]
data["_mirroring_policy"] = policies[mirroring_policy]
end
|
#setup_sync_state(data) ⇒ Object
195
196
197
198
199
200
201
202
|
# File 'lib/hammer_cli_katello/repository.rb', line 195
def setup_sync_state(data)
if data['last_sync']
data['_sync_state'] = get_sync_status(data["last_sync"]["result"])
data['last_sync'] = data['last_sync_words']
else
data['_sync_state'] = _("Not Synced")
end
end
|