hammer_cli_katello 1.5.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d5ff0a9eec365ed64127733829a53befcdef1dc9a6bdeff5d98f986c988170c
4
- data.tar.gz: 150fa12bf6481c901ba50f1b1548a1999d05204bd2049a454eb6e8962a2b5692
3
+ metadata.gz: 2708ed7f94bc63930cdbfbf1e6b6910224b9ac947a59beb6fd67325de8d13df5
4
+ data.tar.gz: 8e1658c27cab54ba5d45d68b9a2e9eea54df34db5be3316f090ef7bce073f7a3
5
5
  SHA512:
6
- metadata.gz: 03f7a6238d527555bd4e228eb8779823f3040a3bfcae3302a614e1f4c574a27365f785992f9f92f1117932d3c25b4f68de8181fff7f2e2179379328363f87d64
7
- data.tar.gz: 17fea0c7d58536e7ae2785acb79b04e381d6346ec710c3672315df214388f31e2f43a1005a8e67cc6335253f73910dd0dee15361825d82bf7d65b45b4434804a
6
+ metadata.gz: e69050801a50bef32379cce5b0f12b71a2308dac7bd6452a512f077e45b6fcd7e492cc75ed9eac8b425552884bd814857f3394c8aebd919553e54c10a9b5bb9b
7
+ data.tar.gz: cf6ca14b9f61a2f05d310084f2af7207a2a6aba887cd6a69c9a3ff1da1ce3670b450e45645a6d36affdabc9f2532d8a0baeda20e7f722bedfdbbd96fcc9ba086
@@ -34,14 +34,17 @@ module HammerCLIKatello
34
34
  field nil, _('')
35
35
  end
36
36
 
37
+ collection :products, _('Products') do
38
+ field :id, _('Id')
39
+ field :organization_id, _('Organization ID')
40
+ field :name, _('Name')
41
+ field :label, _('Label')
42
+ end
43
+
37
44
  collection :smart_proxies, _('Smart proxies') do
38
45
  field :id, _('Id')
39
46
  field :name, _('Name')
40
47
  field :url, _('URL')
41
- field :created_at, _('Created at')
42
- field :updated_at, _('Updated at')
43
- field :expired_logs, _('Expired logs')
44
- field :puppet_path, _('Puppet path'), Fields::Field, :hide_blank => true
45
48
  field :download_policy, _('Download policy')
46
49
  end
47
50
  end
@@ -78,7 +78,7 @@ module HammerCLIKatello
78
78
  end
79
79
 
80
80
  make_listing_files(export_history)
81
-
81
+ output.print_message _("Generated #{export_history['path']}")
82
82
  HammerCLI::EX_OK
83
83
  end
84
84
  end
@@ -14,10 +14,9 @@ module HammerCLIKatello
14
14
  response
15
15
  else
16
16
  export_history = fetch_export_history_from_task(reload_task(@task))
17
- if syncable?
18
- make_listing_files(export_history)
19
- HammerCLI::EX_OK
20
- elsif export_history
17
+
18
+ if export_history
19
+ make_listing_files(export_history) if syncable?
21
20
  generate_metadata_json(export_history)
22
21
  HammerCLI::EX_OK
23
22
  else
@@ -82,8 +81,6 @@ module HammerCLIKatello
82
81
 
83
82
  def make_listing_files(export_history)
84
83
  check_export_history_syncable!(export_history)
85
- output.print_message _("Generated #{export_history['path']}")
86
-
87
84
  return unless Dir.exist?("#{export_history['path']}/content")
88
85
 
89
86
  begin
@@ -138,7 +135,7 @@ module HammerCLIKatello
138
135
  def fetch_repositories
139
136
  if repository_command?
140
137
  resp = show(:repositories, id: resolver.repository_id(options))
141
- return resp["download_policy"] == "immediate" ? [] : [resp]
138
+ return resp["content_type"] != "yum" || resp["download_policy"] == "immediate" ? [] : [resp]
142
139
  end
143
140
 
