cloudstack-cli 1.5.13 → 1.6.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 +4 -4
- data/README.md +15 -8
- data/cloudstack-cli.gemspec +1 -1
- data/lib/cloudstack-cli.rb +1 -0
- data/lib/cloudstack-cli/base.rb +15 -34
- data/lib/cloudstack-cli/cli.rb +2 -2
- data/lib/cloudstack-cli/commands/user.rb +6 -3
- data/lib/cloudstack-cli/version.rb +1 -1
- data/spec/{cloudstack-cli.yml → cloudstack.yml} +0 -1
- data/spec/spec_helper.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0301d4bcecdf17de018258aff0d4640feb06df0b
|
|
4
|
+
data.tar.gz: 6fdc68888e0e3b8bc6fef745b577031aaf633a2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ebfda74fea9fd907d7ff9f14225f8060e12679a137a46343d0752c122bd3be21a670c26e40f82a1cdfe3c6341e6e931e1dc9ae33fc51913119bd054a4c83bf5
|
|
7
|
+
data.tar.gz: d31110292fd60b72618aaa1d445fb87cf4ddb25ef8a072b615a58de14d62729fb73f92c766c2a47b00e48db270e67a5cb02bfd5d9319343a2f7ad77c8229a3a0
|
data/Gemfile.lock
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../cloudstack_client/
|
|
3
3
|
specs:
|
|
4
|
-
cloudstack_client (1.
|
|
4
|
+
cloudstack_client (1.5.3)
|
|
5
5
|
|
|
6
6
|
PATH
|
|
7
7
|
remote: .
|
|
8
8
|
specs:
|
|
9
|
-
cloudstack-cli (1.
|
|
10
|
-
cloudstack_client (~> 1.
|
|
9
|
+
cloudstack-cli (1.6.0)
|
|
10
|
+
cloudstack_client (~> 1.5.3)
|
|
11
11
|
thor (~> 0.19.4)
|
|
12
12
|
|
|
13
13
|
GEM
|
|
14
14
|
remote: https://rubygems.org/
|
|
15
15
|
specs:
|
|
16
|
-
minitest (5.10.
|
|
16
|
+
minitest (5.10.2)
|
|
17
17
|
rake (12.0.0)
|
|
18
18
|
thor (0.19.4)
|
|
19
19
|
|
data/README.md
CHANGED
|
@@ -17,7 +17,8 @@ $ gem install cloudstack-cli
|
|
|
17
17
|
|
|
18
18
|
### Create a cloudstack-cli environment
|
|
19
19
|
|
|
20
|
-
cloudstack-cli expects to find a configuration file with the API URL and your CloudStack credentials in your home directory named .cloudstack-cli.yml.
|
|
20
|
+
cloudstack-cli expects to find a configuration file with the API URL and your CloudStack credentials in your home directory named .cloudstack.yml (or .cloudstack-cli.yml).
|
|
21
|
+
If the file is located elsewhere you can specify the location using the --config-file option.
|
|
21
22
|
|
|
22
23
|
*Create your initial environment, which defines your connection options:*
|
|
23
24
|
|
|
@@ -48,17 +49,23 @@ $ cloudstack-cli environment default [environment-name]
|
|
|
48
49
|
|
|
49
50
|
see `cloudstack-cli help environment` for more options.
|
|
50
51
|
|
|
51
|
-
Example
|
|
52
|
+
Example configuration file:
|
|
52
53
|
|
|
53
54
|
```yaml
|
|
54
|
-
|
|
55
|
-
:
|
|
56
|
-
:secret_key: "cloudstack-api-secret"
|
|
55
|
+
# default environment
|
|
56
|
+
:default: production
|
|
57
57
|
|
|
58
|
+
# production environment
|
|
59
|
+
production:
|
|
60
|
+
:url: "https://my-cloudstack-server/client/api/"
|
|
61
|
+
:api_key: "cloudstack-api-key"
|
|
62
|
+
:secret_key: "cloudstack-api-secret"
|
|
63
|
+
|
|
64
|
+
# test environment
|
|
58
65
|
test:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
:url: "http://my-cloudstack-testserver/client/api/"
|
|
67
|
+
:api_key: "cloudstack-api-key"
|
|
68
|
+
:secret_key: "cloudstack-api-secret"
|
|
62
69
|
```
|
|
63
70
|
|
|
64
71
|
### Shell tab auto-completion
|
data/cloudstack-cli.gemspec
CHANGED
|
@@ -24,6 +24,6 @@ Gem::Specification.new do |gem|
|
|
|
24
24
|
gem.add_development_dependency('rake', '~> 12.0')
|
|
25
25
|
gem.add_development_dependency('minitest', '~> 5.9')
|
|
26
26
|
|
|
27
|
-
gem.add_dependency('cloudstack_client', '~> 1.
|
|
27
|
+
gem.add_dependency('cloudstack_client', '~> 1.5.3')
|
|
28
28
|
gem.add_dependency('thor', '~> 0.19.4')
|
|
29
29
|
end
|
data/lib/cloudstack-cli.rb
CHANGED
data/lib/cloudstack-cli/base.rb
CHANGED
|
@@ -49,34 +49,12 @@ module CloudstackCli
|
|
|
49
49
|
@client
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
def load_configuration
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
begin
|
|
60
|
-
config = YAML::load(IO.read(config_file))
|
|
61
|
-
rescue
|
|
62
|
-
say "Can't load configuration from file #{config_file}.", :red
|
|
63
|
-
exit 1
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
env ||= config[:default]
|
|
67
|
-
if env
|
|
68
|
-
unless config = config[env]
|
|
69
|
-
say "Can't find environment #{env}.", :red
|
|
70
|
-
exit 1
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
unless config.key?(:url) && config.key?(:api_key) && config.key?(:secret_key)
|
|
75
|
-
say "The environment #{env || '\'-\''} does not contain all required keys.", :red
|
|
76
|
-
say "Please check with 'cloudstack-cli environment list' and set a valid default environment."
|
|
77
|
-
exit 1
|
|
78
|
-
end
|
|
79
|
-
config
|
|
52
|
+
def load_configuration
|
|
53
|
+
CloudstackClient::Configuration.load(options)
|
|
54
|
+
rescue CloudstackClient::ConfigurationError => e
|
|
55
|
+
say "Error: ", :red
|
|
56
|
+
say e.message
|
|
57
|
+
exit 1
|
|
80
58
|
end
|
|
81
59
|
|
|
82
60
|
def filter_by(objects, key, value)
|
|
@@ -91,7 +69,8 @@ module CloudstackCli
|
|
|
91
69
|
object[key.to_s].to_s =~ /#{value}/i
|
|
92
70
|
end
|
|
93
71
|
rescue RegexpError => e
|
|
94
|
-
say "ERROR:
|
|
72
|
+
say "ERROR: ", :red
|
|
73
|
+
say "Invalid regular expression in filter - #{e.message}"
|
|
95
74
|
exit 1
|
|
96
75
|
end
|
|
97
76
|
|
|
@@ -119,21 +98,23 @@ module CloudstackCli
|
|
|
119
98
|
when ".yaml", ".yml"
|
|
120
99
|
Object.const_get "YAML"
|
|
121
100
|
else
|
|
122
|
-
say "
|
|
101
|
+
say "ERROR: ", :red
|
|
102
|
+
say "File extension #{File.extname(file)} not supported. Supported extensions are #{extensions.join(', ')}"
|
|
123
103
|
exit
|
|
124
104
|
end
|
|
125
105
|
begin
|
|
126
106
|
return handler.load open(file){|f| f.read}
|
|
127
107
|
rescue SystemCallError
|
|
128
|
-
say "
|
|
108
|
+
say "ERROR: ", :red
|
|
109
|
+
say "Can't find the file '#{file}'."
|
|
129
110
|
exit 1
|
|
130
111
|
rescue => e
|
|
131
|
-
say "
|
|
132
|
-
say e.message
|
|
112
|
+
say "ERROR: ", :red
|
|
113
|
+
say "Can't parse file '#{file}': #{e.message}"
|
|
133
114
|
exit 1
|
|
134
115
|
end
|
|
135
116
|
end
|
|
136
117
|
end
|
|
137
|
-
|
|
118
|
+
|
|
138
119
|
end # class
|
|
139
120
|
end # module
|
data/lib/cloudstack-cli/cli.rb
CHANGED
|
@@ -5,9 +5,9 @@ module CloudstackCli
|
|
|
5
5
|
package_name "cloudstack-cli"
|
|
6
6
|
|
|
7
7
|
class_option :config_file,
|
|
8
|
-
default:
|
|
8
|
+
default: CloudstackClient::Configuration.locate_config_file,
|
|
9
9
|
aliases: '-c',
|
|
10
|
-
desc: 'Location of your cloudstack
|
|
10
|
+
desc: 'Location of your cloudstack configuration file'
|
|
11
11
|
|
|
12
12
|
class_option :env,
|
|
13
13
|
aliases: '-e',
|
|
@@ -17,11 +17,14 @@ class User < CloudstackCli::Base
|
|
|
17
17
|
when :json
|
|
18
18
|
puts JSON.pretty_generate(users: users)
|
|
19
19
|
else
|
|
20
|
-
table = [
|
|
20
|
+
table = [%w(Account Type Name Username Email State Domain)]
|
|
21
21
|
users.each do |user|
|
|
22
22
|
table << [
|
|
23
|
-
user['account'],
|
|
24
|
-
|
|
23
|
+
user['account'],
|
|
24
|
+
Account::TYPES[user['accounttype']],
|
|
25
|
+
"#{user['firstname']} #{user['lastname']}",
|
|
26
|
+
user['username'], user['email'],
|
|
27
|
+
user['state'], user['domain']
|
|
25
28
|
]
|
|
26
29
|
end
|
|
27
30
|
print_table table
|
data/spec/spec_helper.rb
CHANGED
|
@@ -5,7 +5,7 @@ require "minitest/autorun"
|
|
|
5
5
|
require "minitest/pride"
|
|
6
6
|
|
|
7
7
|
# make the config file setup awailable to all specs
|
|
8
|
-
CONFIG = "--config-file=#{File.expand_path('cloudstack
|
|
8
|
+
CONFIG = "--config-file=#{File.expand_path('cloudstack.yml', File.dirname(__FILE__))}"
|
|
9
9
|
ZONE = "Sandbox-simulator"
|
|
10
10
|
TEMPLATE = "CentOS 5.3(64-bit) no GUI (Simulator)"
|
|
11
11
|
OFFERING_S = "Small Instance"
|
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.6.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: 2017-01
|
|
11
|
+
date: 2017-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 1.
|
|
47
|
+
version: 1.5.3
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 1.
|
|
54
|
+
version: 1.5.3
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: thor
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,8 +128,8 @@ files:
|
|
|
128
128
|
- lib/cloudstack-cli/option_resolver.rb
|
|
129
129
|
- lib/cloudstack-cli/thor_patch.rb
|
|
130
130
|
- lib/cloudstack-cli/version.rb
|
|
131
|
-
- spec/cloudstack-cli.yml
|
|
132
131
|
- spec/cloudstack-cli/commands/virtual_machine_spec.rb
|
|
132
|
+
- spec/cloudstack.yml
|
|
133
133
|
- spec/fixtures/stack.yml
|
|
134
134
|
- spec/spec_helper.rb
|
|
135
135
|
homepage: http://github.com/niwo/cloudstack-cli
|
|
@@ -159,7 +159,7 @@ signing_key:
|
|
|
159
159
|
specification_version: 4
|
|
160
160
|
summary: cloudstack-cli CloudStack API client
|
|
161
161
|
test_files:
|
|
162
|
-
- spec/cloudstack-cli.yml
|
|
163
162
|
- spec/cloudstack-cli/commands/virtual_machine_spec.rb
|
|
163
|
+
- spec/cloudstack.yml
|
|
164
164
|
- spec/fixtures/stack.yml
|
|
165
165
|
- spec/spec_helper.rb
|