cloudstack-cli 0.7.1 → 0.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d936c9ce9b6b98ebfad8f153383bf1fe5bea27ff
4
- data.tar.gz: dfd0d79bfb8a58d2610ff7d3e3a6e3a6bec89c04
3
+ metadata.gz: f60b7f18dbb84a5e0aafc0a4f00e4430017f3114
4
+ data.tar.gz: b8d49b6bb547fcb4a960316b966b660be2d68200
5
5
  SHA512:
6
- metadata.gz: 5c0affd7753cca382d7eb9585e625b5e5be392687c0ee5a1a52a4a3713671f75bb458aad892c3eb74e20a3ec9d38cbb689e86ed63b3e5b088d752dae8e98b711
7
- data.tar.gz: b8a2ea5f26106af1367c8fbc4f5e088aadb121a55cbbaac11ea6e857b822577dbc83f793413540b8cfb86d460db565d733ae6bf648ed0a8f4d9854641bb7c7e1
6
+ metadata.gz: fc3d0417144eb1aa60d8ec3a50d742126278d180cf22f43ee7e97bc3be148898013c87146a21d7474f8ee7436483593821529e6bb18dd86829eedd96e229c7f8
7
+ data.tar.gz: c986cd7884ef8784ea91650744aae72dcadd34aa07c9e4b3be04564284345f997ce20818afdbef9366a52bf718a3f002413d99ebda93fd7daf8c4c353fdd198e
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  GIT
2
2
  remote: git@github.com:niwo/cloudstack_client.git
3
- revision: 8ad913e604d701c566061feee464b0556c5b3889
3
+ revision: 0421f2e3f58e726099d99d98898f48a6be7183a7
4
4
  branch: master
5
5
  specs:
6
- cloudstack_client (0.4.1)
6
+ cloudstack_client (0.4.4)
7
7
 
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- cloudstack-cli (0.7.0)
12
- cloudstack_client (~> 0.4, >= 0.4.0)
11
+ cloudstack-cli (0.7.1)
12
+ cloudstack_client (~> 0.4, >= 0.4.1)
13
13
  thor (~> 0.18)
14
14
 
