foreman_rh_cloud 6.0.44 → 6.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 +64 -0
- data/package.json +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb8068bce51d58d6cdf66eb5448db68133fbae198cde25a09be6f07733947653
|
4
|
+
data.tar.gz: faf0658dbfbece4a47df461daa7bb2c861c6513bb1cf09a34580fd2cd9aedb53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e601daeac30fd710eea4b35eb0a9aa4c1ca4d62fa95307b0df29bf4746ecd723acc432823b164fb8b50b0ba73aeeede2cdfd4f36f7215fc437ceb9fcbfa05aaf
|
7
|
+
data.tar.gz: a4bae0cbbf09b01ce22a0f89c0a6bd4133b95e5611ead0aec6b10e1c8bd3527e9d175ca076aa5759d7154426d46df650f34a37f0886bfda204f329f7c5a8384c
|
@@ -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
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: 6.0.
|
4
|
+
version: 6.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:
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|
@@ -241,6 +241,7 @@ files:
|
|
241
241
|
- lib/inventory_sync/async/inventory_self_host_sync.rb
|
242
242
|
- lib/inventory_sync/async/query_inventory_job.rb
|
243
243
|
- lib/tasks/foreman_rh_cloud_tasks.rake
|
244
|
+
- lib/tasks/hybrid_cloud.rake
|
244
245
|
- lib/tasks/insights.rake
|
245
246
|
- lib/tasks/rh_cloud_inventory.rake
|
246
247
|
- locale/Makefile
|
@@ -679,7 +680,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
679
680
|
- !ruby/object:Gem::Version
|
680
681
|
version: '0'
|
681
682
|
requirements: []
|
682
|
-
rubygems_version: 3.
|
683
|
+
rubygems_version: 3.2.33
|
683
684
|
signing_key:
|
684
685
|
specification_version: 4
|
685
686
|
summary: Summary of ForemanRhCloud.
|