vagrant-libvirt 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dfc179b111aedecd88900df94faec1f9d949c88
4
- data.tar.gz: e829ca23a1935b411bbdeddc78b57229c13c6014
3
+ metadata.gz: 83974c73aa002ac05b8add5ba4b4e3adff53c729
4
+ data.tar.gz: 00d6184e958b478752de82b38150b98d5328eafd
5
5
  SHA512:
6
- metadata.gz: ad2d3f5717e17e96b422d485a08bc1ffc99d8dd53ccd4f82f9a2fea88de56b939773ac033b9f031ebc2e141dd3aa80ff6dbadf2212f9dbeaff04d006ca7092a8
7
- data.tar.gz: 4c27f90f010454367c90b8eb94d621ce20d300ea4c289ae42285982dfb694e50640cfe5b96789e898471938df0f18c8905ace44584bf7b08abf95073149fd94b
6
+ metadata.gz: 846e3a40da1e4223aaada5eed447656c339127da0b81a47a27009b338c7f9a3bde75108ea8ed2070b71c06b03ce0ca9779e6f592bd12c81da1456bc2d2e34430
7
+ data.tar.gz: 6f38f979224bbeed6f37fee8ffc54c6f8f2fc7d4c51a3bbd9cd2b1b416bda942d3b02f53eb776378b12621e37da566433c0751b5638769456dbf823e8a552faf
data/README.md CHANGED
@@ -148,6 +148,7 @@ end
148
148
  * `volume_cache` - Controls the cache mechanism. Possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
149
149
  * `kernel` - To launch the guest with a kernel residing on host filesystems. Equivalent to qemu `-kernel`.
150
150
  * `initrd` - To specify the initramfs/initrd to use for the guest. Equivalent to qemu `-initrd`.
151
+ * `random_hostname` - To create a domain name with extra information on the end to prevent hostname conflicts.
151
152
  * `cmd_line` - Arguments passed on to the guest kernel initramfs or initrd to use. Equivalent to qemu `-append`.
152
153
 
153
154
 
@@ -81,6 +81,7 @@ module VagrantPlugins
81
81
  message = "Creating network interface eth#{@iface_number}"
82
82
  message << " connected to network #{@network_name}."
83
83
  if @mac
84
+ @mac = @mac.scan(/(\h{2})/).join(':')
84
85
  message << " Using MAC address: #{@mac}"
85
86
  end
86
87
  @logger.info(message)
@@ -105,6 +106,7 @@ module VagrantPlugins
105
106
  # It's used for provisioning and it has to be available during provisioning,
106
107
  # ifdown command is not acceptable here.
107
108
  next if slot_number == 0
109
+ next if options[:auto_config] === false
108
110
  @logger.debug "Configuring interface slot_number #{slot_number} options #{options}"
109
111
 
110
112
  network = {
@@ -97,6 +97,8 @@ module VagrantPlugins
97
97
  "IdentityFile=#{pk}"
98
98
  end).map { |s| s.prepend('-o ') }.join(' ')
99
99
 
100
+ options += " -o ProxyCommand=\"#{ssh_info[:proxy_command]}\"" if machine.provider_config.connect_via_ssh
101
+
100
102
  # TODO: instead of this, try and lock and get the stdin from spawn...
101
103
  ssh_cmd = ''
102
104
  if host_port <= 1024
@@ -35,13 +35,13 @@ module VagrantPlugins
35
35
  end
36
36
 
37
37
  # build domain name
38
- # avoids `domain about to create is already taken`
38
+ # random_hostname option avoids
39
+ # `domain about to create is already taken`
39
40
  # parsable and sortable by epoch time
40
41
  # @example
41
42
  # development-centos-6-chef-11_1404488971_3b7a569e2fd7c554b852
42
43
  # @return [String] libvirt domain name
43
44
  def build_domain_name(env)
44
- postfix = "#{Time.now.utc.to_i}_#{SecureRandom.hex(10)}"
45
45
  config = env[:machine].provider_config
46
46
  domain_name =
47
47
  if config.default_prefix.nil?
@@ -49,8 +49,11 @@ module VagrantPlugins
49
49
  else
50
50
  config.default_prefix.to_s
51
51
  end
52
+ domain_name << '_'
53
+ domain_name << env[:machine].name.to_s
52
54
  domain_name.gsub!(/[^-a-z0-9_]/i, '')
