simple_deploy 0.8.2 → 0.9.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 +6 -0
- data/lib/simple_deploy/cli/execute.rb +3 -1
- data/lib/simple_deploy/stack/execute.rb +3 -14
- data/lib/simple_deploy/stack/ssh.rb +6 -0
- data/lib/simple_deploy/version.rb +1 -1
- data/spec/stack/execute_spec.rb +0 -1
- data/spec/stack/ssh_spec.rb +25 -2
- 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: 3b5a66b5ce4397770ae389fd8556235e5f07f266
|
4
|
+
data.tar.gz: c628209bc7ee9c690904a3f7c05f208eb236bb7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83fea4bf75b0e8371eb2c1e41066c831b5a6218aeb8f2f4f916cd5b03268514bde9466aeccaf542ade70a9a23adeefd5e76256163424c43ead64376e6a3341fa
|
7
|
+
data.tar.gz: b3a4baff01c426bef2949cfe555b03b342beb3e0878484a21ef4c0484a6cfdf79770e9cbe7a9b8a982fe1cc3ce6d9fdd93a49dcb635d7c12e37a4e02e939d87a
|
data/CHANGELOG.md
CHANGED
@@ -35,6 +35,7 @@ EOS
|
|
35
35
|
:default => 'info'
|
36
36
|
opt :name, "Stack name(s) of stack to deploy", :type => :string,
|
37
37
|
:multi => true
|
38
|
+
opt :pty, "Set pty to true when executing commands."
|
38
39
|
opt :sudo, "Execute command with sudo"
|
39
40
|
end
|
40
41
|
|
@@ -55,7 +56,8 @@ EOS
|
|
55
56
|
|
56
57
|
begin
|
57
58
|
unless stack.execute :command => @opts[:command],
|
58
|
-
:sudo => @opts[:sudo]
|
59
|
+
:sudo => @opts[:sudo],
|
60
|
+
:pty => @opts[:pty]
|
59
61
|
exit 1
|
60
62
|
end
|
61
63
|
rescue SimpleDeploy::Exceptions::NoInstances
|
@@ -4,13 +4,8 @@ module SimpleDeploy
|
|
4
4
|
class Stack
|
5
5
|
class Execute
|
6
6
|
def initialize(args)
|
7
|
-
@config
|
8
|
-
@
|
9
|
-
@environment = args[:environment]
|
10
|
-
@ssh_user = args[:ssh_user]
|
11
|
-
@ssh_key = args[:ssh_key]
|
12
|
-
@stack = args[:stack]
|
13
|
-
@name = args[:name]
|
7
|
+
@config = SimpleDeploy.config
|
8
|
+
@args = args
|
14
9
|
end
|
15
10
|
|
16
11
|
def execute(args)
|
@@ -20,13 +15,7 @@ module SimpleDeploy
|
|
20
15
|
private
|
21
16
|
|
22
17
|
def ssh
|
23
|
-
|
24
|
-
:environment => @environment,
|
25
|
-
:ssh_user => @ssh_user,
|
26
|
-
:ssh_key => @ssh_key,
|
27
|
-
:stack => @stack,
|
28
|
-
:name => @name }
|
29
|
-
@ssh ||= SimpleDeploy::Stack::SSH.new options
|
18
|
+
@ssh ||= SimpleDeploy::Stack::SSH.new @args
|
30
19
|
end
|
31
20
|
|
32
21
|
end
|
@@ -55,6 +55,12 @@ module SimpleDeploy
|
|
55
55
|
def set_execute_command(args)
|
56
56
|
command = args[:command]
|
57
57
|
sudo = args[:sudo]
|
58
|
+
pty = args[:pty]
|
59
|
+
|
60
|
+
if pty
|
61
|
+
@logger.debug "Setting pty to true."
|
62
|
+
@task.variables[:default_run_options] = { :pty => true }
|
63
|
+
end
|
58
64
|
|
59
65
|
@logger.info "Setting command: '#{command}'."
|
60
66
|
if sudo
|
data/spec/stack/execute_spec.rb
CHANGED
data/spec/stack/ssh_spec.rb
CHANGED
@@ -16,6 +16,7 @@ describe SimpleDeploy::Stack::SSH do
|
|
16
16
|
:ssh_user => 'user',
|
17
17
|
:ssh_key => 'key',
|
18
18
|
:stack => @stack_stub,
|
19
|
+
:pty => true,
|
19
20
|
:name => 'test-stack' }
|
20
21
|
@task_logger_mock = mock 'task_logger'
|
21
22
|
@ssh_options = Hash.new
|
@@ -99,7 +100,8 @@ describe SimpleDeploy::Stack::SSH do
|
|
99
100
|
@task_mock.should_receive(:load).with({ :string=>"task :execute do\n sudo 'uname'\n end" })
|
100
101
|
@task_mock.should_receive(:execute).and_return true
|
101
102
|
|
102
|
-
@ssh.execute(:
|
103
|
+
@ssh.execute(:pty => false,
|
104
|
+
:sudo => true,
|
103
105
|
:command => 'uname').should be_true
|
104
106
|
end
|
105
107
|
|
@@ -107,10 +109,31 @@ describe SimpleDeploy::Stack::SSH do
|
|
107
109
|
@task_mock.should_receive(:load).with({ :string=>"task :execute do\n run 'uname'\n end" })
|
108
110
|
@task_mock.should_receive(:execute).and_return true
|
109
111
|
|
110
|
-
@ssh.execute(:
|
112
|
+
@ssh.execute(:pty => false,
|
113
|
+
:sudo => false,
|
111
114
|
:command => 'uname').should be_true
|
112
115
|
end
|
113
116
|
|
117
|
+
it "should set the task variables" do
|
118
|
+
@task_mock.should_receive(:load).with({ :string=>"task :execute do\n run 'uname'\n end" })
|
119
|
+
@task_mock.should_receive(:execute).and_return true
|
120
|
+
|
121
|
+
@ssh.execute(:pty => false,
|
122
|
+
:sudo => false,
|
123
|
+
:command => 'uname')
|
124
|
+
expect(@task_mock.variables).to eq ({ :ssh_options => { :keys => "key", :paranoid => false } })
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should set the pty to true" do
|
128
|
+
@task_mock.should_receive(:load).with({ :string=>"task :execute do\n sudo 'uname'\n end" })
|
129
|
+
@task_mock.should_receive(:execute).and_return true
|
130
|
+
|
131
|
+
@ssh.execute(:pty => true,
|
132
|
+
:sudo => true,
|
133
|
+
:command => 'uname')
|
134
|
+
expect(@task_mock.variables[:default_run_options]).to eq ({ :pty => true })
|
135
|
+
end
|
136
|
+
|
114
137
|
it "sets the ssh options" do
|
115
138
|
@task_mock.stub(:load)
|
116
139
|
@task_mock.stub(:execute).and_return(true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Weaver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakefs
|