foreman_rh_cloud 5.0.44 → 5.0.46

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: 3ea5b770cae26d383e7b4809c1e00fbb177561b5a32f15cbb6422cff7b793ee5
4
+ data.tar.gz: acceb56161f35e3a9edccccb9dfe666801f5856dea00b5e0d1c63a20cee89228
5
5
  SHA512:
6
- metadata.gz: 6c4b6f686cc56e902aa6589d5fc85829b3c1c014dfcf4f16bd8f087f4a1609a807d1d4fc24364fd6bd0196156508da9daacbc97e6d0de91bc265e26600b12b85
7
- data.tar.gz: 5e21c1f90bba2f55bba85eb38b3829a0fb3bca3728d1766e6986233d35e8e446812ac35d2903061a104760404d4b3b6386a48a6e9c39565eb8ad3c6c2f972045
6
+ metadata.gz: 609894df0bb5c2e00d960d8c8be2d9c3938a36379fa447a6bf72fa40b5eb53113f84dd038ba40fa36cd833f975e8f9de589afc7a6f47b4942bf5a6e4aa2d856c
7
+ data.tar.gz: 3e620d13c72b977cd3ebdf2f5ad74cf114b23c02db3746c388c3b6788e8aa501d72743f6eaff9588c7cbdbda0a56a1bae2c48da24d69f92742e1e70ee9581763
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '5.0.44'.freeze
2
+ VERSION = '5.0.46'.freeze
3
3
  end
@@ -0,0 +1,64 @@
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
+ @uid = cp_owner_id(@organization)
27
+ @hostname = ForemanRhCloud.foreman_host_name
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
+ "display_name": "#{@hostname}+#{@organization.label}"
44
+ }
45
+ end
46
+
47
+ def method
48
+ :post
49
+ end
50
+
51
+ begin
52
+ response = execute_cloud_request(
53
+ organization: @organization,
54
+ method: method,
55
+ url: registrations_url,
56
+ headers: headers,
57
+ payload: payload.to_json
58
+ )
59
+ logger.debug(response)
60
+ rescue Exception => ex
61
+ logger.error(ex)
62
+ end
63
+ end
64
+ 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.46",
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.46
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-20 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