cloudstack-cli 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack-cli (0.3.2)
4
+ cloudstack-cli (0.3.3)
5
5
  thor (~> 0.18.1)
6
6
 
7
7
  GEM
@@ -4,6 +4,7 @@ class Iso < CloudstackCli::Base
4
4
  option :project
5
5
  option :zone
6
6
  option :account
7
+ option :listall
7
8
  def list(type='featured')
8
9
  project = find_project if options[:project]
9
10
  unless %w(featured self self-executable executable community).include? type
@@ -15,8 +15,8 @@ class Stack < CloudstackCli::Base
15
15
  template: server["template"],
16
16
  iso: server["iso"] ,
17
17
  offering: server["offering"],
18
- networks: server["networks"] ? server["networks"].split(', ') : nil,
19
- port_rules: server["port_rules"] ? server["port_rules"].split(', ') : nil,
18
+ networks: string_to_array(server["networks"]),
19
+ port_rules: string_to_array(server["port_rules"]),
20
20
  project: stack["project"],
21
21
  disk_offering: server["disk_offering"],
22
22
  disk_size: server["disk_size"],
@@ -57,6 +57,10 @@ class Stack < CloudstackCli::Base
57
57
  exit
58
58
  end
59
59
  end
60
+
61
+ def string_to_array(string)
62
+ string ? string.gsub(', ', ',').split(', ') : nil
63
+ end
60
64
  end
61
65
 
62
66
  end
@@ -37,7 +37,6 @@ module CloudstackCli
37
37
  end
38
38
  t.join
39
39
  else
40
- print ("\r" + "\e[A\e[K" * (status.size + 1)) if call > 0
41
40
  chars = print_job_status(jobs, status, chars,
42
41
  call == 0 ? opts.merge(no_clear: true) : opts
43
42
  )
@@ -77,20 +76,25 @@ module CloudstackCli
77
76
  end
78
77
 
79
78
  if args[:port_rules] && args[:port_rules].size > 0
80
- frontendip = nil
81
- args[:port_rules].each do |pf_rule|
82
- ip = pf_rule.split(":")[0]
83
- if ip != ''
84
- ip_addr = client.get_public_ip_address(ip)
85
- else
86
- ip_addr = frontendip ||= client.associate_ip_address(
87
- server["nic"].first["networkid"]
88
- )
89
- end
90
- port = pf_rule.split(":")[1]
91
- say "Create port forwarding rule #{ip_addr['ipaddress']}:#{port} for server #{args[:name]}.", :yellow
92
- client.create_port_forwarding_rule(ip_addr["id"], port, 'TCP', port, server["id"])
79
+ create_port_rules(server, args[:port_rules])
80
+ end
81
+ server
82
+ end
83
+
84
+ def create_port_rules(server, port_rules)
85
+ frontendip = nil
86
+ port_rules.each do |pf_rule|
87
+ ip = pf_rule.split(":")[0]
88
+ if ip != ''
89
+ ip_addr = client.get_public_ip_address(ip)
90
+ else
91
+ ip_addr = frontendip ||= client.associate_ip_address(
92
+ server["nic"].first["networkid"]
93
+ )
93
94
  end
95
+ port = pf_rule.split(":")[1]
96
+ say "Create port forwarding rule #{ip_addr['ipaddress']}:#{port} for server #{server["name"]}.", :yellow
97
+ client.create_port_forwarding_rule(ip_addr["id"], port, 'TCP', port, server["id"])
94
98
  end
95
99
  end
96
100
 
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -17,10 +17,14 @@ module CloudstackClient
17
17
  filter = args[:filter] || 'featured'
18
18
  params = {
19
19
  'command' => 'listIsos',
20
- 'templateFilter' => filter
20
+ 'isoFilter' => filter
21
21
  }
22
22
  params['projectid'] = args[:project_id] if args[:project_id]
23
23
  params['zoneid'] = args[:zone_id] if args[:zone_id]
24
+ if args[:listall]
25
+ params['listall'] = true
26
+ params['isrecursive'] = true
27
+ end
24
28
 
25
29
  json = send_request(params)
26
30
  json['iso'] || []
@@ -37,7 +41,7 @@ module CloudstackClient
37
41
  # the name parameter should be added to the request.
38
42
  params = {
39
43
  'command' => 'listIsos',
40
- 'templateFilter' => 'executable'
44
+ 'isoFilter' => 'executable'
41
45
  }
42
46
  json = send_request(params)
43
47
 
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
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.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-16 00:00:00.000000000 Z
12
+ date: 2013-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc