vagrant-ignition 0.0.1 → 0.0.2

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: 10c88275ae9269f72da07adabe390677180369a1
4
- data.tar.gz: 7dbe996b07a257d0f8f259eac6e07b1d959c3745
3
+ metadata.gz: ada054d0fa837f17a1ef4cdb4483c5f32e2eed30
4
+ data.tar.gz: 603e4595442910affa34e69ab00a7e4b38583f5b
5
5
  SHA512:
6
- metadata.gz: f53342fa9776f2a01cd07b9bc1fad15e96228caea0ec7d26f40476640f823f2249c3b38017d299da792af84926d2a02a06474c542a47b96fe97768036929d37f
7
- data.tar.gz: '07932f791029ba6e6ea9aa94bb37daca62a1a83d552c89ebbe8eae906a163522e9fde167ad3430454c5b510dee7d025387626f98e45263677baf5e080a5c4512'
6
+ metadata.gz: eee4b8d6b1d977e89bccf30f08d062552bcd41a72c984170bfb7f16b8048ff37bbda2e8b93cef51a1d540fa83ddab38db1869c4ba68aeb677ce27e45e82822c6
7
+ data.tar.gz: 38052f2dec20f6b6dec03c470053a485fe68354912b3f51db879c1813ca19d06cf85f628d4296ba57d1854e548e253aa2a52e5dcb9f4ed291c1cb495ef1c2b7b
data/README.md CHANGED
@@ -9,7 +9,7 @@ Build the app using:
9
9
 
10
10
  And install it with:
11
11
 
12
- $ vagrant plugin install vagrant-ignition-0.0.1.gem
12
+ $ vagrant plugin install vagrant-ignition-0.0.2.gem
13
13
 
14
14
  ## Usage
15
15
  To use this plugin, a couple of config options must be set in a project's Vagrantfile config section.
@@ -22,9 +22,9 @@ Options:
22
22
 
23
23
  `config.ignition.config_obj`: Set equal to `config.vm.provider :virtualbox`
24
24
 
25
- `config.ignition.config_img`: Set to desired location of generated image (optional)
25
+ `config.ignition.drive_root`: Set to desired root directory of generated config drive (optional)
26
26
 
27
- `config.ignition.config_vmdk`: Set to desired location of generated vmdk (optional)
27
+ `config.ignition.drive_name`: Set to desired filename of generated config drive (optional)
28
28
 
29
29
  `config.ignition.hostname`: Set to desired hostname of the machine (optional)
30
30
 
@@ -59,7 +59,7 @@ def merge_ignition(ignition_path, hostname, ip, env)
59
59
  config[:passwd][:users] += [ssh_entry()]
60
60
  end
61
61
 
62
- File.open(ignition_path + ".merged","w") do |f|
62
+ File.open(ignition_path + ".merged","wb") do |f|
63
63
  f.write(config.to_json)
64
64
  end
65
65
  end
@@ -17,16 +17,16 @@ module VagrantPlugins
17
17
  end
18
18
 
19
19
  config_path = env[:machine].config.ignition.path
20
- config_vmdk = env[:machine].config.ignition.config_vmdk
21
- config_img = env[:machine].config.ignition.config_img
20
+ drive_name = env[:machine].config.ignition.drive_name
21
+ drive_root = env[:machine].config.ignition.drive_root
22
22
 
23
23
  hostname = env[:machine].config.ignition.hostname
24
24
  ip = env[:machine].config.ignition.ip
25
25
 
26
- vmdk_gen(config_path, config_vmdk, config_img, hostname, ip, env)
26
+ vmdk_gen(config_path, drive_name, drive_root, hostname, ip, env)
27
27
 
28
28
  env[:machine].ui.info "Configuring Ignition Config Drive"
