bcome 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/boot.rb +2 -1
- data/lib/bcome/version.rb +1 -1
- data/lib/become_object.rb +2 -1
- data/lib/helpers/environment_ssh.rb +1 -1
- data/lib/helpers/fog_helper.rb +0 -1
- data/lib/helpers/instance_command.rb +7 -7
- data/lib/nodes/base.rb +9 -1
- data/lib/nodes/environment.rb +7 -0
- data/lib/nodes/instance.rb +9 -4
- data/lib/stack/base.rb +12 -4
- data/lib/stack/environment.rb +20 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d23f3d37841f99b3d8e7998b337353a91590ce91
|
4
|
+
data.tar.gz: 875213a92efe4ee0aa2fb9edbdfb6b43eba13225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68ab4309813702f94e0b151e4a87390072855056b1f2330ece75b0b51891056c0a774d87062d415d122bcb825900df3d7ffec7e8fdbdc9b0cda40c5bc811d6cf
|
7
|
+
data.tar.gz: fd9d48bb19d507724584e2104c951a84ae0e257b354aed8adc5e58d385dfd1ee10381c5e5b3691b02f302b811fd539c0bdd0068c64eba94899adf870f24760dc
|
data/bin/boot.rb
CHANGED
@@ -90,7 +90,8 @@ if quick_contexts.any?
|
|
90
90
|
quick_contexts.each_with_index do |resource_context_key, index|
|
91
91
|
|
92
92
|
if direct_commands.include?(resource_context_key) && (index == (quick_contexts.size - 1))
|
93
|
-
unless @context_object.respond_to?(resource_context_key.to_sym)
|
93
|
+
unless @context_object.node.respond_to?(resource_context_key.to_sym)
|
94
|
+
|
94
95
|
puts "You cannot invoke '#{resource_context_key}' at this namespace level".danger
|
95
96
|
exit!
|
96
97
|
end
|
data/lib/bcome/version.rb
CHANGED
data/lib/become_object.rb
CHANGED
@@ -103,7 +103,8 @@ module ::Bcome::BecomeObject
|
|
103
103
|
else
|
104
104
|
puts "\n" + "No list function at this level".warning + "\n\n"
|
105
105
|
puts "Enter 'menu' for all available options".menu_item_white + "\n\n"
|
106
|
-
end
|
106
|
+
end
|
107
|
+
return
|
107
108
|
end
|
108
109
|
alias :ls :list
|
109
110
|
alias :l :list
|
@@ -61,7 +61,7 @@ module ::Bcome::EnvironmentSSH
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def bastion_server
|
64
|
-
|
64
|
+
machines.select{|instance| instance.identifier == @ssh_mode[:jump_host_identifier] }.first
|
65
65
|
end
|
66
66
|
|
67
67
|
def ssh_mode_type
|
data/lib/helpers/fog_helper.rb
CHANGED
@@ -7,19 +7,19 @@ module ::Bcome::InstanceCommand
|
|
7
7
|
|
8
8
|
def execute_command(commands, bootstrap = false)
|
9
9
|
begin
|
10
|
-
return
|
10
|
+
return environment.execute_command(commands, self, bootstrap)
|
11
11
|
rescue
|
12
12
|
unless bootstrap && bootstrap_settings ### Try bootstrap fallback
|
13
13
|
puts "\n BOOTSTRAP MODE".informational
|
14
14
|
bootstrap = true
|
15
|
-
return
|
15
|
+
return environment.execute_command(commands, self, bootstrap)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def put(local_path, remote_path, bootstrap = false)
|
21
21
|
puts "rsync> #{self.identifier}".informational
|
22
|
-
if
|
22
|
+
if environment.ssh_mode_type == ::SSH_DIRECT_MODE_IDENTIFIER
|
23
23
|
## DIRECT MODE
|
24
24
|
rsync_command = bootstrap ? direct_rsync_bootstrap(local_path, remote_path) : direct_rsync(local_path, remote_path)
|
25
25
|
else
|
@@ -34,7 +34,7 @@ module ::Bcome::InstanceCommand
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def jump_host_rsync(local_path, remote_path)
|
37
|
-
"rsync -av -e \"ssh -A #{self.nat_user}@#{
|
37
|
+
"rsync -av -e \"ssh -A #{self.nat_user}@#{environment.bastion_ip_address} ssh -o StrictHostKeyChecking=no\" #{rsync_is_sudo}#{local_path} #{self.ssh_user}@#{self.ip_address}:#{remote_path}"
|
38
38
|
end
|
39
39
|
|
40
40
|
def direct_rsync_bootstrap(local_path, remote_path)
|
@@ -42,17 +42,17 @@ module ::Bcome::InstanceCommand
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def jump_host_rsync_bootstrap(local_path, remote_path)
|
45
|
-
"rsync -av -e \"ssh -i #{bootstrap_settings[:key]} -A #{bootstrap_settings[:ssh_user]}@#{
|
45
|
+
"rsync -av -e \"ssh -i #{bootstrap_settings[:key]} -A #{bootstrap_settings[:ssh_user]}@#{environment.bastion_ip_address} ssh -o StrictHostKeyChecking=no\" #{rsync_is_sudo}#{local_path} #{bootstrap_settings[:ssh_user]}@#{self.ip_address}:#{remote_path}"
|
46
46
|
end
|
47
47
|
|
48
48
|
def get(remote_path, local_path = local_download_path)
|
49
49
|
raise "No local path specified" unless local_path
|
50
50
|
raise "No remote_path specified" unless remote_path
|
51
51
|
|
52
|
-
if
|
52
|
+
if environment.ssh_mode_type == ::SSH_DIRECT_MODE_IDENTIFIER
|
53
53
|
rsync_command = "rsync #{rsync_is_sudo} -chavzP #{self.ssh_user}@#{self.ip_address}:#{remote_path} #{local_path}"
|
54
54
|
else
|
55
|
-
rsync_command = "rsync -chavzP -av -e \"ssh -A #{self.nat_user}@#{
|
55
|
+
rsync_command = "rsync -chavzP -av -e \"ssh -A #{self.nat_user}@#{environment.bastion_ip_address} ssh -o StrictHostKeyChecking=no\" #{rsync_is_sudo}#{self.ssh_user}@#{self.ip_address}:#{remote_path} #{local_path}"
|
56
56
|
end
|
57
57
|
|
58
58
|
silent = true
|
data/lib/nodes/base.rb
CHANGED
@@ -3,7 +3,7 @@ module ::Bcome::Node
|
|
3
3
|
|
4
4
|
include ::Bcome::CommandHelper
|
5
5
|
|
6
|
-
attr_reader :meta_data
|
6
|
+
attr_reader :meta_data, :stack_peer
|
7
7
|
|
8
8
|
def machines
|
9
9
|
raise "Should be overriden"
|
@@ -13,6 +13,14 @@ module ::Bcome::Node
|
|
13
13
|
construct(meta_data)
|
14
14
|
end
|
15
15
|
|
16
|
+
def set_stack_peer(stack_instance)
|
17
|
+
@stack_peer = stack_instance
|
18
|
+
end
|
19
|
+
|
20
|
+
def interactive
|
21
|
+
stack_peer.interactive
|
22
|
+
end
|
23
|
+
|
16
24
|
## Runs a command over *every* machine in this node
|
17
25
|
def run(raw_command, bootstrap = false)
|
18
26
|
return unless machines
|
data/lib/nodes/environment.rb
CHANGED
@@ -4,6 +4,9 @@ module ::Bcome::Node
|
|
4
4
|
include ::Bcome::EnvironmentSSH
|
5
5
|
|
6
6
|
def machines
|
7
|
+
if instances.empty?
|
8
|
+
stack_peer.do_load_resources
|
9
|
+
end
|
7
10
|
instances
|
8
11
|
end
|
9
12
|
|
@@ -19,5 +22,9 @@ module ::Bcome::Node
|
|
19
22
|
"#{platform.namespace}/#{identifier}"
|
20
23
|
end
|
21
24
|
|
25
|
+
def set_instances(loaded_resources)
|
26
|
+
@instances = loaded_resources.collect(&:node)
|
27
|
+
end
|
28
|
+
|
22
29
|
end
|
23
30
|
end
|
data/lib/nodes/instance.rb
CHANGED
@@ -4,6 +4,11 @@ module ::Bcome::Node
|
|
4
4
|
include ::Bcome::InstanceCommand
|
5
5
|
include ::Bcome::InstanceSsh
|
6
6
|
|
7
|
+
def environment
|
8
|
+
@environment = (@environment ? @environment : stack_peer.environment.node)
|
9
|
+
@environment
|
10
|
+
end
|
11
|
+
|
7
12
|
def machines
|
8
13
|
[self] # for completion
|
9
14
|
end
|
@@ -13,15 +18,15 @@ module ::Bcome::Node
|
|
13
18
|
end
|
14
19
|
|
15
20
|
def ip_address
|
16
|
-
|
21
|
+
environment.ssh_mode_type == ::SSH_DIRECT_MODE_IDENTIFIER ? public_ip_address : @external_network_interface_address
|
17
22
|
end
|
18
23
|
|
19
24
|
def bootstrap_settings
|
20
|
-
|
25
|
+
environment.bootstrap_settings
|
21
26
|
end
|
22
27
|
|
23
28
|
def proxy(bootstrap = false)
|
24
|
-
|
29
|
+
environment.proxy(bootstrap)
|
25
30
|
end
|
26
31
|
|
27
32
|
def public_ip_address
|
@@ -45,7 +50,7 @@ module ::Bcome::Node
|
|
45
50
|
end
|
46
51
|
|
47
52
|
def local_download_path
|
48
|
-
"#{Dir.pwd}#{
|
53
|
+
"#{Dir.pwd}#{environment.namespace}/#{identifier}"
|
49
54
|
end
|
50
55
|
|
51
56
|
end
|
data/lib/stack/base.rb
CHANGED
@@ -57,14 +57,21 @@ module ::Bcome::Stack
|
|
57
57
|
return (command_for_context(method_sym) || ::Bcome::Orchestrator::Recipe.by_identifier(method_sym.to_s, self)) ? true : false
|
58
58
|
end
|
59
59
|
|
60
|
+
def should_eager_load_children?
|
61
|
+
return true
|
62
|
+
end
|
63
|
+
|
60
64
|
def construct_node
|
61
65
|
node_attributes = meta_data
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
+
if respond_to?(:collection_key)
|
67
|
+
collection = should_eager_load_children? ? (resources.collect(&:node)) : []
|
68
|
+
node_attributes.merge!({
|
69
|
+
collection_key => collection
|
70
|
+
})
|
71
|
+
end
|
66
72
|
|
67
73
|
this_node = node_level_klass.new(node_attributes)
|
74
|
+
this_node.set_stack_peer(self)
|
68
75
|
this_node.set_parent_reference(this_node, child_reference_key, collection_key) if respond_to?(:collection_key) && respond_to?(:child_reference_key)
|
69
76
|
return this_node
|
70
77
|
end
|
@@ -104,6 +111,7 @@ module ::Bcome::Stack
|
|
104
111
|
alias :cd :workon
|
105
112
|
|
106
113
|
def menu
|
114
|
+
puts "Rendering menu for #{self.class}"
|
107
115
|
::RENDER.menu(menu_items, self)
|
108
116
|
end
|
109
117
|
|
data/lib/stack/environment.rb
CHANGED
@@ -25,6 +25,16 @@ module ::Bcome::Stack
|
|
25
25
|
@platform = parent
|
26
26
|
end
|
27
27
|
|
28
|
+
def machines
|
29
|
+
node_machines = node.machines
|
30
|
+
do_load_resources unless node_machines.any?
|
31
|
+
return node.machines
|
32
|
+
end
|
33
|
+
|
34
|
+
def should_eager_load_children?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
28
38
|
def views
|
29
39
|
@views ||= do_create_views
|
30
40
|
end
|
@@ -87,14 +97,16 @@ module ::Bcome::Stack
|
|
87
97
|
end
|
88
98
|
|
89
99
|
def do_load_resources
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
100
|
+
if dynamic_network_lookup?
|
101
|
+
loaded_resources = collection_klass.collection_from_fog_data(self, servers)
|
102
|
+
else
|
103
|
+
path = config_path
|
104
|
+
raise "Missing instances.yml configuration for your environment. You've selected a static network lookup, and yet I cannot find #{config_path}".failure unless File.exist?(config_path)
|
105
|
+
config = YAML.load_file(path)
|
106
|
+
loaded_resources = collection_klass.collection_from_config(self, config)
|
107
|
+
end
|
108
|
+
node.set_instances(loaded_resources)
|
109
|
+
return loaded_resources
|
98
110
|
end
|
99
111
|
|
100
112
|
def config_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Roderick (Webzakimbo)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.5.1
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Toolkit for managing machines - simplify your workflow.
|