manageiq-appliance_console 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +24 -25
- data/.rspec_ci +2 -0
- data/.travis.yml +3 -2
- data/Gemfile +0 -2
- data/Rakefile +20 -1
- data/bin/appliance_console +30 -6
- data/lib/manageiq-appliance_console.rb +2 -6
- data/lib/manageiq/appliance_console/certificate_authority.rb +1 -1
- data/lib/manageiq/appliance_console/cli.rb +64 -20
- data/lib/manageiq/appliance_console/database_configuration.rb +2 -1
- data/lib/manageiq/appliance_console/database_replication.rb +1 -1
- data/lib/manageiq/appliance_console/database_replication_standby.rb +1 -1
- data/lib/manageiq/appliance_console/internal_database_configuration.rb +1 -1
- data/lib/manageiq/appliance_console/logfile_configuration.rb +2 -2
- data/lib/manageiq/appliance_console/message_configuration.rb +199 -0
- data/lib/manageiq/appliance_console/message_configuration_client.rb +96 -0
- data/lib/manageiq/appliance_console/message_configuration_server.rb +319 -0
- data/lib/manageiq/appliance_console/postgres_admin.rb +325 -0
- data/lib/manageiq/appliance_console/utilities.rb +45 -1
- data/lib/manageiq/appliance_console/version.rb +1 -1
- data/manageiq-appliance_console.gemspec +2 -2
- metadata +19 -16
- data/lib/manageiq/appliance_console/messaging_configuration.rb +0 -92
@@ -1,6 +1,6 @@
|
|
1
1
|
# TODO: add appropriate requires instead of depending on appliance_console.rb.
|
2
2
|
# TODO: Further refactor these unrelated methods.
|
3
|
-
require "
|
3
|
+
require "manageiq/appliance_console/postgres_admin"
|
4
4
|
require "awesome_spawn"
|
5
5
|
|
6
6
|
module ManageIQ
|
@@ -62,6 +62,50 @@ module ApplianceConsole
|
|
62
62
|
say(" " + h + ': ' + (Net::Ping::External.new(h).ping ? 'Success!' : 'Failure, Check network settings and IP address or hostname provided.'))
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
def self.disk_usage(file = nil)
|
67
|
+
file_arg = file
|
68
|
+
file_arg = "-l" if file.nil? || file == ""
|
69
|
+
|
70
|
+
unless file_arg == "-l" || File.exist?(file)
|
71
|
+
raise "file #{file} does not exist"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Collect bytes
|
75
|
+
result = AwesomeSpawn.run!("df", :params => ["-T", "-P", file_arg]).output.lines.each_with_object([]) do |line, array|
|
76
|
+
lArray = line.strip.split(" ")
|
77
|
+
next if lArray.length != 7
|
78
|
+
fsname, type, total, used, free, used_percentage, mount_point = lArray
|
79
|
+
next unless total =~ /[0-9]+/
|
80
|
+
next if array.detect { |hh| hh[:filesystem] == fsname }
|
81
|
+
|
82
|
+
array << {
|
83
|
+
:filesystem => fsname,
|
84
|
+
:type => type,
|
85
|
+
:total_bytes => total.to_i * 1024,
|
86
|
+
:used_bytes => used.to_i * 1024,
|
87
|
+
:available_bytes => free.to_i * 1024,
|
88
|
+
:used_bytes_percent => used_percentage.chomp("%").to_i,
|
89
|
+
:mount_point => mount_point,
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
# Collect inodes
|
94
|
+
AwesomeSpawn.run!("df", :params => ["-T", "-P", "-i", file_arg]).output.lines.each do |line|
|
95
|
+
lArray = line.strip.split(" ")
|
96
|
+
next if lArray.length != 7
|
97
|
+
fsname, _type, total, used, free, used_percentage, _mount_point = lArray
|
98
|
+
next unless total =~ /[0-9]+/
|
99
|
+
h = result.detect { |hh| hh[:filesystem] == fsname }
|
100
|
+
next if h.nil?
|
101
|
+
|
102
|
+
h[:total_inodes] = total.to_i
|
103
|
+
h[:used_inodes] = used.to_i
|
104
|
+
h[:available_inodes] = free.to_i
|
105
|
+
h[:used_inodes_percent] = used_percentage.chomp("%").to_i
|
106
|
+
end
|
107
|
+
result
|
108
|
+
end
|
65
109
|
end
|
66
110
|
end
|
67
111
|
end
|
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_runtime_dependency "activerecord", "
|
24
|
-
spec.add_runtime_dependency "activesupport", "
|
23
|
+
spec.add_runtime_dependency "activerecord", "~> 6.0.3.5"
|
24
|
+
spec.add_runtime_dependency "activesupport", "~> 6.0.3.5"
|
25
25
|
spec.add_runtime_dependency "awesome_spawn", "~> 1.4"
|
26
26
|
spec.add_runtime_dependency "bcrypt", "~> 3.1.10"
|
27
27
|
spec.add_runtime_dependency "bcrypt_pbkdf", ">= 1.0", "< 2.0"
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manageiq-appliance_console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.3.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.0.3.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 6.0.3.5
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 6.0.3.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: awesome_spawn
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,7 +303,7 @@ dependencies:
|
|
303
303
|
- !ruby/object:Gem::Version
|
304
304
|
version: '0'
|
305
305
|
description: ManageIQ Appliance Console
|
306
|
-
email:
|
306
|
+
email:
|
307
307
|
executables:
|
308
308
|
- appliance_console
|
309
309
|
- appliance_console_cli
|
@@ -347,8 +347,11 @@ files:
|
|
347
347
|
- lib/manageiq/appliance_console/logger.rb
|
348
348
|
- lib/manageiq/appliance_console/logging.rb
|
349
349
|
- lib/manageiq/appliance_console/logical_volume_management.rb
|
350
|
-
- lib/manageiq/appliance_console/
|
350
|
+
- lib/manageiq/appliance_console/message_configuration.rb
|
351
|
+
- lib/manageiq/appliance_console/message_configuration_client.rb
|
352
|
+
- lib/manageiq/appliance_console/message_configuration_server.rb
|
351
353
|
- lib/manageiq/appliance_console/oidc_authentication.rb
|
354
|
+
- lib/manageiq/appliance_console/postgres_admin.rb
|
352
355
|
- lib/manageiq/appliance_console/principal.rb
|
353
356
|
- lib/manageiq/appliance_console/prompts.rb
|
354
357
|
- lib/manageiq/appliance_console/saml_authentication.rb
|
@@ -364,7 +367,7 @@ homepage: https://github.com/ManageIQ/manageiq-appliance_console
|
|
364
367
|
licenses:
|
365
368
|
- Apache-2.0
|
366
369
|
metadata: {}
|
367
|
-
post_install_message:
|
370
|
+
post_install_message:
|
368
371
|
rdoc_options: []
|
369
372
|
require_paths:
|
370
373
|
- lib
|
@@ -379,8 +382,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
379
382
|
- !ruby/object:Gem::Version
|
380
383
|
version: '0'
|
381
384
|
requirements: []
|
382
|
-
rubygems_version: 3.0.
|
383
|
-
signing_key:
|
385
|
+
rubygems_version: 3.0.6
|
386
|
+
signing_key:
|
384
387
|
specification_version: 4
|
385
388
|
summary: ManageIQ Appliance Console
|
386
389
|
test_files: []
|
@@ -1,92 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
|
3
|
-
module ManageIQ
|
4
|
-
module ApplianceConsole
|
5
|
-
class MessagingConfiguration
|
6
|
-
include ManageIQ::ApplianceConsole::Logging
|
7
|
-
include ManageIQ::ApplianceConsole::Prompts
|
8
|
-
|
9
|
-
MESSAGING_YML = ManageIQ::ApplianceConsole::RAILS_ROOT.join("config/messaging.yml")
|
10
|
-
|
11
|
-
attr_accessor :host, :password, :port, :username
|
12
|
-
|
13
|
-
def run_interactive
|
14
|
-
ask_questions
|
15
|
-
|
16
|
-
clear_screen
|
17
|
-
say("Activating the configuration using the following settings...\n#{friendly_inspect}\n")
|
18
|
-
|
19
|
-
raise MiqSignalError unless activate
|
20
|
-
|
21
|
-
say("\nConfiguration activated successfully.\n")
|
22
|
-
rescue RuntimeError => e
|
23
|
-
puts "Configuration failed#{": " + e.message unless e.class == MiqSignalError}"
|
24
|
-
press_any_key
|
25
|
-
raise MiqSignalError
|
26
|
-
end
|
27
|
-
|
28
|
-
def ask_questions
|
29
|
-
ask_for_messaging_credentials
|
30
|
-
end
|
31
|
-
|
32
|
-
def ask_for_messaging_credentials
|
33
|
-
self.host = ask_for_ip_or_hostname("messaging hostname or IP address")
|
34
|
-
self.port = ask_for_integer("port number", (1..65_535), 9_092).to_i
|
35
|
-
self.username = just_ask("username")
|
36
|
-
count = 0
|
37
|
-
loop do
|
38
|
-
password1 = ask_for_password("messaging password on #{host}")
|
39
|
-
|
40
|
-
if password1.strip.empty?
|
41
|
-
say("\nPassword can not be empty, please try again")
|
42
|
-
next
|
43
|
-
end
|
44
|
-
|
45
|
-
password2 = ask_for_password("messaging password again")
|
46
|
-
if password1 == password2
|
47
|
-
self.password = password1
|
48
|
-
break
|
49
|
-
elsif count > 0 # only reprompt password once
|
50
|
-
raise "passwords did not match"
|
51
|
-
else
|
52
|
-
count += 1
|
53
|
-
say("\nThe passwords did not match, please try again")
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def friendly_inspect
|
59
|
-
<<~END_OF_INSPECT
|
60
|
-
Host: #{host}
|
61
|
-
Username: #{username}
|
62
|
-
Port: #{port}
|
63
|
-
END_OF_INSPECT
|
64
|
-
end
|
65
|
-
|
66
|
-
def activate
|
67
|
-
save
|
68
|
-
true
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
|
73
|
-
def settings_from_input
|
74
|
-
{
|
75
|
-
"hostname" => host,
|
76
|
-
"password" => password,
|
77
|
-
"port" => port,
|
78
|
-
"username" => username
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
def save(settings = nil)
|
83
|
-
settings ||= settings_from_input
|
84
|
-
|
85
|
-
settings["password"] = ManageIQ::Password.try_encrypt(settings.delete("password"))
|
86
|
-
|
87
|
-
require 'yaml'
|
88
|
-
File.write(MESSAGING_YML, YAML.dump("production" => settings))
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|