29
- env[:machine].provider.driver.execute("storageattach", "#{env[:machine].id}", "--storagectl", "IDE Controller", "--device", "0", "--port", "1", "--type", "hdd", "--medium", "#{config_vmdk}")
29
+ env[:machine].provider.driver.execute("storageattach", "#{env[:machine].id}", "--storagectl", "IDE Controller", "--device", "0", "--port", "1", "--type", "hdd", "--medium", "#{File.join(drive_root, (drive_name + ".vmdk"))}")
30
30
 
31
31
  # Continue through the middleware chain
32
32
  @app.call(env)
@@ -2,7 +2,14 @@
2
2
  require_relative 'merge_ignition'
3
3
  require_relative 'IgnitionDiskGenerator'
4
4
 
5
- def vmdk_gen(ignition_path, vmdk_name, config_drive, hostname, ip, env)
5
+ def vmdk_gen(ignition_path, drive_name, drive_root, hostname, ip, env)
6
+ # This ensures changes the directory to the drive_root so the img and
7
+ # vmdk can be generated in the same directory as well as avoid some
8
+ # path name bugs
9
+ orig_dir = Dir.pwd
10
+ Dir.chdir(drive_root)
11
+ vmdk_name = drive_name + ".vmdk"
12
+ config_drive = drive_name + ".img"
6
13
  merge_ignition(ignition_path, hostname, ip, env)
7
14
  if !ignition_path.nil?
8
15
  IgnitionDiskGenerator.create_disk(ignition_path + ".merged", config_drive)
@@ -14,4 +21,5 @@ def vmdk_gen(ignition_path, vmdk_name, config_drive, hostname, ip, env)
14
21
  File.delete(vmdk_name)
15
22
  end
16
23
  env[:machine].provider.driver.execute("internalcommands", "createrawvmdk", "-filename", "#{vmdk_name}", "-rawdisk", "#{config_drive}")
24
+ Dir.chdir(orig_dir)
17
25
  end
@@ -4,8 +4,8 @@ module VagrantPlugins
4
4
  attr_accessor :enabled
5
5
  attr_accessor :path
6
6
  attr_accessor :config_obj
7
- attr_accessor :config_img
8
- attr_accessor :config_vmdk
7
+ attr_accessor :drive_name
8
+ attr_accessor :drive_root
9
9
  attr_accessor :hostname
10
10
  attr_accessor :ip
11
11
 
@@ -13,8 +13,8 @@ module VagrantPlugins
13
13
  @enabled = UNSET_VALUE
14
14
  @path = UNSET_VALUE
15
15
  @config_obj = UNSET_VALUE
16
- @config_img = UNSET_VALUE
17
- @config_vmdk = UNSET_VALUE
16
+ @drive_name = UNSET_VALUE
17
+ @drive_root = UNSET_VALUE
18
18
  @hostname = UNSET_VALUE
19
19
  @ip = UNSET_VALUE
20
20
  end
@@ -22,8 +22,8 @@ module VagrantPlugins
22
22
  def finalize!
23
23
  @enabled = false if @enabled == UNSET_VALUE
24
24
  @path = nil if @path == UNSET_VALUE
25
- @config_img = "config.img" if @config_img == UNSET_VALUE
26
- @config_vmdk = "config.vmdk" if @config_vmdk == UNSET_VALUE
25
+ @drive_name = "config" if @drive_name == UNSET_VALUE
26
+ @drive_root = "./" if @drive_path == UNSET_VALUE
27
27
  @hostname = nil if @hostname == UNSET_VALUE
28
28
  @ip = nil if @ip == UNSET_VALUE
29
29
  end
@@ -5,7 +5,7 @@ require "vagrant-ignition/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "vagrant-ignition"
8
- spec.version = "0.0.1"
8
+ spec.version = "0.0.2"
9
9
  spec.authors = ["Alexander Pavel", "Alex Crawford"]
10
10
  spec.email = ["alex.pavel@coreos.com", "alex.crawford@coreos.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-ignition
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Pavel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-07-06 00:00:00.000000000 Z
12
+ date: 2017-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.5.2
89
+ rubygems_version: 2.6.11
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: '"A Vagrant plugin for VirtualBox based machines that creates and mounts