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 +4 -4
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/hybrid_cloud.rake +63 -0
- data/package.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbc11fcfbfbe774f2a986830bf4b3fadd2cda0b0cd1bdba8bb8d00a48aebb3a5
|
4
|
+
data.tar.gz: d6afd01efe2895d78862f26e5fb61e041aea305e43f8ecdd069d21694b1beceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e2a6a6da7e06650c43b0ff60101afd82d5f207f0e0ed104ef98d57bc868ca17130ebb9953d53c5216597b679c10644936d27347f1e6cf00c0b8b5de90c0bbff
|
7
|
+
data.tar.gz: cc2cccfd02033d36fb590ec0ebb963ae07dd120b04cd02e0c6a87bc0d7630a40ef6dc17d173764df7a11380f2e8c3569f3516c490d325cf767501574c6230785
|
@@ -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
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.
|
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-
|
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
|