vagrant-conoha 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa4bd10b2a107179aa14e28588d48e7427e00d35
4
- data.tar.gz: c848529d96ccee054b664a6d6cf3caaa3ecc13e5
3
+ metadata.gz: 9d60e497dbb3d04ba6cb029c4ffacd77ceb0d574
4
+ data.tar.gz: 94bbb833c14bdd25d31b3040ddfb331f388e16d4
5
5
  SHA512:
6
- metadata.gz: 243f369437e47efa7b0b3f6ac4b7550b1197142156ae69fdb806e0e914bb15b63ea399ad4affbc973d4fa991c5dbd7536cd4606af572c44076d5de16bba6e925
7
- data.tar.gz: cba4520b674437eb3906c10db53eac872856e4c10165ca58c0e1259d037f1075534c7b33b3b11a9b6d3020eb7386af903ab157e1a70f496da22ca8b303eb3bf3
6
+ metadata.gz: 68afef1ff3d64706c617d78477673c9d06ba69caa10457d1f2ae62ea5ca0a881889ed59656419da1262f8aea148b3095b4b3afafdd897f8f39a6c569cec946cc
7
+ data.tar.gz: 317eb48768f36c44e01397f23f9ac2b21e31b018060ac13f3267e71d5aff5ce6a04f7edca9e837bd28260a80d77bca4b7845e6e10daec09c19fb41a936b68091
data/Vagrantfile CHANGED
@@ -42,6 +42,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
42
42
  # tyo1 sin1 sjc1のどれかです。
43
43
  conoha.region = "tyo1"
44
44
 
45
+ # VPSのrootパスワードを設定します。
46
+ # 空文字の場合はパスワードは設定されません
47
+ # (コンソールログイン不可になります)
48
+ conoha.admin_pass = ""
49
+
45
50
  # VPSのネームタグを指定します。
46
51
  conoha.metadata = {
47
52
  instance_name_tag: "vagrant_conoha"
@@ -36,6 +36,7 @@ module VagrantPlugins
36
36
  networks: @resolver.resolve_networks(env),
37
37
  volumes: @resolver.resolve_volumes(env),
38
38
  keypair_name: @resolver.resolve_keypair(env),
39
+ admin_pass: env[:machine].provider_config.admin_pass,
39
40
  availability_zone: env[:machine].provider_config.availability_zone,
40
41
  scheduler_hints: env[:machine].provider_config.scheduler_hints,
41
42
  security_groups: @resolver.resolve_security_groups(env),
@@ -119,6 +120,7 @@ module VagrantPlugins
119
120
  networks: options[:networks],
120
121
  scheduler_hints: options[:scheduler_hints],
121
122
  security_groups: options[:security_groups],
123
+ admin_pass: options[:admin_pass],
122
124
  user_data: options[:user_data],
123
125
  metadata: options[:metadata]
124
126
  }
@@ -66,6 +66,9 @@ module VagrantPlugins
66
66
  end
67
67
  s['flavorRef'] = options[:flavor_ref]
68
68
  s['key_name'] = options[:keypair]
69
+
70
+
71
+ s['adminPass'] = options[:admin_pass] unless options[:admin_pass].nil? || options[:admin_pass].empty?
69
72
  s['availability_zone'] = options[:availability_zone] unless options[:availability_zone].nil?
70
73
  s['security_groups'] = options[:security_groups] unless options[:security_groups].nil?
71
74
  s['user_data'] = Base64.encode64(options[:user_data]) unless options[:user_data].nil?
@@ -67,6 +67,11 @@ module VagrantPlugins
67
67
  # @return [String]
68
68
  attr_accessor :keypair_name
69
69
 
70
+ # The unix root password of OpenStack instance.
71
+ #
72
+ # @return [String]
73
+ attr_accessor :admin_pass
74
+
70
75
  # The SSH username to use with this OpenStack instance. This overrides
71
76
  # the `config.ssh.username` variable.
72
77
  #
@@ -213,6 +218,7 @@ module VagrantPlugins
213
218
  @rsync_includes = []
