joyent-provisioner 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 350a79b3f24e51021a8dc22a4cb86b2b6837057b
4
+ data.tar.gz: e4a41ef07b05cf7c368c3e23b5b1f64172bedf60
5
+ SHA512:
6
+ metadata.gz: 263f08be6a827e1792ea584d948210245419654c49eb2e895eaa2fc72c8e8cd72ff986d91a06080950a83e41b77cdca936a420f5c12c59cbbacc782d4460789b
7
+ data.tar.gz: 7ec513c91bbbdf36f720bd9a79be84c2ec83665f8cb77604ebbf39f3353c5f9d1b84a26e035afab9c8455a33b40def38aa13eb63b544de95f861b3f7ce22fc30
@@ -48,6 +48,12 @@ module Provisioner
48
48
  description: 'Ruby range or a number for the host, ie 3 or 1..3 or [2,4,6]',
49
49
  required: false
50
50
 
51
+ option :ssh_user,
52
+ short: '-l SSH_USERNAME',
53
+ long: '--user SSH_USERNAME',
54
+ description: 'SSH user used to connect to server (overrides yml configuration)',
55
+ required: false
56
+
51
57
  option :dry,
52
58
  long: '--dry-run',
53
59
  description: 'Dry runs and prints all commands without executing them',
@@ -19,7 +19,7 @@ class Provisioner::CLI::Bootstrap < Provisioner::CLI
19
19
  end
20
20
 
21
21
  def provisioner_command
22
- Provisioner::Command::Bootstrap.new(template_configuration.for_template(config[:template]), config[:number])
22
+ Provisioner::Command::Bootstrap.new(template_configuration.for_template(config[:template]), config[:number], config[:ssh_user])
23
23
  end
24
24
 
25
25
  end
@@ -19,7 +19,7 @@ class Provisioner::CLI::Provision < Provisioner::CLI
19
19
  end
20
20
 
21
21
  def provisioner_command
22
- Provisioner::Command::Provision.new(template_configuration.for_template(config[:template]), config[:number])
22
+ Provisioner::Command::Provision.new(template_configuration.for_template(config[:template]), config[:number], config[:ssh_user])
23
23
  end
24
24
 
25
25
  end
@@ -5,11 +5,12 @@ module Provisioner
5
5
  :host_sequence, :host_prefix, :environment, :host_suffix,
6
6
  :host_presuffix, :log_dir, :host_number, :ssh_user
7
7
 
8
- def initialize(template_configuration, host_number=nil)
8
+ def initialize(template_configuration, host_number=nil, ssh_user=nil)
9
9
  @host_number = host_number
10
10
  template_configuration.each_pair do |key, value|
11
11
  self.send("#{key}=", value)
12
12
  end
13
+ @ssh_user = ssh_user if ssh_user
13
14
  raise "Log path is required" unless @log_dir
14
15
  Dir.mkdir(log_dir) unless Dir.exists?(log_dir)
15
16
  end
@@ -1,3 +1,3 @@
1
1
  module Provisioner
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -2,25 +2,31 @@ require 'spec_helper'
2
2
 
3
3
  describe Provisioner::Command::Bootstrap do
4
4
  describe '#shell_commands' do
5
+ let(:template_configuration) { {
6
+ image: '9ec5c0c-a941-11e2-a7dc-57a6b041988f',
7
+ flavor: 'g3-highmemory-17.125-smartos',
8
+ distro: 'smartos-base64',
9
+ networks: '42325ea0-eb62-44c1-8eb6-0af3e2f83abc,c8cde927-6277-49ca-82a3-741e8b23b02f',
10
+ host_sequence: '1..2',
11
+ host_suffix: 'test',
12
+ host_presuffix: 'c1',
13
+ host_prefix: 'memcached-sessions',
14
+ environment: 'test',
15
+ log_dir: './tmp',
16
+ run_list: 'role[joyent]',
17
+ ssh_user: 'ops'
18
+ } }
19
+
20
+ let(:shell_commands) { subject.shell_commands }
21
+
22
+ before do
23
+ Provisioner::Command::Bootstrap::HostCommand.any_instance.stub(:ip_for_host) { '1.2.3.4' }
24
+ end
25
+
5
26
  context 'host is specified' do
6
27
 
7
28
  let(:subject) { Provisioner::Command::Bootstrap.new(template_configuration, '1') }
8
29
 
