cloudstack-cli 1.4.2 → 1.5.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 +2 -2
- data/cloudstack-cli.gemspec +1 -1
- data/completions/{cs.bash → cloudstack-cli.bash} +0 -0
- data/lib/cloudstack-cli/cli.rb +1 -1
- data/lib/cloudstack-cli/commands/ssh_key_pair.rb +36 -11
- data/lib/cloudstack-cli/version.rb +1 -1
- metadata +4 -6
- data/bin/cs +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9333cd14a9e146a183cc06b9c08cdec221ab090c
|
4
|
+
data.tar.gz: ff4ad2339fe3ad8f8a05bf105e0a5b63ee875404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b71a5b0fc8600a26c0c1e52ddbdc8e93dd941227e837f8e3edabefed51a6fb52270449c7babe5e01a67dbff570908b4af9cda2eea2d43770b7d40a21743d366e
|
7
|
+
data.tar.gz: 840fe9f4f5fbfeb03030b73432ec632f8a81b0fd9f34b5a95ad5db25642c9b13b54cd401612445310e68649f9947bed91127487ecf493772263af8fa3e4a9c0b
|
data/Gemfile.lock
CHANGED
@@ -6,14 +6,14 @@ PATH
|
|
6
6
|
PATH
|
7
7
|
remote: .
|
8
8
|
specs:
|
9
|
-
cloudstack-cli (1.
|
9
|
+
cloudstack-cli (1.5.0)
|
10
10
|
cloudstack_client (~> 1.3)
|
11
11
|
thor (~> 0.19)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
rake (11.1.
|
16
|
+
rake (11.1.2)
|
17
17
|
thor (0.19.1)
|
18
18
|
|
19
19
|
PLATFORMS
|
data/cloudstack-cli.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
|
17
17
|
gem.required_ruby_version = '>= 1.9.3'
|
18
18
|
gem.files = `git ls-files`.split($/)
|
19
|
-
gem.executables = %w(
|
19
|
+
gem.executables = %w(cloudstack-cli)
|
20
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
21
|
gem.require_paths = %w(lib)
|
22
22
|
gem.rdoc_options = %w[--line-numbers --inline-source]
|
File without changes
|
data/lib/cloudstack-cli/cli.rb
CHANGED
@@ -35,7 +35,7 @@ module CloudstackCli
|
|
35
35
|
def completion
|
36
36
|
shell_script = File.join(
|
37
37
|
File.dirname(__FILE__), '..', '..',
|
38
|
-
'completions', "
|
38
|
+
'completions', "cloudstack-cli.#{options[:shell]}"
|
39
39
|
)
|
40
40
|
unless File.file? shell_script
|
41
41
|
say "Specified cloudstack-cli shell auto-completion rules for #{options[:shell]} not found.", :red
|
@@ -2,8 +2,8 @@ class SshKeyPair < CloudstackCli::Base
|
|
2
2
|
|
3
3
|
desc "list", 'list ssh key pairs'
|
4
4
|
option :listall, default: true
|
5
|
-
option :account
|
6
|
-
option :project
|
5
|
+
option :account, desc: "name of the account"
|
6
|
+
option :project, desc: "name of the project"
|
7
7
|
option :format, default: "table",
|
8
8
|
enum: %w(table json yaml)
|
9
9
|
def list
|
@@ -29,8 +29,8 @@ class SshKeyPair < CloudstackCli::Base
|
|
29
29
|
end
|
30
30
|
|
31
31
|
desc 'create NAME', 'create ssh key pair'
|
32
|
-
option :account
|
33
|
-
option :project
|
32
|
+
option :account, desc: "name of the account"
|
33
|
+
option :project, desc: "name of the project"
|
34
34
|
def create(name)
|
35
35
|
resolve_account
|
36
36
|
resolve_project
|
@@ -43,15 +43,16 @@ class SshKeyPair < CloudstackCli::Base
|
|
43
43
|
end
|
44
44
|
|
45
45
|
desc 'register NAME', 'register ssh key pair'
|
46
|
-
option :account
|
47
|
-
option :project
|
48
|
-
option :public_key, required: true, desc: "path to public_key file"
|
46
|
+
option :account, desc: "name of the account"
|
47
|
+
option :project, desc: "name of the project"
|
48
|
+
option :public_key, aliases: %w(-k), required: true, desc: "path to public_key file"
|
49
49
|
def register(name)
|
50
50
|
resolve_account
|
51
51
|
resolve_project
|
52
52
|
options[:name] = name
|
53
53
|
if File.exist?(options[:public_key])
|
54
54
|
public_key = IO.read(options[:public_key])
|
55
|
+
options[:public_key] = public_key
|
55
56
|
else
|
56
57
|
say("Can't open public key #{options[:public_key]}", :red)
|
57
58
|
exit 1
|
@@ -59,16 +60,16 @@ class SshKeyPair < CloudstackCli::Base
|
|
59
60
|
pair = client.register_ssh_key_pair(options)
|
60
61
|
say "Name : #{pair['name']}"
|
61
62
|
say "Fingerprint : #{pair['fingerprint']}"
|
62
|
-
say "Privatekey:"
|
63
|
-
|
63
|
+
say "Privatekey : #{pair['privatekey']}"
|
64
|
+
puts
|
64
65
|
rescue => e
|
65
66
|
say "Failed to register key: #{e.message}", :red
|
66
67
|
exit 1
|
67
68
|
end
|
68
69
|
|
69
70
|
desc 'delete NAME', 'delete ssh key pair'
|
70
|
-
option :account
|
71
|
-
option :project
|
71
|
+
option :account, desc: "name of the account"
|
72
|
+
option :project, desc: "name of the project"
|
72
73
|
option :force, aliases: '-f', desc: "delete without asking"
|
73
74
|
def delete(name)
|
74
75
|
resolve_account
|
@@ -84,4 +85,28 @@ class SshKeyPair < CloudstackCli::Base
|
|
84
85
|
end
|
85
86
|
end
|
86
87
|
|
88
|
+
desc 'reset_vm_keys', 'resets the SSH Key for virtual machine (the virtual machine must be in a "Stopped" state)'
|
89
|
+
option :keypair, aliases: %w(-k), desc: "name of keypair", required: true
|
90
|
+
option :virtual_machine, aliases: %w(-m), desc: "name of virtual machine", required: true
|
91
|
+
option :account, desc: "name of the account"
|
92
|
+
option :project, desc: "name of the project"
|
93
|
+
def reset_vm_keys
|
94
|
+
resolve_account
|
95
|
+
resolve_project
|
96
|
+
|
97
|
+
unless virtual_machine = client.list_virtual_machines({name: options[:virtual_machine], list_all: true}.merge options).first
|
98
|
+
puts "No virtual machine found."
|
99
|
+
else
|
100
|
+
unless virtual_machine['state'].downcase == "stopped"
|
101
|
+
say "ERROR: Virtual machine must be in stopped state.", :red
|
102
|
+
exit 1
|
103
|
+
end
|
104
|
+
unless options[:force] || yes?("Reset ssh key for VM #{options[:virtual_machine]}? (y/N)", :yellow)
|
105
|
+
exit
|
106
|
+
end
|
107
|
+
client.reset_ssh_key_for_virtual_machine(options.merge(id: virtual_machine['id']))
|
108
|
+
say "OK", :green
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
87
112
|
end
|
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.5.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-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -56,7 +56,6 @@ description: cloudstack-cli is a CloudStack API command line client written in R
|
|
56
56
|
email:
|
57
57
|
- nik.wolfgramm@gmail.com
|
58
58
|
executables:
|
59
|
-
- cs
|
60
59
|
- cloudstack-cli
|
61
60
|
extensions: []
|
62
61
|
extra_rdoc_files: []
|
@@ -68,9 +67,8 @@ files:
|
|
68
67
|
- README.md
|
69
68
|
- Rakefile
|
70
69
|
- bin/cloudstack-cli
|
71
|
-
- bin/cs
|
72
70
|
- cloudstack-cli.gemspec
|
73
|
-
- completions/
|
71
|
+
- completions/cloudstack-cli.bash
|
74
72
|
- lib/cloudstack-cli.rb
|
75
73
|
- lib/cloudstack-cli/base.rb
|
76
74
|
- lib/cloudstack-cli/cli.rb
|
@@ -134,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
132
|
version: '0'
|
135
133
|
requirements: []
|
136
134
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.4.5
|
135
|
+
rubygems_version: 2.4.5.1
|
138
136
|
signing_key:
|
139
137
|
specification_version: 4
|
140
138
|
summary: cloudstack-cli CloudStack API client
|