214
219
  @rsync_ignore_files = []
215
220
  @keypair_name = UNSET_VALUE
221
+ @admin_pass = UNSET_VALUE
216
222
  @ssh_username = UNSET_VALUE
217
223
  @ssh_timeout = UNSET_VALUE
218
224
  @floating_ip = UNSET_VALUE
@@ -300,6 +306,7 @@ module VagrantPlugins
300
306
  @floating_ip_pool_always_allocate = false if floating_ip_pool_always_allocate == UNSET_VALUE
301
307
  @sync_method = 'rsync' if @sync_method == UNSET_VALUE
302
308
  @keypair_name = nil if @keypair_name == UNSET_VALUE
309
+ @admin_pass = nil if @admin_pass == UNSET_VALUE
303
310
  @public_key_path = nil if @public_key_path == UNSET_VALUE
304
311
  @availability_zone = nil if @availability_zone == UNSET_VALUE
305
312
  @scheduler_hints = nil if @scheduler_hints == UNSET_VALUE
@@ -340,6 +347,7 @@ module VagrantPlugins
340
347
  validate_ssh_username(machine, errors)
341
348
  validate_stack_config(errors)
342
349
  validate_ssh_timeout(errors)
350
+ validate_admin_pass(errors)
343
351
 
344
352
  if machine.config.ssh.private_key_path
345
353
  puts I18n.t('vagrant_openstack.config.keypair_name_required').yellow unless @keypair_name || @public_key_path
@@ -363,6 +371,13 @@ module VagrantPlugins
363
371
 
364
372
  private
365
373
 
374
+ def validate_admin_pass(errors)
375
+ return if @admin_pass == '' or @admin_pass == nil
376
+
377
+ reg = /\A(?=.*?[A-Z])(?=.*?[a-z])(?=.*?\d)(?=.*?[!-~&&[^A-Za-z\d]])[!-~]{9,70}+\z/
378
+ errors << I18n.t('vagrant_openstack.config.invalid_admin_pass') unless @admin_pass =~ reg
379
+ end
380
+
366
381
  def validate_stack_config(errors)
367
382
  @stacks.each do |stack|
368
383
  errors << I18n.t('vagrant_openstack.config.invalid_stack') unless stack[:name] && stack[:template]
@@ -4,7 +4,7 @@ module VagrantPlugins
4
4
  # Stable versions must respect the pattern given
5
5
  # by VagrantPlugins::ConoHa::VERSION_PATTERN
6
6
  #
7
- VERSION = '0.1.0'
7
+ VERSION = '0.1.1'
8
8
 
9
9
  #
10
10
  # Stable version must respect the naming convention 'x.y.z'
data/locales/en.yml CHANGED
@@ -134,6 +134,8 @@ en:
134
134
  vagrant standard configuration option `ssh.username` is required
135
135
  invalid_value_for_parameter: |-
136
136
  Invalid value '%{value}' for parameter '%{parameter}'
137
+ invalid_admin_pass: |-
138
+ admin_pass must be contain at least 9 characters, least 1 number and both lower and uppercase letters, and specialcharacters.
137
139
 
138
140
  errors:
139
141
  default: |-
@@ -17,6 +17,7 @@ describe VagrantPlugins::ConoHa::Action::CreateServer do
17
17
  config.stub(:scheduler_hints) { nil }
18
18
  config.stub(:security_groups) { nil }
19
19
  config.stub(:user_data) { nil }
20
+ config.stub(:admin_pass) { "TestPassword1234*" }
20
21
  config.stub(:metadata) { nil }
21
22
  end
22
23
  end
@@ -131,6 +132,7 @@ describe VagrantPlugins::ConoHa::Action::CreateServer do
131
132
  scheduler_hints: 'test-sched-hints',
132
133
  security_groups: ['test-sec-groups'],
133
134
  user_data: 'test-user_data',
135
+ admin_pass: 'TestPassword1234*',
134
136
  metadata: 'test-metadata') do
135
137
  '1234'
136
138
  end