144
141
  repo_options = {
@@ -1,3 +1,4 @@
1
+ require 'open-uri'
1
2
  module HammerCLIKatello
2
3
  class ContentImport < HammerCLIKatello::Command
3
4
  desc "Import content from a content archive"
@@ -18,10 +19,11 @@ module HammerCLIKatello
18
19
 
19
20
  base.validate_options do
20
21
  option(:option_path).required
21
-
22
22
  metadata_file = option(:option_metadata_file).value ||
23
23
  File.join(option(:option_path).value, "metadata.json")
24
- unless File.exist?(metadata_file)
24
+ begin
25
+ URI.open(metadata_file)
26
+ rescue Errno::ENOENT
25
27
  msg = _("Unable to find '#{metadata_file}'. "\
26
28
  "If the metadata.json file is at a different location "\
27
29
  "provide it to the --metadata-file option ")
@@ -32,10 +34,18 @@ module HammerCLIKatello
32
34
  base.failure_message _("Could not import the archive.")
33
35
  end
34
36
 
37
+ def fetch_metadata_from_url(metadata_file:, url:)
38
+ if metadata_file.nil?
39
+ metadata_file = "/tmp/metadata.json"
40
+ IO.copy_stream(URI.open(url), metadata_file)
41
+ end
42
+ metadata_file
43
+ end
44
+
35
45
  def request_params
36
46
  super.tap do |opts|
37
47
  metadata_file = option_metadata_file || File.join(option_path, "metadata.json")
38
- opts["metadata"] = JSON.parse(File.read(metadata_file))
48
+ opts["metadata"] = JSON.parse(URI.open(metadata_file).read)
39
49
  end
40
50
  end
41
51
  end
@@ -102,6 +102,38 @@ module HammerCLIKatello
102
102
  setup
103
103
  end
104
104
 
105
+ class EnabledRepositoriesCommand < HammerCLIKatello::ListCommand
106
+ resource :host_subscriptions, :enabled_repositories
107
+ command_name 'enabled-repositories'
108
+
109
+ output do
110
+ field :id, _('ID')
111
+ field :name, _('Name')
112
+ field :label, _('Label')
113
+ field :content_type, _('Content type')
114
+ field :checksum, _("Checksum")
115
+
116
+ from :content_view do
117
+ field :id, _('Content View id')
118
+ field :name, _("Content View name")
119
+ end
120
+
121
+ from :content_view_version do
122
+ field :name, _("Content View version")
123
+ end
124
+
125
+ from :kt_environment do
126
+ field :name, _("Environment name")
127
+ end
128
+
129
+ from :product do
130
+ field :name, _("Product name")
131
+ end
132
+ end
133
+
134
+ build_options
135
+ end
136
+
105
137
  class ContentOverrideCommand < ::HammerCLIKatello::ContentOverrideBase::ContentOverrideCommand
106
138
  resource :host_subscriptions, :content_override
107
139
  setup
@@ -52,7 +52,8 @@ module HammerCLIKatello
52
52
  types = {
53
53
  'export_sync' => _("Export Sync"),
54
54
  'network_sync' => _("Network Sync"),
55
- 'redhat_cdn' => _("Red Hat CDN")
55
+ 'redhat_cdn' => _("Red Hat CDN"),
56
+ 'custom_cdn' => _("Custom CDN")
56
57
  }
57
58
  data["cdn_configuration"].merge!("type_label" => types[data["cdn_configuration"]["type"]])
58
59
  end
@@ -34,6 +34,18 @@ module HammerCLIKatello
34
34
  field :url, _("Url")
35
35
  end
36
36
 
37
+ content_type_msg = _("Limit the repository type to return." \
38
+ " View available types with \"hammer repository types\"")
39
+ option "--content-type", "CONTENT TYPE",
40
+ content_type_msg,
41
+ :attribute_name => :option_content_type
42
+
43
+ with_content_msg = _("Limit the repository type to return." \
44
+ " View available types with \"hammer repository types\"")
45
+ option "--with-content", "WITH CONTENT",
46
+ with_content_msg,
47
+ :attribute_name => :option_with_content
48
+
37
49
  build_options
38
50
 
39
51
  extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
@@ -214,6 +226,12 @@ module HammerCLIKatello
214
226
  :attribute_name => :option_unprotected,
215
227
  :format => HammerCLI::Options::Normalizers::Bool.new
216
228
 
229
+ content_type_msg = _("Type of repository to create." \
230
+ " View available types with \"hammer repository types\"")
231
+ option "--content-type", "CONTENT TYPE",
232
+ content_type_msg,
233
+ :attribute_name => :option_content_type
234
+
217
235
  build_options :without => [:unprotected]
218
236
  end
219
237
 
@@ -321,6 +339,22 @@ module HammerCLIKatello
321
339
  end
322
340
  end
323
341
 
342
+ class RepositoryTypesCommand < HammerCLIKatello::InfoCommand
343
+ resource :repositories, :repository_types
344
+ command_name "types"
345
+
346
+ output do
347
+ field :name, _("Name")
348
+ collection :content_types, _('Content types') do
349
+ field :label, _('Type')
350
+ field :generic, _('Generic?')
351
+ field :removable, _('Removable?')
352
+ field :uploadable, _('Uploadable?')
353
+ field :indexed, _('Indexed?')
354
+ end
355
+ end
356
+ end
357
+
324
358
  # rubocop:disable ClassLength
325
359
  class UploadContentCommand < HammerCLIKatello::InfoCommand
326
360
  extend RepositoryScopedToProduct
@@ -331,6 +365,12 @@ module HammerCLIKatello
331
365
  command_name "upload-content"
332
366
  CONTENT_CHUNK_SIZE = 2_500_000 # bytes to make sure it's lower than django's default 2621440
333
367
 
368
+ content_type_msg = _("The type of content unit to upload (srpm, file, etc.)." \
369
+ " View uploadable types with \"hammer repository types\"")
370
+ option "--content-type", "CONTENT TYPE",
371
+ content_type_msg,
372
+ :attribute_name => :option_content_type
373
+
334
374
  class BinaryPath < HammerCLI::Options::Normalizers::File
335
375
  def format(path)
336
376
  fullpath = ::File.expand_path(path)
@@ -562,6 +602,12 @@ module HammerCLIKatello
562
602
  end
563
603
  end
564
604
 
605
+ content_type_msg = _("The type of content unit to remove (srpm, docker_manifest, etc.)." \
606
+ " View removable types with \"hammer repository types\"")
607
+ option "--content-type", "CONTENT TYPE",
608
+ content_type_msg,
609
+ :attribute_name => :option_content_type
610
+
565
611
  build_options do |o|
566
612
  o.expand.including(:products)
567
613
  end
@@ -13,6 +13,16 @@ module HammerCLIKatello
13
13
  end
14
14
  end
15
15
 
16
+ class StatusCommand < HammerCLIKatello::ListCommand
17
+ resource :simple_content_access, :status
18
+ command_name "status"
19
+ output do
20
+ field :simple_content_access, _('Simple Content Access'), Fields::Boolean
21
+ end
22
+
23
+ build_options
24
+ end
25
+
16
26
  class EnableCommand < HammerCLIKatello::SingleResourceCommand
17
27
  include EligibleCheck
18
28
  include HammerCLIForemanTasks::Async
@@ -1,5 +1,5 @@
1
1
  module HammerCLIKatello
2
2
  def self.version
3
- @version ||= Gem::Version.new('1.5.3')
3
+ @version ||= Gem::Version.new('1.7.0')
4
4
  end
5
5
  end
@@ -43,7 +43,7 @@ module HammerCLIKatello
43
43
  'hammer_cli_katello/organization'
44
44
  )
45
45
 
46
- HammerCLI::MainCommand.lazy_subcommand!("alternate-content-sources", _("Manipulate alternate content sources"), # rubocop:disable LineLength
46
+ HammerCLI::MainCommand.lazy_subcommand!("alternate-content-source", _("Manipulate alternate content sources"), # rubocop:disable LineLength
47
47
  'HammerCLIKatello::AcsCommand',
48
48
  'hammer_cli_katello/acs'
49
49
  )