pvcglue 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pvcglue.rb +11 -3
- data/lib/pvcglue/cli.rb +6 -2
- data/lib/pvcglue/connection.rb +13 -1
- data/lib/pvcglue/env.rb +2 -0
- data/lib/pvcglue/packages/postgresql.rb +7 -7
- data/lib/pvcglue/stack.rb +25 -21
- data/lib/pvcglue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 212d9eddb6cf1cf3c75a20d6b7aa913f1bc68d6b
|
4
|
+
data.tar.gz: 5d74759df153a45c751d3d5cf64e0d6f1ea414a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6ce7454bf80150ac10a315314c2efdd03285a29395f1cc9c5e4523d302e26fbabc189b3519d536e754bf8e8a2b85e022dc4c98ae7191d00f28a5b8228deb0f
|
7
|
+
data.tar.gz: eea27fbb1d3edd84b2b4e6a566cdaa118108e82917713cc9b6c0704c734856e633fbe4d6d93d36f68475c5e4de27ee06421518f1a28dedf5babe45a57ed811c9
|
data/lib/pvcglue.rb
CHANGED
@@ -40,9 +40,17 @@ module Pvcglue
|
|
40
40
|
mattr_accessor :logger do
|
41
41
|
|
42
42
|
logger = Logger.new(STDOUT)
|
43
|
-
#
|
44
|
-
|
45
|
-
|
43
|
+
# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
|
44
|
+
if ARGV.detect {|arg| arg.downcase == '--debug' || arg.downcase == '--verbose'}
|
45
|
+
logger.level = Logger::DEBUG
|
46
|
+
elsif ARGV.detect { |arg| arg.downcase == '--quiet' }
|
47
|
+
logger.level = Logger::WARN
|
48
|
+
elsif ARGV.detect { |arg| arg.downcase == '--info' }
|
49
|
+
logger.level = Logger::INFO
|
50
|
+
else
|
51
|
+
logger.level = Logger::INFO
|
52
|
+
end
|
53
|
+
|
46
54
|
logger.formatter = proc do |severity, datetime, progname, msg|
|
47
55
|
minion_name = Pvcglue.logger_current_minion.try(:machine_name)
|
48
56
|
minion_name = "/#{minion_name}" if minion_name
|
data/lib/pvcglue/cli.rb
CHANGED
@@ -6,11 +6,15 @@ module Pvcglue
|
|
6
6
|
|
7
7
|
class CLI < Thor
|
8
8
|
class_option :cloud_manager_override
|
9
|
-
class_option :verbose
|
10
|
-
class_option :rebuild
|
11
9
|
class_option :save_before_upload
|
10
|
+
class_option :rebuild
|
12
11
|
class_option :create_test_cert
|
13
12
|
class_option :force_cert
|
13
|
+
class_option :provision_only
|
14
|
+
class_option :quiet
|
15
|
+
class_option :info
|
16
|
+
class_option :debug
|
17
|
+
class_option :verbose
|
14
18
|
|
15
19
|
def initialize(args = [], local_options = {}, config = {})
|
16
20
|
super
|
data/lib/pvcglue/connection.rb
CHANGED
@@ -182,8 +182,20 @@ module Pvcglue
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
+
def scp_quiet_option
|
186
|
+
case Pvcglue.logger.level
|
187
|
+
when Logger::DEBUG # DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
|
188
|
+
''
|
189
|
+
when Logger::INFO
|
190
|
+
'-q '
|
191
|
+
else
|
192
|
+
'-q '
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
185
196
|
def download_file(user, remote_file, local_file, raise_error = true)
|
186
|
-
|
197
|
+
|
198
|
+
cmd = %{scp #{scp_quiet_option}#{user}@#{minion.public_ip}:#{remote_file} #{local_file}}
|
187
199
|
if raise_error
|
188
200
|
system_command!(cmd)
|
189
201
|
else
|
data/lib/pvcglue/env.rb
CHANGED
@@ -72,6 +72,8 @@ module Pvcglue
|
|
72
72
|
# Pvcglue::Packages.apply('env-get-stage'.to_sym, :manager, Pvcglue::Manager.manager_node, 'pvcglue')
|
73
73
|
# write_stage_env_cache
|
74
74
|
# end
|
75
|
+
# TODO: Warn DB_USER_POSTGRES_HOST IP address does not exist in the configured machines
|
76
|
+
|
75
77
|
merged = stage_env_defaults.merge(Pvcglue.cloud.stage_env)
|
76
78
|
if merged != Pvcglue.cloud.stage_env
|
77
79
|
Pvcglue.cloud.stage_env = merged
|
@@ -11,13 +11,13 @@ module Pvcglue
|
|
11
11
|
connection.write_to_file_from_template(:root, 'postgresql.conf.erb', '/etc/postgresql/9.6/main/postgresql.conf', 'postgres', 'postgres', '0644')
|
12
12
|
connection.write_to_file_from_template(:root, 'pg_hba.conf.erb', '/etc/postgresql/9.6/main/pg_hba.conf', 'postgres', 'postgres', '0644')
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
connection.run_get_stdout(:root, '', 'service postgresql restart')
|
15
|
+
unless $?.exitstatus == 0
|
16
|
+
Pvcglue.logger.error { 'Unable to (re)start postgresql. Getting status...' }
|
17
|
+
result = connection.run_get_stdout(:root, '', 'systemctl status postgresql.service')
|
18
|
+
puts result
|
19
|
+
raise('There was a problem restarting PostgreSQL.')
|
20
|
+
end
|
21
21
|
|
22
22
|
username = Pvcglue.cloud.stage_env['DB_USER_POSTGRES_USERNAME']
|
23
23
|
password = Pvcglue.cloud.stage_env['DB_USER_POSTGRES_PASSWORD']
|
data/lib/pvcglue/stack.rb
CHANGED
@@ -34,16 +34,26 @@ module Pvcglue
|
|
34
34
|
# ap minions['staging-pg'].private_ip
|
35
35
|
new_minions = []
|
36
36
|
minions.each do |minion_name, minion|
|
37
|
+
next unless minion.has_role?(@roles_filter)
|
37
38
|
Pvcglue.logger_current_minion = minion
|
38
39
|
# droplet = Pvcglue::DigitalOcean.client.droplets.find(id: 38371925)
|
39
40
|
# minion.droplet = droplet
|
40
41
|
# new_minions << minion if true || minion.provision!
|
41
42
|
unless minion.provisioned?
|
42
|
-
|
43
|
-
|
43
|
+
existing_droplet = droplets.detect { |droplet| droplet.name == minion_name }
|
44
|
+
if existing_droplet
|
45
|
+
Pvcglue.logger.warn("Machine with the name of '#{minion_name}' already exists.")
|
46
|
+
if Thor::Shell::Basic.new.yes?("Existing machine found. Do you want to use #{existing_droplet.id} for #{minion_name}")
|
47
|
+
minion.droplet = existing_droplet
|
48
|
+
new_minions << minion
|
49
|
+
else
|
50
|
+
Pvcglue.logger.error("Machine with the name of '#{minion_name}' already exists.")
|
51
|
+
raise("Machine with the name of '#{minion_name}' already exists.")
|
52
|
+
end
|
53
|
+
else
|
54
|
+
minion.provision!
|
55
|
+
new_minions << minion
|
44
56
|
end
|
45
|
-
minion.provision!
|
46
|
-
new_minions << minion
|
47
57
|
end
|
48
58
|
end
|
49
59
|
Pvcglue.logger_current_minion = nil
|
@@ -73,23 +83,17 @@ module Pvcglue
|
|
73
83
|
# Pvcglue.cloud.reload_minions!
|
74
84
|
end
|
75
85
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
# raise(Thor::Error, 'STOP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
84
|
-
#
|
85
|
-
# %w(lb db web caching redis).each do |role|
|
86
|
-
# if apply_role?(role)
|
87
|
-
# Pvcglue::Packages.apply(role.to_sym, :build, Pvcglue.cloud.minions_filtered(role))
|
88
|
-
# end
|
89
|
-
# end
|
86
|
+
unless Pvcglue.command_line_options[:provision_only]
|
87
|
+
minions.each do |minion_name, minion|
|
88
|
+
next unless minion.has_role?(@roles_filter)
|
89
|
+
Pvcglue.logger_current_minion = minion
|
90
|
+
minion.build!
|
91
|
+
end
|
90
92
|
|
91
|
-
|
93
|
+
Pvcglue.logger_current_minion = nil
|
92
94
|
|
95
|
+
Pvcglue::Pvcify.run unless minions.values.first.minion_manager?
|
96
|
+
end
|
93
97
|
end
|
94
98
|
|
95
99
|
def write_config(minions)
|
@@ -119,10 +123,10 @@ module Pvcglue
|
|
119
123
|
|
120
124
|
def update_minion_data(minion, ip_addresses, cloud_id, data)
|
121
125
|
unless minion.public_ip_address.nil? && minion.private_id_address.nil? && minion.cloud_id.nil?
|
122
|
-
raise(
|
126
|
+
raise("#{minion.machine_name} has previously defined ip address(es) or cloud_id, can not change.")
|
123
127
|
end
|
124
128
|
if ip_addresses.public.nil? || ip_addresses.private.nil? || cloud_id.nil?
|
125
|
-
raise(
|
129
|
+
raise("New IP addresses (#{ip_addresses}) or cloud_id (#{cloud_id}) are not valid.")
|
126
130
|
end
|
127
131
|
|
128
132
|
|
data/lib/pvcglue/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pvcglue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- T. Andrew Lyric
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|