Skip to content

Commit 5edd384

Browse files
committed
v0.1.3 - vm_name_prefix option
1 parent b11599d commit 5edd384

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ platforms:
6464
### Configure Transport
6565
6666
In case you need to create both Linux and Windows machines, then different transport types have to be used(ssh for linux and winrm for windows).
67-
For easier maintenance and cleaner configuration you can create global kitchen configuration under $HOME/<username>/.kitchen/config.yml with following contents:
67+
For easier maintenance and cleaner configuration you can create global kitchen configuration under $HOME/[username]/.kitchen/config.yml with following contents:
6868
6969
```yaml
7070
<% WINRM_USERNAME = 'winrm_user' %>
@@ -79,7 +79,7 @@ transport:
7979
# example: winrm_transport
8080
```
8181

82-
Then in your kitchen.yml specify transport either for platform or suite
82+
Then in your cookbook specific kitchen.yml configure transport either for platform or suite
8383
```yaml
8484
suites:
8585
- name: windows-basic
@@ -136,6 +136,17 @@ suites:
136136
vm_name: 'my-vm-in-vmm'
137137
```
138138
139+
* #### vm_name_prefix
140+
141+
Prefix for VM name, all created VMs are going to have name prepended with the specified prefix.
142+
143+
```yaml
144+
driver_config:
145+
...
146+
vm_name_prefix: tst-
147+
```
148+
149+
139150
* #### vm_hardware_profile
140151
141152
Specify alternate HW profile that should be used instead of the one provided in your original template.

lib/kitchen/driver/vmm.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Vmm < Kitchen::Driver::Base
2020
default_config :vm_host_group_name
2121
default_config :vmm_server_address
2222
default_config :vm_name, nil
23+
default_config :vm_name_prefix, ''
2324
default_config :vm_hardware_profile, ''
2425
default_config :proxy_server_address, ''
2526
default_config :ad_server, ''
@@ -75,7 +76,7 @@ def create_virtual_machine
7576
vmm_server_address: config[:vmm_server_address],
7677
proxy_server_address: config[:proxy_server_address],
7778
vm_hardware_profile: config[:vm_hardware_profile],
78-
vm_name: config[:vm_name] || instance.name,
79+
vm_name: "#{config[:vm_name_prefix]}#{config[:vm_name] || instance.name}",
7980
vm_template_name: config[:vm_template_name],
8081
vm_host_group_name: config[:vm_host_group_name],
8182
ad_server: config[:ad_server],
@@ -85,6 +86,9 @@ def create_virtual_machine
8586

8687
#
8788
info("Creating and registering VM in the VMM (#{options[:vmm_server_address]})...")
89+
if options[:proxy_server_address]
90+
info("Using proxy: #{options[:proxy_server_address]}")
91+
end
8892
if options[:ad_server] && options[:ad_source_path] && options[:ad_target_path]
8993
info(" ..and moving it under #{options[:ad_target_path]} after it's created.")
9094
end

lib/kitchen/driver/vmm_version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Kitchen
44
module Driver
5-
VMM_VERSION = '0.1.2'
5+
VMM_VERSION = '0.1.3'
66
end
77
end

0 commit comments

Comments
 (0)