foreman_rh_cloud 5.0.44 → 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: 9635bebb61af6ca7d21d4b4acffb2a7e56076bd4c889917469aba146473b7b2a
4
- data.tar.gz: a08402321da845e7e2e2d66b1abeefadd2a8d037c482b808734310ec918032ee
3
+ metadata.gz: fbc11fcfbfbe774f2a986830bf4b3fadd2cda0b0cd1bdba8bb8d00a48aebb3a5
4
+ data.tar.gz: d6afd01efe2895d78862f26e5fb61e041aea305e43f8ecdd069d21694b1beceb
5
5
  SHA512:
6
- metadata.gz: 6c4b6f686cc56e902aa6589d5fc85829b3c1c014dfcf4f16bd8f087f4a1609a807d1d4fc24364fd6bd0196156508da9daacbc97e6d0de91bc265e26600b12b85
7
- data.tar.gz: 5e21c1f90bba2f55bba85eb38b3829a0fb3bca3728d1766e6986233d35e8e446812ac35d2903061a104760404d4b3b6386a48a6e9c39565eb8ad3c6c2f972045
6
+ metadata.gz: 3e2a6a6da7e06650c43b0ff60101afd82d5f207f0e0ed104ef98d57bc868ca17130ebb9953d53c5216597b679c10644936d27347f1e6cf00c0b8b5de90c0bbff
7
+ data.tar.gz: cc2cccfd02033d36fb590ec0ebb963ae07dd120b04cd02e0c6a87bc0d7630a40ef6dc17d173764df7a11380f2e8c3569f3516c490d325cf767501574c6230785
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '5.0.44'.freeze
2
+ VERSION = '5.0.45'.freeze
3
3
  end
@@ -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.44",
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.44
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: 2023-02-09 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