knife-xenserver 1.2 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -0
- data/README.md +2 -1
- data/lib/chef/knife/xenserver_vm_create.rb +2 -2
- data/lib/chef/knife/xenserver_vm_delete.rb +25 -7
- data/lib/knife-xenserver/version.rb +1 -1
- metadata +14 -14
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# 1.2.1 - Mon 12 Nov 2012
|
2
|
+
|
3
|
+
* Maks3w patches for xenserver-automated related stuff
|
4
|
+
|
5
|
+
* Added --match flag to the 'vm delete' command.
|
6
|
+
|
7
|
+
If --match is used, every VM matching VM_NAME will be deleted
|
8
|
+
|
9
|
+
* Deprecate --force-delete option in 'vm delete' since --yes should
|
10
|
+
be used to confirm (force).
|
11
|
+
|
1
12
|
# 1.2 - Thu 25 Oct 2012
|
2
13
|
|
3
14
|
* Greatly improved 'vm list' command
|
data/README.md
CHANGED
@@ -61,7 +61,8 @@ Create a VM from template and add two custom VIFs in networks 'Integration-VLAN'
|
|
61
61
|
--vm-networks 'Integration-VLAN,Another-VLAN' \
|
62
62
|
--mac-addresses 11:22:33:44:55:66
|
63
63
|
|
64
|
-
Create a VM from template and supply ip/host/domain configuration. Requires installation of xe-automater scripts
|
64
|
+
Create a VM from template and supply ip/host/domain configuration. Requires installation of xe-automater scripts
|
65
|
+
(https://github.com/krobertson/xenserver-automater)
|
65
66
|
|
66
67
|
knife xenserver vm create --vm-template my-template -x root --keep-template-networks \
|
67
68
|
--vm-name my-hostname \
|
@@ -236,8 +236,8 @@ class Chef
|
|
236
236
|
attrs = {}
|
237
237
|
(attrs['vm-data/ip'] = config[:vm_ip]) if config[:vm_ip]
|
238
238
|
(attrs['vm-data/gw'] = config[:vm_gateway]) if config[:vm_gateway]
|
239
|
-
(attrs['vm-data/
|
240
|
-
(attrs['vm-data/
|
239
|
+
(attrs['vm-data/nm'] = config[:vm_netmask]) if config[:vm_netmask]
|
240
|
+
(attrs['vm-data/ns'] = config[:vm_dns]) if config[:vm_dns]
|
241
241
|
(attrs['vm-data/dm'] = config[:vm_domain]) if config[:vm_domain]
|
242
242
|
if !attrs.empty?
|
243
243
|
puts "Adding attributes to xenstore..."
|
@@ -30,23 +30,41 @@ class Chef
|
|
30
30
|
:long => "--force-delete NO",
|
31
31
|
:default => 'no',
|
32
32
|
:description => "Do not confirm VM deletion when yes"
|
33
|
+
|
34
|
+
option :match,
|
35
|
+
:long => "--match",
|
36
|
+
:description => "Delete VMs matching VM_NAME (regex)",
|
37
|
+
:boolean => true
|
33
38
|
|
34
39
|
def run
|
40
|
+
if config[:force_delete] =~ /y|yes/i
|
41
|
+
ui.warn "--force-delete is deprecated."
|
42
|
+
ui.warn "Use --yes to confirm deletion."
|
43
|
+
config[:yes] = true
|
44
|
+
end
|
35
45
|
deleted = []
|
36
46
|
connection.servers.each do |vm|
|
47
|
+
to_delete = []
|
37
48
|
@name_args.each do |vm_name|
|
38
|
-
if
|
39
|
-
if
|
40
|
-
|
49
|
+
if config[:match]
|
50
|
+
if vm.name =~ /#{vm_name}/
|
51
|
+
to_delete << vm
|
52
|
+
end
|
53
|
+
else
|
54
|
+
if (vm_name == vm.name) or (vm_name == vm.uuid)
|
55
|
+
to_delete << vm
|
41
56
|
end
|
42
|
-
vm.destroy
|
43
|
-
deleted << vm_name
|
44
|
-
ui.info("#{'Deleted'.yellow} virtual machine #{vm.name.yellow} [uuid: #{vm.uuid}]")
|
45
57
|
end
|
46
58
|
end
|
59
|
+
to_delete.each do |vm|
|
60
|
+
confirm("Do you really want to #{'delete'.bold.red} this virtual machine #{vm.name.bold.red}")
|
61
|
+
vm.destroy
|
62
|
+
deleted << vm.name
|
63
|
+
ui.info("#{'Deleted'.yellow} virtual machine #{vm.name.yellow} [uuid: #{vm.uuid}]")
|
64
|
+
end
|
47
65
|
end
|
48
66
|
@name_args.each do |vm_name|
|
49
|
-
ui.warn "Virtual Machine #{vm_name} not found" if
|
67
|
+
ui.warn "Virtual Machine#{'(s) matching' if config[:match]} '#{vm_name}' not found" if deleted.size == 0
|
50
68
|
end
|
51
69
|
end
|
52
70
|
|
metadata
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-xenserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.2'
|
5
4
|
prerelease:
|
5
|
+
version: 1.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sergio Rubio
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
15
|
+
type: :runtime
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
@@ -27,15 +26,15 @@ dependencies:
|
|
27
26
|
- - ! '>='
|
28
27
|
- !ruby/object:Gem::Version
|
29
28
|
version: '0'
|
29
|
+
name: terminal-table
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
|
31
|
+
type: :runtime
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0.10'
|
38
|
-
type: :runtime
|
39
38
|
prerelease: false
|
40
39
|
version_requirements: !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
@@ -43,15 +42,15 @@ dependencies:
|
|
43
42
|
- - ! '>='
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0.10'
|
45
|
+
name: chef
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
47
|
+
type: :runtime
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '1.4'
|
54
|
-
type: :runtime
|
55
54
|
prerelease: false
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
57
56
|
none: false
|
@@ -59,15 +58,15 @@ dependencies:
|
|
59
58
|
- - ! '>='
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '1.4'
|
61
|
+
name: fog
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
63
|
+
type: :runtime
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
-
type: :runtime
|
71
70
|
prerelease: false
|
72
71
|
version_requirements: !ruby/object:Gem::Requirement
|
73
72
|
none: false
|
@@ -75,15 +74,15 @@ dependencies:
|
|
75
74
|
- - ! '>='
|
76
75
|
- !ruby/object:Gem::Version
|
77
76
|
version: '0'
|
77
|
+
name: colored
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
|
79
|
+
type: :runtime
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
83
|
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
|
-
type: :runtime
|
87
86
|
prerelease: false
|
88
87
|
version_requirements: !ruby/object:Gem::Requirement
|
89
88
|
none: false
|
@@ -91,15 +90,15 @@ dependencies:
|
|
91
90
|
- - ! '>='
|
92
91
|
- !ruby/object:Gem::Version
|
93
92
|
version: '0'
|
93
|
+
name: alchemist
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
|
95
|
+
type: :runtime
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
99
|
- - ! '>='
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
|
-
type: :runtime
|
103
102
|
prerelease: false
|
104
103
|
version_requirements: !ruby/object:Gem::Requirement
|
105
104
|
none: false
|
@@ -107,6 +106,7 @@ dependencies:
|
|
107
106
|
- - ! '>='
|
108
107
|
- !ruby/object:Gem::Version
|
109
108
|
version: '0'
|
109
|
+
name: uuidtools
|
110
110
|
description: XenServer Support for Chef's Knife Command
|
111
111
|
email:
|
112
112
|
- rubiojr@frameos.org
|