cloudstack-cli 0.5.8 → 0.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 +1 -1
- data/lib/cloudstack-cli/base.rb +7 -5
- data/lib/cloudstack-cli/commands/account.rb +1 -0
- data/lib/cloudstack-cli/commands/cluster.rb +1 -0
- data/lib/cloudstack-cli/commands/compute_offer.rb +1 -0
- data/lib/cloudstack-cli/commands/disk_offer.rb +1 -0
- data/lib/cloudstack-cli/commands/domain.rb +1 -0
- data/lib/cloudstack-cli/commands/environment.rb +67 -21
- data/lib/cloudstack-cli/commands/host.rb +1 -0
- data/lib/cloudstack-cli/commands/ip_address.rb +1 -0
- data/lib/cloudstack-cli/commands/iso.rb +1 -0
- data/lib/cloudstack-cli/commands/load_balancer.rb +1 -0
- data/lib/cloudstack-cli/commands/network.rb +1 -0
- data/lib/cloudstack-cli/commands/physical_network.rb +1 -0
- data/lib/cloudstack-cli/commands/pod.rb +1 -0
- data/lib/cloudstack-cli/commands/port_rule.rb +1 -0
- data/lib/cloudstack-cli/commands/project.rb +1 -0
- data/lib/cloudstack-cli/commands/router.rb +1 -1
- data/lib/cloudstack-cli/commands/snapshot.rb +1 -0
- data/lib/cloudstack-cli/commands/template.rb +2 -1
- data/lib/cloudstack-cli/commands/user.rb +1 -0
- data/lib/cloudstack-cli/commands/volume.rb +1 -0
- data/lib/cloudstack-cli/version.rb +1 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a83e808e4d6c14b9b83212dcc08626703a0955a6
|
4
|
+
data.tar.gz: 758f54540afe222f8a3e7d81b079c34cd2f40b75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4c060f6132b9cb05a40c066eab6f59f1bb9370ef6056a629b1e3e289ac84381bfe3fe68d700a80fe7861e524e5dd60e26cd886a19539a09e1fdb63ae1420d2d
|
7
|
+
data.tar.gz: 83475400d4d05965c10a3ec8bb8636e29a31c5653149181c3a2760ec3e65d099d268f1e40fc5a0f0f7cce196d5837bf2ce0696388185fa6b626bc175cf8944ba
|
data/Gemfile.lock
CHANGED
data/lib/cloudstack-cli/base.rb
CHANGED
@@ -30,22 +30,24 @@ module CloudstackCli
|
|
30
30
|
)
|
31
31
|
end
|
32
32
|
|
33
|
-
def load_configuration(config_file = options[:config_file], env = options[:
|
33
|
+
def load_configuration(config_file = options[:config_file], env = options[:env])
|
34
34
|
unless File.exists?(config_file)
|
35
35
|
say "Configuration file #{config_file} not found.", :red
|
36
36
|
say "Please run \'cs setup\' to create one."
|
37
37
|
exit 1
|
38
38
|
end
|
39
|
+
|
39
40
|
begin
|
40
41
|
config = YAML::load(IO.read(config_file))
|
41
42
|
rescue
|
42
|
-
|
43
|
+
say "Can't load configuration from file #{config_file}.", :red
|
43
44
|
exit 1
|
44
45
|
end
|
46
|
+
|
47
|
+
env ||= config[:default]
|
45
48
|
if env
|
46
|
-
config = config[env]
|
47
|
-
|
48
|
-
error "Can't find environment #{env} in configuration file."
|
49
|
+
unless config = config[env]
|
50
|
+
say "Can't find environment #{env}.", :red
|
49
51
|
exit 1
|
50
52
|
end
|
51
53
|
end
|
@@ -2,11 +2,13 @@ class Environment < CloudstackCli::Base
|
|
2
2
|
|
3
3
|
desc "list", "list cloudstack-cli environments"
|
4
4
|
def list
|
5
|
-
config =
|
6
|
-
table = [%w(Name URL)]
|
7
|
-
table << [
|
5
|
+
config = parse_config_file
|
6
|
+
table = [%w(Name URL Default)]
|
7
|
+
table << ['-', config[:url], !config[:default]]
|
8
8
|
config.each_key do |key|
|
9
|
-
|
9
|
+
unless key.class == Symbol
|
10
|
+
table << [key, config[key][:url], key == config[:default]]
|
11
|
+
end
|
10
12
|
end
|
11
13
|
print_table table
|
12
14
|
end
|
@@ -15,54 +17,98 @@ class Environment < CloudstackCli::Base
|
|
15
17
|
option :url
|
16
18
|
option :api_key
|
17
19
|
option :secret_key
|
20
|
+
option :default, type: :boolean
|
18
21
|
def add(env = options[:environment])
|
19
22
|
config = {}
|
20
23
|
unless options[:url]
|
21
|
-
say "Add a new environment
|
24
|
+
say "Add a new environment...", :green
|
25
|
+
say "Environment name: #{env}" if env
|
22
26
|
say "What's the URL of your Cloudstack API?", :yellow
|
23
27
|
say "Example: https://my-cloudstack-service/client/api/", :green
|
24
28
|
config[:url] = ask("URL:", :magenta)
|
25
29
|
end
|
30
|
+
|
26
31
|
unless options[:api_key]
|
27
32
|
config[:api_key] = ask("API Key:", :magenta)
|
28
33
|
end
|
34
|
+
|
29
35
|
unless options[:secret_key]
|
30
36
|
config[:secret_key] = ask("Secret Key:", :magenta)
|
31
37
|
end
|
38
|
+
|
32
39
|
if env
|
33
40
|
config = {env => config}
|
41
|
+
config[:default] = env if options[:default]
|
34
42
|
end
|
43
|
+
|
35
44
|
if File.exists? options[:config_file]
|
36
|
-
|
37
|
-
|
38
|
-
|
45
|
+
newfile = true
|
46
|
+
old_config = parse_config_file
|
47
|
+
if !env || old_config.has_key?(env)
|
48
|
+
say "This environment already exists!", :red
|
49
|
+
exit unless yes?("Do you want to override your settings? [y/N]", :yellow)
|
50
|
+
end
|
39
51
|
config = old_config.merge(config)
|
40
52
|
end
|
41
|
-
|
42
|
-
|
53
|
+
|
54
|
+
write_config_file(config)
|
55
|
+
if newfile
|
56
|
+
say "OK. Created configuration file at #{options[:config_file]}.", :green
|
57
|
+
else
|
58
|
+
say "Added environment #{env}", :green
|
59
|
+
end
|
43
60
|
end
|
44
61
|
|
45
62
|
desc "delete", "delete a Cloudstack connection"
|
46
|
-
def delete(
|
47
|
-
config =
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
63
|
+
def delete(env)
|
64
|
+
config = parse_config_file
|
65
|
+
if config.delete(env)
|
66
|
+
exit unless yes?("Do you really want to delete environment #{env}? [y/N]", :yellow)
|
67
|
+
config.delete :default if config[:default] == env
|
68
|
+
write_config_file(config)
|
69
|
+
say "OK.", :green
|
70
|
+
else
|
71
|
+
say "Environment #{env} does not exist.", :red
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "default ENV", "set the default environment"
|
76
|
+
def default(env)
|
77
|
+
config = parse_config_file
|
78
|
+
if env == '-'
|
79
|
+
config.delete :default
|
80
|
+
else
|
81
|
+
unless config.has_key?(env)
|
82
|
+
say "Environment #{env} does not exist.", :red
|
83
|
+
exit 1
|
84
|
+
end
|
85
|
+
config[:default] = env
|
86
|
+
end
|
87
|
+
write_config_file(config)
|
88
|
+
say "Default environment set to #{env}."
|
52
89
|
end
|
53
90
|
|
54
91
|
no_commands do
|
55
92
|
|
56
|
-
def
|
57
|
-
if File.exists?
|
93
|
+
def parse_config_file
|
94
|
+
if File.exists? options[:config_file]
|
58
95
|
begin
|
59
|
-
return YAML::load(IO.read(
|
96
|
+
return YAML::load(IO.read(options[:config_file]))
|
60
97
|
rescue
|
61
|
-
say "Error loading configuration from file #{
|
98
|
+
say "Error loading configuration from file #{options[:config_file]}.", :red
|
62
99
|
exit 1
|
63
100
|
end
|
64
101
|
else
|
65
|
-
say "Can't load configuration from file #{
|
102
|
+
say "Can't load configuration from file #{options[:config_file]}.", :red
|
103
|
+
exit 1
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def write_config_file(config)
|
108
|
+
begin
|
109
|
+
return File.open(options[:config_file], 'w+') {|f| f.write(config.to_yaml) }
|
110
|
+
rescue
|
111
|
+
say "Can't open configuration file #{options[:config_file]} for writing.", :red
|
66
112
|
exit 1
|
67
113
|
end
|
68
114
|
end
|
@@ -16,13 +16,14 @@ class Template < CloudstackCli::Base
|
|
16
16
|
zone_id: zone ? zone['id'] : nil
|
17
17
|
)
|
18
18
|
if templates.size < 1
|
19
|
-
puts "No templates found"
|
19
|
+
puts "No templates found."
|
20
20
|
else
|
21
21
|
table = [["Name", "Zone", "Format"]]
|
22
22
|
templates.each do |template|
|
23
23
|
table << [template['name'], template['zonename'], template['format']]
|
24
24
|
end
|
25
25
|
print_table(table)
|
26
|
+
say "Total number of templates: #{templates.size}"
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nik Wolfgramm
|
@@ -14,62 +14,62 @@ dependencies:
|
|
14
14
|
name: rdoc
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.18'
|
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
54
|
version: '0.18'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: cloudstack_client
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.3'
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 0.3.6
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- - ~>
|
69
|
+
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0.3'
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.3.6
|
75
75
|
description: cloudstack-cli is a CloudStack API client written in Ruby.
|
@@ -80,7 +80,7 @@ executables:
|
|
80
80
|
extensions: []
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
|
-
- .gitignore
|
83
|
+
- ".gitignore"
|
84
84
|
- Gemfile
|
85
85
|
- Gemfile.lock
|
86
86
|
- LICENSE.txt
|
@@ -125,23 +125,23 @@ licenses:
|
|
125
125
|
metadata: {}
|
126
126
|
post_install_message:
|
127
127
|
rdoc_options:
|
128
|
-
- --line-numbers
|
129
|
-
- --inline-source
|
128
|
+
- "--line-numbers"
|
129
|
+
- "--inline-source"
|
130
130
|
require_paths:
|
131
131
|
- lib
|
132
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
|
-
- -
|
134
|
+
- - ">="
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: 1.9.3
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
requirements:
|
139
|
-
- -
|
139
|
+
- - ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.0
|
144
|
+
rubygems_version: 2.2.0
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: cloudstack-cli CloudStack API client
|