9
- let(:template_configuration) { {
10
- image: '9ec5c0c-a941-11e2-a7dc-57a6b041988f',
11
- flavor: 'g3-highmemory-17.125-smartos',
12
- distro: 'smartos-base64',
13
- networks: '42325ea0-eb62-44c1-8eb6-0af3e2f83abc,c8cde927-6277-49ca-82a3-741e8b23b02f',
14
- host_sequence: '1..2',
15
- host_suffix: 'test',
16
- host_presuffix: 'c1',
17
- host_prefix: 'memcached-sessions',
18
- environment: 'test',
19
- log_dir: './tmp',
20
- run_list: 'role[joyent]',
21
- ssh_user: 'ops'
22
- } }
23
-
24
30
  let(:expected_bootstrap_command) { [
25
31
  'knife bootstrap 1.2.3.4',
26
32
  '--distro smartos-base64',
@@ -32,13 +38,29 @@ describe Provisioner::Command::Bootstrap do
32
38
  ].join(' ') }
33
39
 
34
40
  it 'returns command string' do
35
- Provisioner::Command::Bootstrap::HostCommand.any_instance.stub(:ip_for_host) { '1.2.3.4' }
36
- shell_commands = subject.shell_commands
37
-
38
41
  expect(shell_commands[0]).to eq("ssh 1.2.3.4 -l ops 'sudo rm -rf /etc/chef'")
39
42
  expect(shell_commands[1]).to eq(expected_bootstrap_command)
40
43
  end
41
44
  end
45
+
46
+ context 'ssh user is overridden' do
47
+ let(:subject) { Provisioner::Command::Bootstrap.new(template_configuration, '1', 'root') }
48
+
49
+ let(:expected_bootstrap_command) { [
50
+ 'knife bootstrap 1.2.3.4',
51
+ '--distro smartos-base64',
52
+ '--environment test',
53
+ '--node-name memcached-sessions001.c1.test',
54
+ '--run-list role[joyent]',
55
+ '--ssh-user root',
56
+ '2>&1 > ./tmp/memcached-sessions001.c1.test_provision.log &'
57
+ ].join(' ') }
58
+
59
+ it 'returns command string' do
60
+ expect(shell_commands[0]).to eq("ssh 1.2.3.4 -l root 'sudo rm -rf /etc/chef'")
61
+ expect(shell_commands[1]).to eq(expected_bootstrap_command)
62
+ end
63
+ end
42
64
  end
43
65
  end
44
66
 
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joyent-provisioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Konstantin Gredeskoul
@@ -11,76 +10,67 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2013-08-15 00:00:00.000000000 Z
13
+ date: 2013-09-06 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: mixlib-cli
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
- - - ! '>='
19
+ - - '>='
22
20
  - !ruby/object:Gem::Version
23
21
  version: '0'
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
- - - ! '>='
26
+ - - '>='
30
27
  - !ruby/object:Gem::Version
31
28
  version: '0'
32
29
  - !ruby/object:Gem::Dependency
33
30
  name: chef
34
31
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
32
  requirements:
37
- - - ! '>='
33
+ - - '>='
38
34
  - !ruby/object:Gem::Version
39
35
  version: '0'
40
36
  type: :runtime
41
37
  prerelease: false
42
38
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
39
  requirements:
45
- - - ! '>='
40
+ - - '>='
46
41
  - !ruby/object:Gem::Version
47
42
  version: '0'
48
43
  - !ruby/object:Gem::Dependency
49
44
  name: knife-joyent
50
45
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
46
  requirements:
53
- - - ! '>='
47
+ - - '>='
54
48
  - !ruby/object:Gem::Version
55
49
  version: '0'
56
50
  type: :runtime
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
53
  requirements:
61
- - - ! '>='
54
+ - - '>='
62
55
  - !ruby/object:Gem::Version
63
56
  version: '0'
64
57
  - !ruby/object:Gem::Dependency
65
58
  name: colorize
66
59
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
60
  requirements:
69
- - - ! '>='
61
+ - - '>='
70
62
  - !ruby/object:Gem::Version
71
63
  version: '0'
72
64
  type: :runtime
73
65
  prerelease: false
74
66
  version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
67
  requirements:
77
- - - ! '>='
68
+ - - '>='
78
69
  - !ruby/object:Gem::Version
79
70
  version: '0'
80
71
  - !ruby/object:Gem::Dependency
81
72
  name: bundler
82
73
  requirement: !ruby/object:Gem::Requirement
83
- none: false
84
74
  requirements:
85
75
  - - ~>
86
76
  - !ruby/object:Gem::Version
@@ -88,7 +78,6 @@ dependencies:
88
78
  type: :development
89
79
  prerelease: false
90
80
  version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
81
  requirements:
93
82
  - - ~>
