foreman_rh_cloud 5.0.43 → 5.0.45

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: afcac5b540e90c5a058847cad9490d79746b687f52d2023c800aa7a44d3d5bf6
4
- data.tar.gz: 191387083ba26385acae71a88e7ee09a3c6763418b662746e54d37dfff6871a3
3
+ metadata.gz: fbc11fcfbfbe774f2a986830bf4b3fadd2cda0b0cd1bdba8bb8d00a48aebb3a5
4
+ data.tar.gz: d6afd01efe2895d78862f26e5fb61e041aea305e43f8ecdd069d21694b1beceb
5
5
  SHA512:
6
- metadata.gz: ad17c8398f353411da4de2ae49e4e50b59994eedb6534749da9e6e93048df44ae1b986ef767023402f1f53f01a2cd7126c8aeac8816e52274c8dfe7af7f86dc5
7
- data.tar.gz: 27a983cf15776f3bf86b70bf2e169185e9da765036fef4b2885faed7e3231feb7289c76b91c111ba8f4cf1e7de1d72df6afa7843c339ca80db039e2fa5105c0b
6
+ metadata.gz: 3e2a6a6da7e06650c43b0ff60101afd82d5f207f0e0ed104ef98d57bc868ca17130ebb9953d53c5216597b679c10644936d27347f1e6cf00c0b8b5de90c0bbff
7
+ data.tar.gz: cc2cccfd02033d36fb590ec0ebb963ae07dd120b04cd02e0c6a87bc0d7630a40ef6dc17d173764df7a11380f2e8c3569f3516c490d325cf767501574c6230785
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '5.0.43'.freeze
2
+ VERSION = '5.0.45'.freeze
3
3
  end
@@ -11,7 +11,7 @@ module InventorySync
11
11
  @per_page = result['per_page']
12
12
  @sub_ids = result["results"].map { |host| host['subscription_manager_id'] }
13
13
  @uuid_by_sub_id = Hash[result["results"].map { |host| [host['subscription_manager_id'], host['id']] }]
14
- @uuid_by_fqdn = Hash[result["results"].map { |host| [host['fqdn'].downcase, host['id']] }]
14
+ @uuid_by_fqdn = Hash[result["results"].map { |host| [host['fqdn']&.downcase, host['id']] }]
15
15
  end
16
16
 
17
17
  def status_hashes
@@ -0,0 +1,63 @@
1
+ require 'io/console'
2
+
3
+ namespace :rh_cloud do |args|
4
+ desc 'Register Satellite Organization with Hybrid Cloud API. \
5
+ Specify org_id=x replace your organization ID with x. \
6
+ Specify SATELLITE_RH_CLOUD_URL=https://x with the Hybrid Cloud endpoint you are connecting to.'
7
+ task hybridcloud_register: [:environment] do
8
+ include ::ForemanRhCloud::CertAuth
9
+ include ::InsightsCloud::CandlepinCache
10
+
11
+ def logger
12
+ @logger ||= Logger.new(STDOUT)
13
+ end
14
+
15
+ def registrations_url
16
+ logger.warn("Custom url is not set, using the default one: #{ForemanRhCloud.base_url}") if ENV['SATELLITE_RH_CLOUD_URL'].empty?
17
+ ForemanRhCloud.base_url + '/api/identity/certificate/registrations'
18
+ end
19
+
20
+ if ENV['org_id'].nil?
21
+ logger.error('ERROR: org_id needs to be specified.')
22
+ exit(1)
23
+ end
24
+
25
+ organization = Organization.find_by(id: ENV['org_id'].to_i) # saw this coming in as a string, so making sure it gets passed as an integer.
26
+
27
+ @uid = cp_owner_id(organization)
28
+ logger.error('Organization provided does not have a manifest imported.') + exit(1) if @uid.nil?
29
+
30
+ puts 'Paste your token, output will be hidden.'
31
+ @token = STDIN.noecho(&:gets).chomp
32
+ logger.error('Token was not entered.') + exit(1) if @token.empty?
33
+
34
+ def headers
35
+ {
36
+ Authorization: "Bearer #{@token}"
37
+ }
38
+ end
39
+
40
+ def payload
41
+ {
42
+ "uid": @uid
43
+ }
44
+ end
45
+
46
+ def method
47
+ :post
48
+ end
49
+
50
+ begin
51
+ response = execute_cloud_request(
52
+ organization: organization,
53
+ method: method,
54
+ url: registrations_url,
55
+ headers: headers,
56
+ payload: payload.to_json
57
+ )
58
+ logger.debug(response)
59
+ rescue Exception => ex
60
+ logger.error(ex)
61
+ end
62
+ end
63
+ end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "5.0.43",
3
+ "version": "5.0.45",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_rh_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.43
4
+ version: 5.0.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-10 00:00:00.000000000 Z
11
+ date: 2023-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -238,6 +238,7 @@ files:
238
238
  - lib/inventory_sync/async/inventory_self_host_sync.rb
239
239
  - lib/inventory_sync/async/query_inventory_job.rb
240
240
  - lib/tasks/foreman_rh_cloud_tasks.rake
241
+ - lib/tasks/hybrid_cloud.rake
241
242
  - lib/tasks/insights.rake
242
243
  - lib/tasks/rh_cloud_inventory.rake
243
244
  - locale/Makefile
@@ -674,7 +675,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
674
675
  - !ruby/object:Gem::Version
675
676
  version: '0'
676
677
  requirements: []
677
- rubygems_version: 3.3.7
678
+ rubygems_version: 3.3.26
678
679
  signing_key:
679
680
  specification_version: 4
680
681
  summary: Summary of ForemanRhCloud.