15
15
  GEM
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/cloudstack-cli.png)](http://badge.fury.io/rb/cloudstack-cli)
4
4
 
5
- cloudstack-cli is a [CloudStack](http://cloudstack.apache.org/) API client written in Ruby.
5
+ cloudstack-cli is a [CloudStack](http://cloudstack.apache.org/) API command line client written in Ruby.
6
6
  cloudstack-cli uses the [cloudstack_client](https://github.com/niwo/cloudstack_client) to talk to the Cloudstack API.
7
7
 
8
8
  ## Installation
@@ -44,7 +44,7 @@ See the help screen:
44
44
 
45
45
  Bootsraps a server using a template and creating port-forwarding rules for port 22 and 80.
46
46
 
47
- $ cs server create server-01 --template CentOS-6.4-x64-v1.4 --offering 1cpu_1gb --port-rules :22 :80
47
+ $ cs server create server-01 --template CentOS-6.4-x64-v1.4 --zone DC1 --offering 1cpu_1gb --port-rules :22 :80
48
48
 
49
49
  ### Example: Run a any custom API command
50
50
 
@@ -79,7 +79,10 @@ An example stackfile looks like this (my_stackfile.json)
79
79
  "disk_offering": "Perf Storage",
80
80
  "disk_size": "5",
81
81
  "offering": "2cpu_4gb",
82
- "networks": "server_network, storage_network"
82
+ "networks": [
83
+ "server_network",
84
+ "storage_network"
85
+ ]
83
86
  }
84
87
  ]
85
88
  }
@@ -107,7 +110,7 @@ Hint: You can watch the status of the command with watch.
107
110
 
108
111
 
109
112
  ## References
110
- - [Cloudstack API documentation](http://cloudstack.apache.org/docs/api/apidocs-4.1/TOC_Root_Admin.html)
113
+ - [Cloudstack API documentation](http://cloudstack.apache.org/docs/api/)
111
114
  - This tool was inspired by the Knife extension for Cloudstack: [knife-cloudstack](https://github.com/CloudStack-extras/knife-cloudstack)
112
115
 
113
116
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.version = CloudstackCli::VERSION
9
9
  gem.authors = ['Nik Wolfgramm']
10
10
  gem.email = %w(nik.wolfgramm@gmail.com)
11
- gem.description = %q{cloudstack-cli is a CloudStack API client written in Ruby.}
11
+ gem.description = %q{cloudstack-cli is a CloudStack API command line client written in Ruby.}
12
12
  gem.summary = %q{cloudstack-cli CloudStack API client}
13
13
  gem.date = Time.now.utc.strftime("%Y-%m-%d")
14
14
  gem.homepage = 'https://github.com/niwo/cloudstack-cli'
@@ -25,5 +25,5 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency('rake', '~> 10.1')
26
26
 
27
27
  gem.add_dependency('thor', '~> 0.18')
28
- gem.add_dependency('cloudstack_client', '~> 0.4', '>= 0.4.1')
29
- end
28
+ gem.add_dependency('cloudstack_client', '~> 0.4', '>= 0.4.3')
29
+ end
@@ -5,7 +5,7 @@ class Server < CloudstackCli::Base
5
5
  option :account
6
6
  option :zone
7
7
  option :command, desc: "command to execute for each server: START, STOP or RESTART"
8
- option :status
8
+ option :state
9
9
  option :listall
10
10
  def list
11
11
  if options[:project]
@@ -16,7 +16,7 @@ class Server < CloudstackCli::Base
16
16
  if servers.size < 1
17
17
  puts "No servers found."
18
18
  else
19
- table = [["Name", "Status", "Offering", "Zone", project_id ? "Project" : "Account", "IP's"]]
19
+ table = [["Name", "State", "Offering", "Zone", project_id ? "Project" : "Account", "IP's"]]
20
20
  servers.each do |server|
21
21
  table << [
22
22
  server['name'],
@@ -76,8 +76,8 @@ class Server < CloudstackCli::Base
76
76
  option :template, aliases: '-t', desc: "name of the template"
77
77
  option :iso, desc: "name of the iso", desc: "name of the iso template"
78
78
  option :offering, aliases: '-o', required: true, desc: "computing offering name"
79
+ option :zone, aliases: '-z', required: true, desc: "availability zone name"
79
80
  option :networks, aliases: '-n', type: :array, desc: "network names"
80
- option :zone, aliases: '-z', desc: "availability zone name"
81
81
  option :project, aliases: '-p', desc: "project name"
82
82
  option :port_rules, aliases: '-pr', type: :array,
83
83
  default: [],
@@ -9,7 +9,7 @@ class Stack < CloudstackCli::Base
9
9
  client.verbose = false
10
10
  stack["servers"].each do |instance|
11
11
  instance["name"].gsub(', ', ',').split(',').each do |name|
12
- server = client.get_server(name, projectid)
12
+ server = client.get_server(name: name, project_id: projectid)
13
13
  if server
14
14
  say "Server #{name} (#{server["state"]}) already exists.", :yellow
15
15
  jobs << {
@@ -27,7 +27,7 @@ class Stack < CloudstackCli::Base
27
27
  template: instance["template"],
28
28
  iso: instance["iso"] ,
29
29
  offering: instance["offering"],
30
- networks: string_to_array(instance["networks"]),
30
+ networks: load_string_or_array(instance["networks"]),
31
31
  project: stack["project"],
32
32
  disk_offering: instance["disk_offering"],
33
33
  disk_size: instance["disk_size"],
@@ -48,7 +48,7 @@ class Stack < CloudstackCli::Base
48
48
  stack["servers"].each do |instance|
49
49
  instance["name"].gsub(', ', ',').split(',').each do |name|
50
50
  if port_rules = string_to_array(instance["port_rules"])
51
- server = client(quiet: true).get_server(name, projectid)
51
+ server = client(quiet: true).get_server(name, project_id: projectid)
52
52
  create_port_rules(server, port_rules, false).each_with_index do |job_id, index|
53
53
  jobs << {
54
54
  id: job_id,
@@ -80,7 +80,7 @@ class Stack < CloudstackCli::Base
80
80
  if options[:force] || yes?("Destroy the following servers #{servers.join(', ')}?", :yellow)
81
81
  jobs = []
82
82
  servers.each do |name|
83
- server = client(quiet: true).get_server(name, projectid)
83
+ server = client(quiet: true).get_server(name, project_id: projectid)
84
84
  if server
85
85
  jobs << {
86
86
  id: client.destroy_server(
@@ -107,6 +107,10 @@ class Stack < CloudstackCli::Base
107
107
  end
108
108
  end
109
109
 
110
+ def load_string_or_array(item)
111
+ item.is_a?(Array) ? item : [item]
112
+ end
113
+
110
114
  def string_to_array(string)
111
115
  string ? string.gsub(', ', ',').split(',') : nil
112
116
  end
@@ -12,14 +12,15 @@ class Volume < CloudstackCli::Base
12
12
  if volumes.size < 1
13
13
  say "No volumes found."
14
14
  else
15
- table = [%w(Name Type Size VM Storage Offeringname)]
15
+ table = [%w(Name Type Size VM Storage Offeringname Status)]
16
16
  volumes.each do |volume|
17
17
  table << [
18
18
  volume['name'], volume['type'],
19
19
  (volume['size'] / 1024**3).to_s + 'GB',
20
20
  volume['vmname'],
21
21
  volume['storage'],
22
- volume['diskofferingname']
22
+ volume['diskofferingname'],
23
+ volume['state']
23
24
  ]
24
25
  end
25
26
  print_table(table)
@@ -104,10 +104,11 @@ module CloudstackCli
104
104
  frontendip = nil
105
105
  jobs = []
106
106
  client.verbose = async
107
+ project_id = server['project'] ? client.get_project(server['project'])['id'] : nil
107
108
  port_rules.each do |pf_rule|
108
109
  ip = pf_rule.split(":")[0]
109
110
  if ip != ''
110
- ip_addr = client.get_public_ip_address(ip)
111
+ ip_addr = client.get_public_ip_address(ip, project_id)
111
112
  unless ip_addr
112
113
  say "Error: IP #{ip} not found.", :red
113
114
  next
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
metadata CHANGED
@@ -1,78 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-22 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
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.4'
62
- - - ">="
62
+ - - '>='
63
63
  - !ruby/object:Gem::Version
64
- version: 0.4.1
64
+ version: 0.4.3
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.4'
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
- version: 0.4.1
75
- description: cloudstack-cli is a CloudStack API client written in Ruby.
74
+ version: 0.4.3
75
+ description: cloudstack-cli is a CloudStack API command line client written in Ruby.
76
76
  email:
77
77
  - nik.wolfgramm@gmail.com
78
78
  executables:
@@ -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
@@ -128,23 +128,23 @@ licenses:
128
128
  metadata: {}
129
129
  post_install_message:
130
130
  rdoc_options:
131
- - "--line-numbers"
132
- - "--inline-source"
131
+ - --line-numbers
132
+ - --inline-source
133
133
  require_paths:
134
134
  - lib
135
135
  required_ruby_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ">="
137
+ - - '>='
138
138
  - !ruby/object:Gem::Version
139
139
  version: 1.9.3
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - ">="
142
+ - - '>='
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.2.0
147
+ rubygems_version: 2.0.3
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: cloudstack-cli CloudStack API client