knife-cloudstack-fog 0.3.3 → 0.3.4

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.
@@ -1,78 +1,78 @@
1
- # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
- # Copyright:: Copyright (c) 2012 Datapipe
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
-
19
- require 'chef/knife/cloudstack_base'
20
-
21
- class Chef
22
- class Knife
23
- class CloudstackVolumeList < Knife
24
-
25
- include Knife::CloudstackBase
26
-
27
- banner "knife cloudstack volume list"
28
-
29
- def run
30
- $stdout.sync = true
31
-
32
- validate!
33
-
34
- volume_list = [
35
- ui.color('ID', :bold),
36
- ui.color('Name', :bold),
37
- ui.color('Size (in GB)', :bold),
38
- ui.color('Type', :bold),
39
- ui.color('Virtual Machine', :bold),
40
- ui.color('State', :bold)
41
- ]
42
-
43
- response = connection.list_volumes['listvolumesresponse']
44
-
45
- if volumes = response['volume']
46
- volumes.each do |volume|
47
- volume_list << volume['id'].to_s
48
- volume_list << volume['name'].to_s
49
- volume_size = volume['size']
50
- volume_size = (volume_size/1024/1024/1024)
51
- volume_list << volume_size.to_s
52
- volume_list << volume['type']
53
- if (volume['vmdisplayname'].nil?)
54
- volume_list << ' '
55
- else
56
- volume_list << volume['vmdisplayname']
57
- end
58
-
59
- volume_list << begin
60
- state = volume['state'].to_s.downcase
61
- case state
62
- when 'allocated'
63
- ui.color(state, :red)
64
- when 'pending'
65
- ui.color(state, :yellow)
66
- else
67
- ui.color(state, :green)
68
- end
69
- end
70
- end
71
- puts ui.list(volume_list, :uneven_columns_across, 6)
72
- end
73
-
74
- end
75
-
76
- end
77
- end
78
- end
1
+ # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
+ # Copyright:: Copyright (c) 2012 Datapipe
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+
19
+ require 'chef/knife/cloudstack_base'
20
+
21
+ class Chef
22
+ class Knife
23
+ class CloudstackVolumeList < Knife
24
+
25
+ include Knife::CloudstackBase
26
+
27
+ banner "knife cloudstack volume list"
28
+
29
+ def run
30
+ $stdout.sync = true
31
+
32
+ validate!
33
+
34
+ volume_list = [
35
+ ui.color('ID', :bold),
36
+ ui.color('Name', :bold),
37
+ ui.color('Size (in GB)', :bold),
38
+ ui.color('Type', :bold),
39
+ ui.color('Virtual Machine', :bold),
40
+ ui.color('State', :bold)
41
+ ]
42
+
43
+ response = connection.list_volumes['listvolumesresponse']
44
+
45
+ if volumes = response['volume']
46
+ volumes.each do |volume|
47
+ volume_list << volume['id'].to_s
48
+ volume_list << volume['name'].to_s
49
+ volume_size = volume['size']
50
+ volume_size = (volume_size/1024/1024/1024)
51
+ volume_list << volume_size.to_s
52
+ volume_list << volume['type']
53
+ if (volume['vmdisplayname'].nil?)
54
+ volume_list << ' '
55
+ else
56
+ volume_list << volume['vmdisplayname']
57
+ end
58
+
59
+ volume_list << begin
60
+ state = volume['state'].to_s.downcase
61
+ case state
62
+ when 'allocated'
63
+ ui.color(state, :red)
64
+ when 'pending'
65
+ ui.color(state, :yellow)
66
+ else
67
+ ui.color(state, :green)
68
+ end
69
+ end
70
+ end
71
+ puts ui.list(volume_list, :uneven_columns_across, 6)
72
+ end
73
+
74
+ end
75
+
76
+ end
77
+ end
78
+ end
@@ -1,63 +1,63 @@
1
- # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
- # Copyright:: Copyright (c) 2012 Datapipe
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
-
19
- require 'chef/knife/cloudstack_base'
20
-
21
- class Chef
22
- class Knife
23
- class CloudstackZoneList < Knife
24
-
25
- include Knife::CloudstackBase
26
-
27
- banner "knife cloudstack zone list"
28
-
29
- def run
30
- $stdout.sync = true
31
-
32
- validate!
33
-
34
- zone_list = [
35
- ui.color('ID', :bold),
36
- ui.color('Name', :bold),
37
- ui.color('Network Type', :bold),
38
- ui.color('Security Groups?', :bold)
39
- ]
40
- response = connection.list_zones['listzonesresponse']
41
- if zones = response['zone']
42
- zones.each do |zone|
43
- zone_list << zone['id'].to_s
44
- zone_list << zone['name'].to_s
45
- zone_list << zone['networktype'].to_s
46
- zone_list << begin
47
- state = zone['securitygroupsenabled'].to_s.downcase
48
- case state
49
- when 'false'
50
- ui.color('No', :red)
51
- else
52
- ui.color('Yes', :green)
53
- end
54
- end
55
- end
56
- end
57
- puts ui.list(zone_list, :columns_across, 4)
58
-
59
- end
60
-
61
- end
62
- end
63
- end
1
+ # Author:: Jeff Moody (<jmoody@datapipe.com>)
2
+ # Copyright:: Copyright (c) 2012 Datapipe
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+
19
+ require 'chef/knife/cloudstack_base'
20
+
21
+ class Chef
22
+ class Knife
23
+ class CloudstackZoneList < Knife
24
+
25
+ include Knife::CloudstackBase
26
+
27
+ banner "knife cloudstack zone list"
28
+
29
+ def run
30
+ $stdout.sync = true
31
+
32
+ validate!
33
+
34
+ zone_list = [
35
+ ui.color('ID', :bold),
36
+ ui.color('Name', :bold),
37
+ ui.color('Network Type', :bold),
38
+ ui.color('Security Groups?', :bold)
39
+ ]
40
+ response = connection.list_zones['listzonesresponse']
41
+ if zones = response['zone']
42
+ zones.each do |zone|
43
+ zone_list << zone['id'].to_s
44
+ zone_list << zone['name'].to_s
45
+ zone_list << zone['networktype'].to_s
46
+ zone_list << begin
47
+ state = zone['securitygroupsenabled'].to_s.downcase
48
+ case state
49
+ when 'false'
50
+ ui.color('No', :red)
51
+ else
52
+ ui.color('Yes', :green)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ puts ui.list(zone_list, :columns_across, 4)
58
+
59
+ end
60
+
61
+ end
62
+ end
63
+ end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Cloudstack
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
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.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-05-20 00:00:00.000000000 Z
16
+ date: 2013-07-18 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: fog