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.
- data/lib/chef/knife/cloudstack_base.rb +101 -101
- data/lib/chef/knife/cloudstack_diskoffering_list.rb +57 -57
- data/lib/chef/knife/cloudstack_keypair_create.rb +102 -102
- data/lib/chef/knife/cloudstack_keypair_delete.rb +49 -49
- data/lib/chef/knife/cloudstack_keypair_list.rb +53 -53
- data/lib/chef/knife/cloudstack_network_create.rb +147 -147
- data/lib/chef/knife/cloudstack_network_delete.rb +53 -53
- data/lib/chef/knife/cloudstack_network_list.rb +67 -67
- data/lib/chef/knife/cloudstack_networkoffering_list.rb +74 -74
- data/lib/chef/knife/cloudstack_publicip_create.rb +90 -90
- data/lib/chef/knife/cloudstack_publicip_list.rb +57 -57
- data/lib/chef/knife/cloudstack_securitygroup_list.rb +124 -124
- data/lib/chef/knife/cloudstack_server_create.rb +320 -320
- data/lib/chef/knife/cloudstack_server_delete.rb +53 -53
- data/lib/chef/knife/cloudstack_server_destroy.rb +53 -53
- data/lib/chef/knife/cloudstack_server_list.rb +135 -135
- data/lib/chef/knife/cloudstack_server_start.rb +69 -69
- data/lib/chef/knife/cloudstack_server_stop.rb +72 -72
- data/lib/chef/knife/cloudstack_serviceoffering_list.rb +61 -61
- data/lib/chef/knife/cloudstack_template_list.rb +127 -127
- data/lib/chef/knife/cloudstack_volumes_list.rb +78 -78
- data/lib/chef/knife/cloudstack_zone_list.rb +63 -63
- data/lib/knife-cloudstack-fog/version.rb +1 -1
- metadata +2 -2
@@ -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
|
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.
|
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-
|
16
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: fog
|