94
83
  - !ruby/object:Gem::Version
@@ -96,81 +85,71 @@ dependencies:
96
85
  - !ruby/object:Gem::Dependency
97
86
  name: rake
98
87
  requirement: !ruby/object:Gem::Requirement
99
- none: false
100
88
  requirements:
101
- - - ! '>='
89
+ - - '>='
102
90
  - !ruby/object:Gem::Version
103
91
  version: '0'
104
92
  type: :development
105
93
  prerelease: false
106
94
  version_requirements: !ruby/object:Gem::Requirement
107
- none: false
108
95
  requirements:
109
- - - ! '>='
96
+ - - '>='
110
97
  - !ruby/object:Gem::Version
111
98
  version: '0'
112
99
  - !ruby/object:Gem::Dependency
113
100
  name: guard
114
101
  requirement: !ruby/object:Gem::Requirement
115
- none: false
116
102
  requirements:
117
- - - ! '>='
103
+ - - '>='
118
104
  - !ruby/object:Gem::Version
119
105
  version: '0'
120
106
  type: :development
121
107
  prerelease: false
122
108
  version_requirements: !ruby/object:Gem::Requirement
123
- none: false
124
109
  requirements:
125
- - - ! '>='
110
+ - - '>='
126
111
  - !ruby/object:Gem::Version
127
112
  version: '0'
128
113
  - !ruby/object:Gem::Dependency
129
114
  name: guard-rspec
130
115
  requirement: !ruby/object:Gem::Requirement
131
- none: false
132
116
  requirements:
133
- - - ! '>='
117
+ - - '>='
134
118
  - !ruby/object:Gem::Version
135
119
  version: '0'
136
120
  type: :development
137
121
  prerelease: false
138
122
  version_requirements: !ruby/object:Gem::Requirement
139
- none: false
140
123
  requirements:
141
- - - ! '>='
124
+ - - '>='
142
125
  - !ruby/object:Gem::Version
143
126
  version: '0'
144
127
  - !ruby/object:Gem::Dependency
145
128
  name: rspec
146
129
  requirement: !ruby/object:Gem::Requirement
147
- none: false
148
130
  requirements:
149
- - - ! '>='
131
+ - - '>='
150
132
  - !ruby/object:Gem::Version
151
133
  version: '0'
152
134
  type: :development
153
135
  prerelease: false
154
136
  version_requirements: !ruby/object:Gem::Requirement
155
- none: false
156
137
  requirements:
157
- - - ! '>='
138
+ - - '>='
158
139
  - !ruby/object:Gem::Version
159
140
  version: '0'
160
141
  - !ruby/object:Gem::Dependency
161
142
  name: pry-debugger
162
143
  requirement: !ruby/object:Gem::Requirement
163
- none: false
164
144
  requirements:
165
- - - ! '>='
145
+ - - '>='
166
146
  - !ruby/object:Gem::Version
167
147
  version: '0'
168
148
  type: :development
169
149
  prerelease: false
170
150
  version_requirements: !ruby/object:Gem::Requirement
171
- none: false
172
151
  requirements:
173
- - - ! '>='
152
+ - - '>='
174
153
  - !ruby/object:Gem::Version
175
154
  version: '0'
176
155
  description: Wrapper gem around provisioning clusters of servers on Joyent cloud
@@ -219,33 +198,26 @@ files:
219
198
  homepage: ''
220
199
  licenses:
221
200
  - MIT
201
+ metadata: {}
222
202
  post_install_message:
223
203
  rdoc_options: []
224
204
  require_paths:
225
205
  - lib
226
206
  required_ruby_version: !ruby/object:Gem::Requirement
227
- none: false
228
207
  requirements:
229
- - - ! '>='
208
+ - - '>='
230
209
  - !ruby/object:Gem::Version
231
210
  version: '0'
232
- segments:
233
- - 0
234
- hash: 2750024294066364636
235
211
  required_rubygems_version: !ruby/object:Gem::Requirement
236
- none: false
237
212
  requirements:
238
- - - ! '>='
213
+ - - '>='
239
214
  - !ruby/object:Gem::Version
240
215
  version: '0'
241
- segments:
242
- - 0
243
- hash: 2750024294066364636
244
216
  requirements: []
245
217
  rubyforge_project:
246
- rubygems_version: 1.8.24
218
+ rubygems_version: 2.0.2
247
219
  signing_key:
248
- specification_version: 3
220
+ specification_version: 4
249
221
  summary: Wrapper gem around provisioning clusters of servers on Joyent cloud
250
222
  test_files:
251
223
  - spec/fixtures/test.yml