53
- domain_name << "_#{postfix}"
55
+ domain_name << "_#{Time.now.utc.to_i}_#{SecureRandom.hex(10)}" if config.random_hostname
56
+ domain_name
54
57
  end
55
58
 
56
59
  end
@@ -58,4 +61,3 @@ module VagrantPlugins
58
61
  end
59
62
  end
60
63
  end
61
-
@@ -40,6 +40,9 @@ module VagrantPlugins
40
40
  # be stored.
41
41
  attr_accessor :storage_pool_name
42
42
 
43
+ # Turn on to prevent hostname conflicts
44
+ attr_accessor :random_hostname
45
+
43
46
  # Libvirt default network
44
47
  attr_accessor :management_network_name
45
48
  attr_accessor :management_network_address
@@ -70,6 +73,7 @@ module VagrantPlugins
70
73
  @password = UNSET_VALUE
71
74
  @id_ssh_key_file = UNSET_VALUE
72
75
  @storage_pool_name = UNSET_VALUE
76
+ @random_hostname = UNSET_VALUE
73
77
  @management_network_name = UNSET_VALUE
74
78
  @management_network_address = UNSET_VALUE
75
79
 
@@ -182,6 +186,7 @@ module VagrantPlugins
182
186
  @password = nil if @password == UNSET_VALUE
183
187
  @id_ssh_key_file = 'id_rsa' if @id_ssh_key_file == UNSET_VALUE
184
188
  @storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE
189
+ @random_hostname = false if @random_hostname == UNSET_VALUE
185
190
  @management_network_name = 'vagrant-libvirt' if @management_network_name == UNSET_VALUE
186
191
  @management_network_address = '192.168.121.0/24' if @management_network_address == UNSET_VALUE
187
192
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ProviderLibvirt
3
- VERSION = '0.0.19'
3
+ VERSION = '0.0.20'
4
4
  end
5
5
  end
@@ -130,6 +130,8 @@ en:
130
130
  pause
131
131
  short_shutoff: |-
132
132
  shutoff
133
+ long_shutoff: |-
134
+ The Libvirt domain is not running. Run `vagrant up` to start it.
133
135
  short_not_created: |-
134
136
  not created
135
137
  long_not_created: |-
@@ -3,7 +3,9 @@ require "pathname"
3
3
 
4
4
  class EnvironmentHelper
5
5
 
6
- attr_writer :default_prefix, :domain_name
6
+ attr_writer :domain_name
7
+
8
+ attr_accessor :random_hostname, :name, :default_prefix
7
9
 
8
10
  def [](value)
9
11
  self.send(value.to_sym)
@@ -17,10 +19,6 @@ class EnvironmentHelper
17
19
  self
18
20
  end
19
21
 
20
- def default_prefix
21
- # noop
22
- end
23
-
24
22
  def root_path
25
23
  Pathname.new("./spec/support/foo")
26
24
  end
@@ -5,10 +5,17 @@ describe VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain do
5
5
  @env = EnvironmentHelper.new
6
6
  end
7
7
 
8
- it "builds uniqie domain name" do
8
+ it "builds unique domain name" do
9
+ @env.random_hostname = true
9
10
  dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env)
10
11
  first = dmn.build_domain_name(@env)
11
12
  second = dmn.build_domain_name(@env)
12
13
  first.should_not eq(second)
13
14
  end
15
+
16
+ it "builds simple domain name" do
17
+ @env.default_prefix= 'pre'
18
+ dmn = VagrantPlugins::ProviderLibvirt::Action::SetNameOfDomain.new(Object.new, @env)
19
+ dmn.build_domain_name(@env).should eq('pre_')
20
+ end
14
21
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
 
23
23
  gem.add_runtime_dependency 'fog', '~> 1.15'
24
24
  gem.add_runtime_dependency 'ruby-libvirt', '~> 0.4.0'
25
- gem.add_runtime_dependency 'nokogiri', '~> 1.5.9'
25
+ gem.add_runtime_dependency 'nokogiri', '~> 1.6'
26
26
 
27
27
  gem.add_development_dependency 'rake'
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-libvirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Stanek
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-06 00:00:00.000000000 Z
13
+ date: 2014-09-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec-core
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: 1.5.9
91
+ version: '1.6'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: 1.5.9
98
+ version: '1.6'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rake
101
101
  requirement: !ruby/object:Gem::Requirement