bcome 0.3.2 → 0.3.3
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/documentation/external_usage.md +15 -0
- data/lib/bcome.rb +1 -0
- data/lib/bcome/version.rb +1 -1
- data/lib/command.rb +2 -2
- data/lib/functions.rb +1 -1
- data/lib/helpers/selections.rb +3 -1
- data/lib/ssh.rb +11 -4
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 014cefb974e62be9d8a7f59c5b3712375a58fdfc
|
|
4
|
+
data.tar.gz: cf0d5ca26ed706988090518fdc0a11a9a0bf9f8a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 075d3d930d562803e00ff424009421e9b2536f33ff8f774e7a5deb41dc1fc28d53d32d3fcba3354666c78c770ea90916b37cc421c61ba553ca37325d70461e37
|
|
7
|
+
data.tar.gz: d6d8baa2cf39f2c7ea621e210371c883d5f4725c99dc65aea3b4c4266783330d21a9789f2db94b00ef2ca6cc253ea6443c38ec184e77d178d20404dd42697328
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# External Usage
|
|
2
2
|
|
|
3
|
+
## Scripting
|
|
4
|
+
|
|
3
5
|
Bcome may be used for scripting outside of the bcome shell.
|
|
4
6
|
|
|
5
7
|
This allows for integration with tools such as Capistrano, or for any ad-hoc scripting need.
|
|
@@ -29,3 +31,16 @@ see documentation/example_non_shell_scripts/examples_script_platform_level.rb
|
|
|
29
31
|
### Interacting with your entire estate
|
|
30
32
|
|
|
31
33
|
see documentation/example_non_shell_scripts/examples_script_entire_estate.rb
|
|
34
|
+
|
|
35
|
+
## Direct SSH to nodes
|
|
36
|
+
|
|
37
|
+
If you know the context breadcrumb for a node, you may use the bcome gem to SSH to it directly without accessing the node via the bcome shell.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> bcome platform:environment:instancename:ssh
|
|
42
|
+
e.g.
|
|
43
|
+
> bcome myplatformname:production:appserver1:ssh
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
data/lib/bcome.rb
CHANGED
data/lib/bcome/version.rb
CHANGED
data/lib/command.rb
CHANGED
|
@@ -17,7 +17,7 @@ class ::Bcome::Command
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def pretty_result
|
|
20
|
-
return is_success? ? "
|
|
20
|
+
return is_success? ? "success".success : "failure".failure
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def ssh_user
|
|
@@ -38,7 +38,7 @@ class ::Bcome::Command
|
|
|
38
38
|
|
|
39
39
|
def output
|
|
40
40
|
command_output = is_success? ? @stdout : "Exit code: #{@exit_code}\n\nSTDERR: #{@stderr}"
|
|
41
|
-
return "\n#{command_output}
|
|
41
|
+
return "\n#{command_output}"
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def is_success?
|
data/lib/functions.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Bcome::Functions
|
|
|
24
24
|
else
|
|
25
25
|
command = cmd_for_ref(reference)
|
|
26
26
|
if command
|
|
27
|
-
puts "#{"Executing command '#{command[:ref]}': ".informational} > #{command[:command].command}"
|
|
27
|
+
#puts "#{"Executing command '#{command[:ref]}': ".informational} > #{command[:command].command}"
|
|
28
28
|
puts run command[:command]
|
|
29
29
|
end
|
|
30
30
|
end
|
data/lib/helpers/selections.rb
CHANGED
|
@@ -16,9 +16,11 @@ module Bcome::Selections
|
|
|
16
16
|
## Runs commands over *every* object in the selection
|
|
17
17
|
def run(raw_commands, bootstrap = false)
|
|
18
18
|
return unless @objects
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
Parallel.map(@objects) do |object|
|
|
20
21
|
object.run(raw_commands, bootstrap)
|
|
21
22
|
end
|
|
23
|
+
|
|
22
24
|
return
|
|
23
25
|
end
|
|
24
26
|
|
data/lib/ssh.rb
CHANGED
|
@@ -6,6 +6,14 @@ class ::Bcome::Ssh
|
|
|
6
6
|
@commands = commands
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
+
def output_append(output_string)
|
|
10
|
+
@output_string = "#{@output_string}#{output_string}"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def print_output
|
|
14
|
+
print "#{@output_string}\n"
|
|
15
|
+
end
|
|
16
|
+
|
|
9
17
|
def execute!
|
|
10
18
|
@commands.each do |command|
|
|
11
19
|
instance = command.instance
|
|
@@ -14,13 +22,12 @@ class ::Bcome::Ssh
|
|
|
14
22
|
proxy = command.proxy
|
|
15
23
|
|
|
16
24
|
::Net::SSH.start(instance.ip_address, ssh_user, :proxy => proxy, :keys => ssh_keys, :paranoid => false) do |ssh|
|
|
17
|
-
puts "(#{instance.identifier})$".cyan + "\s#{command.command}"
|
|
18
25
|
ssh_exec!(ssh, command)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
print "\n"
|
|
26
|
+
output_append("(#{instance.identifier})$".cyan + ">\s#{command.command} (#{command.pretty_result})\n")
|
|
27
|
+
output_append("#{command.output}")
|
|
22
28
|
ssh.close
|
|
23
29
|
end
|
|
30
|
+
print_output
|
|
24
31
|
end
|
|
25
32
|
end
|
|
26
33
|
|
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.3.
|
|
4
|
+
version: 0.3.3
|
|
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-05-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk
|
|
@@ -100,6 +100,20 @@ dependencies:
|
|
|
100
100
|
- - '='
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
102
|
version: 1.3.3
|
|
103
|
+
- !ruby/object:Gem::Dependency
|
|
104
|
+
name: parallel
|
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - '='
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 1.8.0
|
|
110
|
+
type: :runtime
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - '='
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: 1.8.0
|
|
103
117
|
description: Provides a console interface for traversing a hierarchy of platforms
|
|
104
118
|
-> environment -> servers, and exposes common administration tools for the managemenent
|
|
105
119
|
either of individual servers, or groups or servers. System is driven from simple
|