@@ -145,6 +147,7 @@ describe VagrantPlugins::ConoHa::Action::CreateServer do
145
147
  scheduler_hints: 'test-sched-hints',
146
148
  security_groups: ['test-sec-groups'],
147
149
  user_data: 'test-user_data',
150
+ admin_pass: 'TestPassword1234*',
148
151
  metadata: 'test-metadata'
149
152
  }
150
153
 
@@ -166,6 +169,7 @@ describe VagrantPlugins::ConoHa::Action::CreateServer do
166
169
  scheduler_hints: nil,
167
170
  security_groups: [],
168
171
  user_data: nil,
172
+ admin_pass: nil,
169
173
  metadata: nil) do
170
174
  '1234'
171
175
  end
@@ -180,6 +184,7 @@ describe VagrantPlugins::ConoHa::Action::CreateServer do
180
184
  scheduler_hints: nil,
181
185
  security_groups: [],
182
186
  user_data: nil,
187
+ admin_pass: nil,
183
188
  metadata: nil
184
189
  }
185
190
 
@@ -146,7 +146,7 @@ describe VagrantPlugins::ConoHa::NovaClient do
146
146
  it 'returns new instance id' do
147
147
  stub_request(:post, 'http://nova/a1b2c3/servers')
148
148
  .with(
149
- body: '{"server":{"name":"inst","imageRef":"img","flavorRef":"flav","key_name":"key",'\
149
+ body: '{"server":{"name":"inst","imageRef":"img","flavorRef":"flav","key_name":"key","adminPass":"AdminPass123%",'\
150
150
  '"security_groups":[{"name":"default"}],"user_data":"dXNlcl9kYXRhX3Rlc3Q=\n","metadata":"metadata_test"},'\
151
151
  '"os:scheduler_hints":"sched_hints_test"}',
152
152
  headers:
@@ -162,6 +162,7 @@ describe VagrantPlugins::ConoHa::NovaClient do
162
162
  name: 'inst',
163
163
  image_ref: 'img',
164
164
  flavor_ref: 'flav',
165
+ admin_pass: 'AdminPass123%',
165
166
  networks: nil,
166
167
  keypair: 'key',
167
168
  security_groups: [{ name: 'default' }],
@@ -7,8 +7,8 @@ Gem::Specification.new do |gem|
7
7
  gem.version = VagrantPlugins::ConoHa::VERSION
8
8
  gem.authors = ['Hironobu Saitoh']
9
9
  gem.email = ['hiro@hironobu.org']
10
- gem.description = 'Enables Vagrant to manage VPS in ConoHa. (forked from github.com/ggiamarchi/vagrant-openstack-provider)'
11
- gem.summary = 'Enables Vagrant to manage VPS in ConoHa. (forked from github.com/ggiamarchi/vagrant-openstack-provider)'
10
+ gem.description = 'Enables Vagrant to manage VPS in ConoHa.'
11
+ gem.summary = 'Enables Vagrant to manage VPS in ConoHa.'
12
12
  gem.homepage = 'https://github.com/hironobu-s/vagrant-conoha/'
13
13
  gem.license = 'MIT'
14
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-conoha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hironobu Saitoh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: 0.5.2
167
- description: Enables Vagrant to manage VPS in ConoHa. (forked from github.com/ggiamarchi/vagrant-openstack-provider)
167
+ description: Enables Vagrant to manage VPS in ConoHa.
168
168
  email:
169
169
  - hiro@hironobu.org
170
170
  executables: []
@@ -301,7 +301,7 @@ rubyforge_project:
301
301
  rubygems_version: 2.2.2
302
302
  signing_key:
303
303
  specification_version: 4
304
- summary: Enables Vagrant to manage VPS in ConoHa. (forked from github.com/ggiamarchi/vagrant-openstack-provider)
304
+ summary: Enables Vagrant to manage VPS in ConoHa.
305
305
  test_files:
306
306
  - spec/vagrant-conoha/action/connect_openstack_spec.rb
307
307
  - spec/vagrant-conoha/action/create_server_spec.rb