knife-cloudstack-fog 0.2.16 → 0.2.17

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.
@@ -34,6 +34,14 @@ class Chef
34
34
  :long => "--state STATE",
35
35
  :description => "Limit responses to servers only of a given state. Possible values are 'running,' 'stopped,' 'starting,' 'pending,' 'shutting-down,' 'terminated,' and 'stopping.' Default provides servers in all states.",
36
36
  :default => "all"
37
+ =begin
38
+ #Commented out as sorting of VM list is a work-in-progress
39
+ option :sort,
40
+ :short => "-o TRUE/FALSE",
41
+ :long => "--sort TRUE/FALSE",
42
+ :description => "Enable or disable sorting by Zone ID then VM ID. Defaults to sorted.",
43
+ :default => true
44
+ =end
37
45
 
38
46
  def print_servers(server_list,servers,options={})
39
47
  server = servers
@@ -45,6 +53,17 @@ class Chef
45
53
  server.reject!{|t| t['state'].downcase != state}
46
54
  end
47
55
 
56
+ =begin
57
+ #Commented out as sorting of VM list is a work-in-progress
58
+ # Sorting to group by zone ID first, then VM ID
59
+ if vmsort = options[:sort]
60
+ sort1 = server.sort_by { |hsh| hsh["zoneid"] }
61
+ sorted = sort1.sort_by { |hsh| hsh["id"] }
62
+ else
63
+ sorted = server
64
+ end
65
+ =end
66
+
48
67
  server.each do |instance|
49
68
  server_list << instance['name'].to_s
50
69
  server_list << instance['displayname'].to_s
@@ -98,7 +117,8 @@ class Chef
98
117
 
99
118
  zoneid = locate_config_value(:zoneid)
100
119
  state = locate_config_value(:state)
101
-
120
+ # vmsort = locate_config_value(:sort)
121
+
102
122
  response = connection.list_virtual_machines['listvirtualmachinesresponse']
103
123
  if virtual_machines = response['virtualmachine']
104
124
  filters = {}
@@ -68,7 +68,12 @@ class Chef
68
68
  temp.reject!{|t| t['hypervisor'] != hypervisor}
69
69
  end
70
70
 
71
- temp.each do |template|
71
+ # Sorting to group by zone ID first, then ID
72
+
73
+ sort1 = temp.sort_by { |hsh| hsh["id"] }
74
+ sorted = sort1.sort_by { |hsh| hsh["zoneid"] }
75
+
76
+ sorted.each do |template|
72
77
  template_list << template['id'].to_s
73
78
  template['hypervisor'] = ' ' if template['hypervisor'].nil?
74
79
  template_list << template['hypervisor']
@@ -78,6 +83,7 @@ class Chef
78
83
  template_list << template_size.to_s
79
84
 
80
85
  template_list << template['zonename']
86
+ template_list << template['zoneid'].to_s
81
87
  template_list << template['name']
82
88
  end
83
89
  end
@@ -89,7 +95,8 @@ class Chef
89
95
  ui.color('ID', :bold),
90
96
  ui.color('Hypervisor', :bold),
91
97
  ui.color('Size (in GB)', :bold),
92
- ui.color('Zone Location', :bold),
98
+ ui.color('Zone Name', :bold),
99
+ ui.color('Zone ID', :bold),
93
100
  ui.color('Name', :bold)
94
101
  ]
95
102
 
@@ -110,7 +117,7 @@ class Chef
110
117
 
111
118
  print_templates(template_list,templates,filters)
112
119
  end
113
- puts ui.list(template_list, :uneven_columns_across, 5)
120
+ puts ui.list(template_list, :uneven_columns_across, 6)
114
121
  end
115
122
 
116
123
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Cloudstack
3
- VERSION = "0.2.16"
3
+ VERSION = "0.2.17"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-cloudstack-fog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-10-22 00:00:00.000000000 Z
15
+ date: 2012-12-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: fog
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 1.6.0
24
+ version: 1.8.0
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 1.6.0
32
+ version: 1.8.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: chef
35
35
  requirement: !ruby/object:Gem::Requirement