bcome 0.5.6 → 0.6.0
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 +1 -0
- data/lib/bcome/version.rb +1 -1
- data/lib/become_object.rb +1 -1
- data/lib/helpers/environment_ssh.rb +1 -1
- data/lib/interactive/session_item/transparent_ssh.rb +1 -1
- data/lib/render_irb.rb +1 -1
- data/lib/stack/environment.rb +57 -2
- data/lib/stack/instance.rb +4 -0
- data/lib/stack/view.rb +56 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0356068ab732695cc27cf83578703579897e3352
|
4
|
+
data.tar.gz: be45f5cceabe3e3505a2006cf497dde93b49c569
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cba40a7c1a3dc390b036c6f370196c740e7afa34a0c55d6979028e1b2ff1b3147bcbce1beddf17b76d22383627b8e1befebfd3b4e021552da977772df0c93c2
|
7
|
+
data.tar.gz: 79a7ebe9b9b47c111d416f670fb9dcded28deda2f474a2288d724887a479af169a0c3e5293db4416b500fca2d93ab5ae2092362f682294b5b5222a4603c68b8b
|
data/bin/boot.rb
CHANGED
@@ -117,6 +117,7 @@ if quick_contexts.any?
|
|
117
117
|
# Initialize our object namespace, but only from our lowest level namespace object. This
|
118
118
|
# ensures that we don't load more than we need.
|
119
119
|
if is_first_context
|
120
|
+
next_context_resource = ESTATE if next_context_resource.nil?
|
120
121
|
next_context_resource.init
|
121
122
|
is_first_context = false
|
122
123
|
end
|
data/lib/bcome/version.rb
CHANGED
data/lib/become_object.rb
CHANGED
@@ -92,7 +92,7 @@ module ::Bcome::EnvironmentSSH
|
|
92
92
|
|
93
93
|
def bastion_ip_address
|
94
94
|
unless bastion_server
|
95
|
-
raise "Unable to
|
95
|
+
raise "Unable to find the jump host. No instance found with identifier '#{@ssh_mode[:jump_host_identifier]}'. Check your network.yml config for this stack, and ensure that you've got the correct value for key 'jump_host_identifier'"
|
96
96
|
end
|
97
97
|
|
98
98
|
if dynamic_network_lookup?
|
@@ -67,7 +67,7 @@ module Bcome::Interactive::SessionItem
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def machines
|
70
|
-
@machines ||= has_selected_machines? ? selected_machines : @irb_session.
|
70
|
+
@machines ||= has_selected_machines? ? selected_machines : @irb_session.resources.collect(&:node)
|
71
71
|
end
|
72
72
|
|
73
73
|
def has_selected_machines?
|
data/lib/render_irb.rb
CHANGED
@@ -10,7 +10,7 @@ class ::Bcome::RenderIrb
|
|
10
10
|
puts "\t*/added".danger + "\n" if item.highlight?
|
11
11
|
print item.do_describe
|
12
12
|
end
|
13
|
-
print "\n\s\
|
13
|
+
print "\n\s\sTo work on any given node, use the cd command e.g. cd #{items.first.identifier}\n\n"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
data/lib/stack/environment.rb
CHANGED
@@ -25,6 +25,51 @@ module ::Bcome::Stack
|
|
25
25
|
@platform = parent
|
26
26
|
end
|
27
27
|
|
28
|
+
def views
|
29
|
+
@views ||= do_create_views
|
30
|
+
end
|
31
|
+
|
32
|
+
def has_views?
|
33
|
+
views.any?
|
34
|
+
end
|
35
|
+
|
36
|
+
def list_views
|
37
|
+
if has_views?
|
38
|
+
::RENDER.list_items("Sub-views", views)
|
39
|
+
else
|
40
|
+
puts "\n" + "This environment has no configured sub-views".warning + "\n\n"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
alias :lv :list_views
|
44
|
+
|
45
|
+
def resource_identifiers
|
46
|
+
@resource_identifiers ||= resource_identifiers_with_views
|
47
|
+
end
|
48
|
+
|
49
|
+
def resource_identifiers_with_views
|
50
|
+
return has_views? ? (resources.collect(&:identifier) << views.collect(&:identifier)).flatten : resources.collect(&:identifier)
|
51
|
+
end
|
52
|
+
|
53
|
+
def resource_for_identifier(identifier)
|
54
|
+
match = super
|
55
|
+
unless match
|
56
|
+
# Unless we've found a match amongst our server instances, look in our views
|
57
|
+
matches = views.select {|view| view.identifier.to_sym == identifier.to_sym }
|
58
|
+
raise "Retrieved more than one match for #{collection_key} '#{identifier}'. Selection is ambiguous" if matches.size > 1
|
59
|
+
match = matches.first
|
60
|
+
end
|
61
|
+
return match
|
62
|
+
end
|
63
|
+
|
64
|
+
def do_create_views
|
65
|
+
return [] unless meta_data[:sub_views]
|
66
|
+
view_collection = []
|
67
|
+
meta_data[:sub_views].each do |sub_view_data|
|
68
|
+
view_collection << ::Bcome::Stack::View.new(@meta_data, @platform, self, sub_view_data)
|
69
|
+
end
|
70
|
+
return view_collection
|
71
|
+
end
|
72
|
+
|
28
73
|
def menu_items
|
29
74
|
super + [
|
30
75
|
{ :command => "add", :description => "Add a resource you wish to work on.", :usage => "add MyServerIdentifier, OR add [array, of, identifiers]" },
|
@@ -36,7 +81,8 @@ module ::Bcome::Stack
|
|
36
81
|
{ :command => "get", :description => "Download from remote from all selected resources (recursive - uses rsync)", :usage => "get 'remote_path'" },
|
37
82
|
{ :command => "put", :description => "Copy files up to all selected resources (recursive - uses rsync)", :usage => "put 'local_path', 'remote_path'" },
|
38
83
|
{ :command => "sudo", :description => "Run 'get' and 'put' in sudo mode (assumes you have passwordless sudo setup)" },
|
39
|
-
{ :command => 'functions', :description => "List all available custom functions" }
|
84
|
+
{ :command => 'functions', :description => "List all available custom functions" },
|
85
|
+
{ :command => 'lv', :description => "List all configured sub-views" },
|
40
86
|
]
|
41
87
|
end
|
42
88
|
|
@@ -56,9 +102,18 @@ module ::Bcome::Stack
|
|
56
102
|
end
|
57
103
|
|
58
104
|
def do_describe
|
105
|
+
description
|
106
|
+
end
|
107
|
+
|
108
|
+
def description
|
59
109
|
desc = "\tNode Id:".menu_item_cyan + "\s#{node.identifier}".menu_item_green + "\n"
|
60
110
|
desc += "\tNet Lookup:".menu_item_cyan + "\s#{node.network_lookup_type}".menu_item_white + "\n"
|
61
|
-
desc += "\tSSH Mode:".menu_item_cyan + "\s#{node.ssh_mode_type}".menu_item_white
|
111
|
+
desc += "\tSSH Mode:".menu_item_cyan + "\s#{node.ssh_mode_type}".menu_item_white
|
112
|
+
if has_views?
|
113
|
+
views.each do |view|
|
114
|
+
desc += "\n\t \\ #{"view".menu_item_cyan}: #{view.identifier.menu_item_green}"
|
115
|
+
end
|
116
|
+
end
|
62
117
|
return desc + "\n\n"
|
63
118
|
end
|
64
119
|
|
data/lib/stack/instance.rb
CHANGED
data/lib/stack/view.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module ::Bcome::Stack
|
2
|
+
class View < ::Bcome::Stack::Environment
|
3
|
+
|
4
|
+
def initialize(meta_data, parent, encapsulating_environment, sub_view_data)
|
5
|
+
@meta_data = meta_data
|
6
|
+
@identifier = sub_view_data[:id]
|
7
|
+
@platform = parent
|
8
|
+
@sub_view_data = sub_view_data
|
9
|
+
@encapsulating_environment = encapsulating_environment
|
10
|
+
end
|
11
|
+
|
12
|
+
def views
|
13
|
+
[]
|
14
|
+
end
|
15
|
+
|
16
|
+
def has_views?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_load_resources
|
21
|
+
@filtered_resources ||= filter_resources
|
22
|
+
end
|
23
|
+
|
24
|
+
def node
|
25
|
+
@encapsulating_environment.node
|
26
|
+
end
|
27
|
+
|
28
|
+
def pretty_selectors
|
29
|
+
raw = @sub_view_data[:selectors]
|
30
|
+
return raw.collect{|key, values|
|
31
|
+
values.collect{|value|
|
32
|
+
"\s(node.#{key} == '#{value}')"
|
33
|
+
}
|
34
|
+
}.join("\sOR".friendly)
|
35
|
+
end
|
36
|
+
|
37
|
+
def description
|
38
|
+
desc = "\tidentifier:".menu_item_cyan + "\s#{identifier}".menu_item_green + "\n"
|
39
|
+
desc += "\tselectors:".menu_item_cyan + "\s#{pretty_selectors}" + "\n"
|
40
|
+
return desc + "\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def filter_resources
|
46
|
+
@encapsulating_environment.resources.select{|resource| resource_belongs_in_filtered_list?(resource) }
|
47
|
+
end
|
48
|
+
|
49
|
+
def resource_belongs_in_filtered_list?(resource)
|
50
|
+
@sub_view_data[:selectors].select {|selector,values|
|
51
|
+
values.include?(resource.node.send(selector))
|
52
|
+
}.any?
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
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.
|
4
|
+
version: 0.6.0
|
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-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- lib/stack/estate.rb
|
182
182
|
- lib/stack/instance.rb
|
183
183
|
- lib/stack/platform.rb
|
184
|
+
- lib/stack/view.rb
|
184
185
|
- lib/workspace_context.rb
|
185
186
|
- patches/irb.rb
|
186
187
|
homepage: https://github.com/webzakimbo/bcome
|
@@ -204,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
205
|
version: '0'
|
205
206
|
requirements: []
|
206
207
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.5.1
|
208
209
|
signing_key:
|
209
210
|
specification_version: 4
|
210
211
|
summary: Toolkit for managing machines - simplify your workflow.
|