knife-proxmox 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
data/README
CHANGED
@@ -11,6 +11,7 @@ Currently it only supports management of openVZ instances, but KVM instances wil
|
|
11
11
|
Actions implemented
|
12
12
|
|
13
13
|
proxmox server list
|
14
|
+
proxmox server info
|
14
15
|
proxmox server create
|
15
16
|
proxmox server start
|
16
17
|
proxmox server stop
|
@@ -23,11 +24,16 @@ Some Examples
|
|
23
24
|
List servers
|
24
25
|
$ knife proxmox server list
|
25
26
|
Id Node Name Type Status
|
26
|
-
104 node-1 tetatet.
|
27
|
-
470 node-2 sg-node1.
|
27
|
+
104 node-1 tetatet.example.com openvz down
|
28
|
+
470 node-2 sg-node1.example.com openvz up
|
28
29
|
102 node-1 test qemu down
|
29
30
|
202 node-2 chef-client1 openvz down
|
30
31
|
|
32
|
+
Get info for a server
|
33
|
+
$ knife proxmox server info -H tetatet.example.com -F ipaddress
|
34
|
+
|
35
|
+
|
36
|
+
|
31
37
|
List templates installed
|
32
38
|
$ knife proxmox template list -U https://localhost:8006/api2/json/ -n localhost -u test -p test123 -R pve -VV
|
33
39
|
DEBUG: Using configuration from /home/jorge/workspace/chef-repo/.chef/knife.rb
|
@@ -216,9 +216,15 @@ class Chef
|
|
216
216
|
node = vmid_to_node(vmid)
|
217
217
|
@connection["nodes/#{node}/openvz/#{vmid}/status/current"].get @auth_params do |response, request, result, &block|
|
218
218
|
#action_response("server get data",response)
|
219
|
-
data
|
219
|
+
# (field.match('all'))?JSON.parse(response.body)['data'].to_json : JSON.parse(response.body)['data'][field]
|
220
|
+
if (field == 'all') then
|
221
|
+
JSON.parse(response.body)['data']
|
222
|
+
else
|
223
|
+
JSON.parse(response.body)['data'][field]
|
224
|
+
end
|
220
225
|
end
|
221
226
|
end
|
227
|
+
|
222
228
|
# server_destroy: Destroys the server
|
223
229
|
def server_destroy(vmid)
|
224
230
|
node = vmid_to_node(vmid)
|
@@ -156,7 +156,7 @@ class Chef
|
|
156
156
|
|
157
157
|
# which IP address to bootstrap
|
158
158
|
bootstrap_ip_address = server_get_data(vm_id,'ip')
|
159
|
-
ui.msg("New Server #{vm_id} has IP Address: #{
|
159
|
+
ui.msg("New Server #{vm_id} has IP Address: #{bootstrap_ip_address}")
|
160
160
|
|
161
161
|
if bootstrap_ip_address.nil?
|
162
162
|
ui.error("No IP address available for bootstrapping.")
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'chef/knife/proxmox_base'
|
2
|
+
|
3
|
+
|
4
|
+
class Chef
|
5
|
+
class Knife
|
6
|
+
class ProxmoxServerInfo < Knife
|
7
|
+
|
8
|
+
include Knife::ProxmoxBase
|
9
|
+
|
10
|
+
banner "knife proxmox server info (options)"
|
11
|
+
|
12
|
+
option :chef_node_name,
|
13
|
+
:short => "-H hostname",
|
14
|
+
:long => "--hostname hostname",
|
15
|
+
:description => "The name of the node and client to delete, if it differs from the server name. Only has meaning when used with the '--purge' option."
|
16
|
+
|
17
|
+
option :vm_id,
|
18
|
+
:short => "-I number",
|
19
|
+
:long => "--vmid number",
|
20
|
+
:description => "The numeric identifier of the VM"
|
21
|
+
|
22
|
+
option :parameter,
|
23
|
+
:short => "-P parameter",
|
24
|
+
:long => "--parameter name",
|
25
|
+
:description => "The field you are requesting (\"all\" for all data)"
|
26
|
+
|
27
|
+
|
28
|
+
def run
|
29
|
+
# Needed
|
30
|
+
connection
|
31
|
+
|
32
|
+
vm_id = nil
|
33
|
+
name = nil
|
34
|
+
if (config[:vm_id].nil? and config[:chef_node_name].nil?) then
|
35
|
+
ui.error("You must use -I <id> or -H <Hostname>")
|
36
|
+
exit 1
|
37
|
+
elsif (!config[:chef_node_name].nil?)
|
38
|
+
name = config[:chef_node_name]
|
39
|
+
vm_id = server_name_to_vmid(name)
|
40
|
+
else
|
41
|
+
vm_id = config[:vm_id]
|
42
|
+
end
|
43
|
+
|
44
|
+
parameter = config[:parameter] || 'all'
|
45
|
+
|
46
|
+
data = server_get_data(vm_id,parameter)
|
47
|
+
ui.output(data)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-proxmox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: chef
|
@@ -72,6 +72,7 @@ extra_rdoc_files:
|
|
72
72
|
- TODO
|
73
73
|
- CHANGELOG
|
74
74
|
files:
|
75
|
+
- lib/chef/knife/proxmox_server_info.rb
|
75
76
|
- lib/chef/knife/proxmox_server_destroy.rb
|
76
77
|
- lib/chef/knife/server.rb
|
77
78
|
- lib/chef/knife/proxmox_server_stop.rb
|