civo_cli 0.2.4 → 0.2.5
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/blueprint.rb +40 -3
- data/lib/civo_cli/version.rb +1 -1
- data/lib/instance.rb +1 -1
- data/lib/kubernetes.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acd3180b6eaaf19c77c92333d99c03ca4c6718f64a9418f09efc7f3fd35733da
|
4
|
+
data.tar.gz: 9e5d92ca791a4c30aab31084592add09506abd00a7574aca2c881e9ea821b210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d18746327d2def6e43d25585eac8a9712185f6d609fa0ebdc4e5a6b7e2b38e0ee27f601757ce05a89fdffb94ac86a0b8f4d66aa2f12395bda655d3bf88c1aaa
|
7
|
+
data.tar.gz: 902519bfa7cdafd3e9f246616ce4695391c70b8b3a39625728662164bd1a3ae92eb61e48db49a73077daeaedeeee59a7fb60d243816b339b81877952705a7081
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@ All notable changes to the Civo CLI will be documented in this file.
|
|
3
3
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
5
5
|
|
6
|
+
## [0.2.5] - 2019-06-28
|
7
|
+
### Added
|
8
|
+
- Added support for using part of an ID instead of a whole ID
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Trapping of error message when a non-administrator tries to update blueprints
|
12
|
+
|
6
13
|
## [0.2.4] - 2019-06-28
|
7
14
|
### Added
|
8
15
|
- Added Kubernetes endpoints for when the service launches
|
data/Gemfile.lock
CHANGED
data/lib/blueprint.rb
CHANGED
@@ -8,6 +8,9 @@ module CivoCLI
|
|
8
8
|
rows << [blueprint.id, blueprint.name, blueprint.template_id, blueprint.version, blueprint.last_build_ended_at]
|
9
9
|
end
|
10
10
|
puts Terminal::Table.new headings: ['ID', 'Name', 'Template ID', 'Version', "Last built"], rows: rows
|
11
|
+
rescue Flexirest::HTTPForbiddenClientException => e
|
12
|
+
puts "Sorry, you don't have access to this feature".colorize(:red)
|
13
|
+
exit 1
|
11
14
|
rescue Flexirest::HTTPException => e
|
12
15
|
puts e.result.reason.colorize(:red)
|
13
16
|
exit 1
|
@@ -16,7 +19,7 @@ module CivoCLI
|
|
16
19
|
desc "show ID", "show the details for a single blueprint"
|
17
20
|
def show(id)
|
18
21
|
CivoCLI::Config.set_api_auth
|
19
|
-
blueprint =
|
22
|
+
blueprint = detect_blueprint_id(id)
|
20
23
|
puts " ID : #{blueprint.id}"
|
21
24
|
puts " Name : #{blueprint.name}"
|
22
25
|
puts " Template ID : #{blueprint.template_id}"
|
@@ -27,6 +30,9 @@ module CivoCLI
|
|
27
30
|
puts "-" * 29 + " CONTENT " + "-" * 29
|
28
31
|
puts ""
|
29
32
|
puts blueprint.dsl_content
|
33
|
+
rescue Flexirest::HTTPForbiddenClientException => e
|
34
|
+
puts "Sorry, you don't have access to this feature".colorize(:red)
|
35
|
+
exit 1
|
30
36
|
rescue Flexirest::HTTPException => e
|
31
37
|
puts e.result.reason.colorize(:red)
|
32
38
|
exit 1
|
@@ -35,16 +41,21 @@ module CivoCLI
|
|
35
41
|
option "content-file", type: :string, desc: "The filename of a file to be used as the Blueprintfile content", aliases: ["-c"], banner: "CONTENT_FILE"
|
36
42
|
option "template-id", type: :string, desc: "The ID of the template to update", aliases: ["-t"], banner: "TEMPLATE_ID"
|
37
43
|
option :name, type: :string, desc: "A nice name to be used for the blueprint", aliases: ["-n"], banner: "NICE_NAME"
|
44
|
+
option :force, type: :boolean, desc: "Force a rebuild on the next run", aliases: ["-f"]
|
38
45
|
desc "update ID", "update the blueprint with ID"
|
39
46
|
def update(id)
|
40
47
|
CivoCLI::Config.set_api_auth
|
41
|
-
params = {id: id}
|
48
|
+
params = {id: detect_blueprint_id(id)}
|
42
49
|
params[:dsl_content] = File.read(options["content-file"]) unless options["content-file"].nil?
|
43
50
|
params[:template_id] = options["template-id"] unless options["template-id"].nil?
|
44
51
|
params[:name] = options["name"] unless options["name"].nil?
|
52
|
+
params[:force] = options["force"] unless options["force"].nil?
|
45
53
|
Civo::Blueprint.update(params)
|
46
54
|
blueprint = Civo::Blueprint.all.detect {|b| b.id == id }
|
47
55
|
puts "Updated blueprint #{blueprint.name.colorize(:green)}"
|
56
|
+
rescue Flexirest::HTTPForbiddenClientException => e
|
57
|
+
puts "Sorry, you don't have access to this feature".colorize(:red)
|
58
|
+
exit 1
|
48
59
|
rescue Flexirest::HTTPException => e
|
49
60
|
puts e.result.reason.colorize(:red)
|
50
61
|
exit 1
|
@@ -63,6 +74,9 @@ module CivoCLI
|
|
63
74
|
result = Civo::Blueprint.create(params)
|
64
75
|
blueprint = Civo::Blueprint.all.detect {|b| b.id == result.id }
|
65
76
|
puts "Created blueprint #{blueprint.name.colorize(:green)} with ID #{blueprint.id.colorize(:green)}"
|
77
|
+
rescue Flexirest::HTTPForbiddenClientException => e
|
78
|
+
puts "Sorry, you don't have access to this feature".colorize(:red)
|
79
|
+
exit 1
|
66
80
|
rescue Flexirest::HTTPException => e
|
67
81
|
puts e.result.reason.colorize(:red)
|
68
82
|
exit 1
|
@@ -72,7 +86,10 @@ module CivoCLI
|
|
72
86
|
desc "remove ID", "remove the blueprint with ID"
|
73
87
|
def remove(id)
|
74
88
|
CivoCLI::Config.set_api_auth
|
75
|
-
Civo::Blueprint.remove(id)
|
89
|
+
Civo::Blueprint.remove(detect_blueprint_id(id))
|
90
|
+
rescue Flexirest::HTTPForbiddenClientException => e
|
91
|
+
puts "Sorry, you don't have access to this feature".colorize(:red)
|
92
|
+
exit 1
|
76
93
|
rescue Flexirest::HTTPException => e
|
77
94
|
puts e.result.reason.colorize(:red)
|
78
95
|
exit 1
|
@@ -80,5 +97,25 @@ module CivoCLI
|
|
80
97
|
map "delete" => "remove", "rm" => "remove"
|
81
98
|
|
82
99
|
default_task :list
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
def detect_blueprint_id(id)
|
104
|
+
result = []
|
105
|
+
Civo::Blueprint.all.items.each do |blueprint|
|
106
|
+
result << blueprint
|
107
|
+
end
|
108
|
+
result.select! { |blueprint| blueprint.name.include?(id) || blueprint.id.include?(id) }
|
109
|
+
|
110
|
+
if result.count.zero?
|
111
|
+
puts "No blueprints found for '#{id}'. Please check your query."
|
112
|
+
exit 1
|
113
|
+
elsif result.count > 1
|
114
|
+
puts "Multiple possible blueprints found for '#{id}'. Please try with a more specific query."
|
115
|
+
exit 1
|
116
|
+
else
|
117
|
+
result[0]
|
118
|
+
end
|
119
|
+
end
|
83
120
|
end
|
84
121
|
end
|
data/lib/civo_cli/version.rb
CHANGED
data/lib/instance.rb
CHANGED
@@ -312,7 +312,7 @@ module CivoCLI
|
|
312
312
|
Civo::Instance.all.items.each do |instance|
|
313
313
|
result << instance
|
314
314
|
end
|
315
|
-
result.select! { |instance| instance.hostname.include?(id) }
|
315
|
+
result.select! { |instance| instance.hostname.include?(id) || instance.id.include?(id) }
|
316
316
|
|
317
317
|
if result.count.zero?
|
318
318
|
puts "No instances found for '#{id}'. Please check your query."
|
data/lib/kubernetes.rb
CHANGED
@@ -31,8 +31,7 @@ module CivoCLI
|
|
31
31
|
puts " Status : #{cluster.status.colorize(:red)}"
|
32
32
|
end
|
33
33
|
puts " Version : #{cluster.kubernetes_version}"
|
34
|
-
puts " API Endpoint : #{cluster.
|
35
|
-
#<Civo::Kubernetes id: "9f1cf43c-a924-468f-baa7-38dbe0e98ff0", name: "chris-edward", version: "1", status: "ACTIVE", num_target_nodes: 3, target_nodes_size: "g2.medium", built_at: "2019-06-27 16:56:25", kubeconfig: "apiVersion: v1\nclusters:\n- cluster:\n certificate...", kubernetes_version: "0.6.1", created_at: "2019-06-27 16:52:10", instances: #<Flexirest::ResultIterator:0x00007fc43847d958 @_status=nil, @_headers=nil, @items=[#<Civo::Kubernetes hostname: "k8s-node-acf8", size: "g2.medium", region: "lon1", created_at: "2019-06-27 16:52:11", status: "ACTIVE", firewall_id: "fdf99ced-e257-4ddf-9c81-da81a1dea4ff", public_ip: "185.136.234.35">, #<Civo::Kubernetes hostname: "k8s-node-3615", size: "g2.medium", region: "lon1", created_at: "2019-06-27 16:52:11", status: "ACTIVE", firewall_id: "fdf99ced-e257-4ddf-9c81-da81a1dea4ff", public_ip: "185.136.232.85">, #<Civo::Kubernetes hostname: "k8s-master-4f46", size: "g2.medium", region: "lon1", created_at: "2019-06-27 16:52:11", status: "ACTIVE", firewall_id: "fdf99ced-e257-4ddf-9c81-da81a1dea4ff", public_ip: "185.136.232.240">]>>
|
34
|
+
puts " API Endpoint : #{cluster.api_endpoint}"
|
36
35
|
|
37
36
|
puts ""
|
38
37
|
rows = []
|
@@ -151,7 +150,7 @@ module CivoCLI
|
|
151
150
|
Civo::Kubernetes.all.items.each do |cluster|
|
152
151
|
result << cluster
|
153
152
|
end
|
154
|
-
result.select! { |cluster| cluster.name.include?(id) }
|
153
|
+
result.select! { |cluster| cluster.name.include?(id) || cluster.id.include?(id) }
|
155
154
|
|
156
155
|
if result.count.zero?
|
157
156
|
puts "No Kubernetes clusters found for '#{id}'. Please check your query."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: civo_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-07-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|