broadside 3.1.3 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/broadside/command.rb +12 -5
- data/lib/broadside/gli/commands.rb +5 -1
- data/lib/broadside/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: 7f38120e5ed461522f423547c8f4cb6cb1d80dc2
|
4
|
+
data.tar.gz: 46b2213e403886e691880e640752fd2791bc0b69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452b96e5e2567b1e954897c3652742199b33402e718c9d0cb63131b1756691ed7f4c9895a06695dce6ee75046042290f7b6c7f015d6d9f057fda561b879e5467
|
7
|
+
data.tar.gz: 783ae62663751c666413f2a2a72d2ba6d745e419254c0c8fccd2769cb415686cc4378b00b6da3298eaf11549004c2fdb63445e9496d84027c76c5a0d03d0b112
|
data/CHANGELOG.md
CHANGED
data/lib/broadside/command.rb
CHANGED
@@ -6,6 +6,7 @@ module Broadside
|
|
6
6
|
module Command
|
7
7
|
extend LoggingUtils
|
8
8
|
|
9
|
+
BASH = 'bash'.freeze
|
9
10
|
DEFAULT_TAIL_LINES = 10
|
10
11
|
|
11
12
|
class << self
|
@@ -95,7 +96,7 @@ module Broadside
|
|
95
96
|
info "Tailing logs for running container at #{ip}..."
|
96
97
|
|
97
98
|
cmd = "docker logs -f --tail=#{lines} `#{docker_ps_cmd(target.family)}`"
|
98
|
-
|
99
|
+
system_exec(Broadside.config.ssh_cmd(ip) + " '#{cmd}'")
|
99
100
|
end
|
100
101
|
|
101
102
|
def ssh(options)
|
@@ -103,20 +104,26 @@ module Broadside
|
|
103
104
|
ip = get_running_instance_ip!(target, *options[:instance])
|
104
105
|
info "Establishing SSH connection to #{ip}..."
|
105
106
|
|
106
|
-
|
107
|
+
system_exec(Broadside.config.ssh_cmd(ip))
|
107
108
|
end
|
108
109
|
|
109
110
|
def bash(options)
|
111
|
+
command = options[:command] || BASH
|
110
112
|
target = Broadside.config.get_target_by_name!(options[:target])
|
111
113
|
ip = get_running_instance_ip!(target, *options[:instance])
|
112
|
-
|
114
|
+
cmd = "docker exec -i -t `#{docker_ps_cmd(target.family)}` #{command}"
|
115
|
+
info "Executing #{command} on running container at #{ip}..."
|
113
116
|
|
114
|
-
|
115
|
-
exec(Broadside.config.ssh_cmd(ip, tty: true) + " '#{cmd}'")
|
117
|
+
system_exec(Broadside.config.ssh_cmd(ip, tty: command == BASH) + " '#{cmd}'")
|
116
118
|
end
|
117
119
|
|
118
120
|
private
|
119
121
|
|
122
|
+
def system_exec(cmd)
|
123
|
+
debug "Executing: #{cmd}"
|
124
|
+
exec(cmd)
|
125
|
+
end
|
126
|
+
|
120
127
|
def get_running_instance_ip!(target, instance_index = 0)
|
121
128
|
EcsManager.check_service_and_task_definition_state!(target)
|
122
129
|
running_instances = EcsManager.get_running_instance_ips!(target.cluster, target.family)
|
@@ -91,10 +91,14 @@ command :ssh do |ssh|
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
desc 'Establish a shell inside a running container.'
|
94
|
+
desc 'Establish a shell or run a bash command inside a running container.'
|
95
95
|
command :bash do |bash|
|
96
96
|
add_command_flags(bash)
|
97
97
|
|
98
|
+
bash.desc 'bash command to run (wrap argument in quotes)'
|
99
|
+
bash.arg_name 'BASH_COMMAND'
|
100
|
+
bash.flag [:c, :command], type: Array
|
101
|
+
|
98
102
|
bash.action do |_, options, _|
|
99
103
|
Broadside::Command.bash(options)
|
100
104
|
end
|
data/lib/broadside/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: broadside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Leung
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|