cloudstack-cli 1.2.7 → 1.3.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cloudstack-cli/commands/iso.rb +33 -10
- data/lib/cloudstack-cli/commands/volume.rb +17 -7
- data/lib/cloudstack-cli/option_resolver.rb +15 -8
- data/lib/cloudstack-cli/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25e8d7d5fa40b7654d1a450ba9cb59a8112118c3
|
4
|
+
data.tar.gz: c83a6b5bb3ec80bafda80854d4037c49ec244940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 914e12b7c7a6ddbfebecc60046faccd863a3baae6f1a6c9a9240a0af67289642c57e621fcb0860287700781d294268177ceca61b335d1fd5031f38b0f99cc85a
|
7
|
+
data.tar.gz: 2badf8ea2cd2ce5b1c7258e9733b870a45a261c89ebe37e3868dac90d93c9b2dd45a16e41d269c5f52bcee399e6f4a48efa4a4cef8c82e39e9c9c520daab226c
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class Iso < CloudstackCli::Base
|
2
2
|
|
3
|
-
desc 'list', "list
|
4
|
-
option :project
|
5
|
-
option :zone
|
6
|
-
option :account
|
7
|
-
option :type,
|
3
|
+
desc 'list', "list ISO's"
|
4
|
+
option :project, desc: 'project name'
|
5
|
+
option :zone, desc: 'zone name'
|
6
|
+
option :account, desc: 'account name'
|
7
|
+
option :type, desc: 'type of ISO',
|
8
8
|
enum: %w(featured self selfexecutable sharedexecutable executable community all)
|
9
9
|
def list
|
10
10
|
resolve_project
|
@@ -14,7 +14,7 @@ class Iso < CloudstackCli::Base
|
|
14
14
|
options.delete :type
|
15
15
|
isos = client.list_isos(options)
|
16
16
|
if isos.size < 1
|
17
|
-
puts "No
|
17
|
+
puts "No ISO's found."
|
18
18
|
else
|
19
19
|
table = [%w(Name Zone Bootable Public Featured)]
|
20
20
|
isos.each do |iso|
|
@@ -27,13 +27,36 @@ class Iso < CloudstackCli::Base
|
|
27
27
|
]
|
28
28
|
end
|
29
29
|
print_table(table)
|
30
|
-
say "Total number of
|
30
|
+
say "Total number of ISO's: #{isos.size}"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
desc '
|
35
|
-
|
36
|
-
|
34
|
+
desc 'attach', "attaches an ISO to a virtual machine"
|
35
|
+
option :iso, desc: 'ISO file name'
|
36
|
+
option :project, desc: 'project name'
|
37
|
+
option :virtual_machine, desc: 'virtual machine name'
|
38
|
+
option :virtual_machine_id, desc: 'virtual machine id (if no virtual machine name profided)'
|
39
|
+
def attach
|
40
|
+
resolve_iso
|
41
|
+
resolve_project
|
42
|
+
unless options[:virtual_machine_id]
|
43
|
+
resolve_virtual_machine
|
44
|
+
end
|
45
|
+
options[:id] = options[:iso_id]
|
46
|
+
client.attach_iso(options.merge(sync: false))
|
47
|
+
say " OK", :green
|
48
|
+
end
|
49
|
+
|
50
|
+
desc 'detach', "detaches any ISO file (if any) currently attached to a virtual machine"
|
51
|
+
option :project, desc: 'project name'
|
52
|
+
option :virtual_machine, desc: 'virtual machine name'
|
53
|
+
option :virtual_machine_id, desc: 'virtual machine id (if no virtual machine name profided)'
|
54
|
+
def detach
|
55
|
+
resolve_project
|
56
|
+
unless options[:virtual_machine_id]
|
57
|
+
resolve_virtual_machine
|
58
|
+
end
|
59
|
+
client.detach_iso(options.merge(sync: true))
|
37
60
|
say " OK", :green
|
38
61
|
end
|
39
62
|
|
@@ -82,15 +82,25 @@ class Volume < CloudstackCli::Base
|
|
82
82
|
end
|
83
83
|
|
84
84
|
say "Creating volume #{name} "
|
85
|
-
client.create_volume(options)
|
85
|
+
job = client.create_volume(options).merge(sync: true)
|
86
86
|
say " OK.", :green
|
87
|
-
|
88
|
-
|
87
|
+
|
88
|
+
# attach the new volume if a vm is profided and not a sapshot
|
89
|
+
if options[:virtual_machine] && options[:snapshot] == nil
|
90
|
+
sleep 2
|
91
|
+
say "Attach volume #{name} to VM #{options[:virtual_machine]} "
|
92
|
+
client.attach_volume(
|
93
|
+
id: job['volume']['id'],
|
94
|
+
virtualmachineid: options[:virtual_machine_id],
|
95
|
+
sync: true
|
96
|
+
)
|
97
|
+
say " OK.", :green
|
98
|
+
end
|
89
99
|
end
|
90
100
|
|
91
101
|
desc "attach NAME", "attach volume to VM"
|
92
102
|
option :project, desc: 'project of volume'
|
93
|
-
option :virtual_machine, desc: '
|
103
|
+
option :virtual_machine, desc: 'virtual machine of volume'
|
94
104
|
def attach(name)
|
95
105
|
resolve_project
|
96
106
|
resolve_virtual_machine
|
@@ -112,12 +122,12 @@ class Volume < CloudstackCli::Base
|
|
112
122
|
say "Attach volume #{name} to VM #{options[:virtual_machine]} "
|
113
123
|
client.attach_volume(
|
114
124
|
id: volume['id'],
|
115
|
-
|
125
|
+
virtualmachineid: options[:virtual_machine_id]
|
116
126
|
)
|
117
127
|
say " OK.", :green
|
118
128
|
end
|
119
129
|
|
120
|
-
desc "detach NAME", "
|
130
|
+
desc "detach NAME", "detach volume from VM"
|
121
131
|
option :project, desc: 'project of volume'
|
122
132
|
def detach(name)
|
123
133
|
resolve_project
|
@@ -141,7 +151,7 @@ class Volume < CloudstackCli::Base
|
|
141
151
|
say " OK.", :green
|
142
152
|
end
|
143
153
|
|
144
|
-
desc "delete NAME", "
|
154
|
+
desc "delete NAME", "delete volume to VM"
|
145
155
|
option :project, desc: 'project of volume'
|
146
156
|
def delete(name)
|
147
157
|
resolve_project
|
@@ -7,7 +7,7 @@ module CloudstackCli
|
|
7
7
|
resolve_compute_offering
|
8
8
|
resolve_template
|
9
9
|
resolve_disk_offering
|
10
|
-
|
10
|
+
resolve_iso_for_vm_deployment
|
11
11
|
options[:size] = options[:disk_size] if options[:disk_size]
|
12
12
|
unless options[:template_id]
|
13
13
|
say "Error: Template or ISO is required.", :red
|
@@ -109,20 +109,27 @@ module CloudstackCli
|
|
109
109
|
).first
|
110
110
|
break if iso
|
111
111
|
end
|
112
|
-
|
112
|
+
if iso
|
113
|
+
options[:iso_id] = iso["id"]
|
114
|
+
else
|
113
115
|
say "Error: Iso '#{options[:iso]}' is invalid.", :red
|
114
116
|
exit 1
|
115
117
|
end
|
116
|
-
unless options[:disk_offering_id]
|
117
|
-
say "Error: a disk offering is required when using iso.", :red
|
118
|
-
exit 1
|
119
|
-
end
|
120
|
-
options[:template_id] = iso['id']
|
121
|
-
options['hypervisor'] = (options[:hypervisor] || 'vmware')
|
122
118
|
end
|
123
119
|
options
|
124
120
|
end
|
125
121
|
|
122
|
+
def resolve_iso_for_vm_deployment
|
123
|
+
unless options[:disk_offering_id]
|
124
|
+
say "Error: a disk offering is required when using iso.", :red
|
125
|
+
exit 1
|
126
|
+
end
|
127
|
+
resolve_iso
|
128
|
+
options[:template_id] = options[:iso_id]
|
129
|
+
options['hypervisor'] = (options[:hypervisor] || 'vmware')
|
130
|
+
options
|
131
|
+
end
|
132
|
+
|
126
133
|
def resolve_template
|
127
134
|
if options[:template]
|
128
135
|
if template = client.list_templates(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nik Wolfgramm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.4.5
|
151
|
+
rubygems_version: 2.4.5
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: cloudstack-cli CloudStack API client
|