civo_cli 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/civo_cli/version.rb +1 -1
- data/lib/instance.rb +20 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcf79296d9423f63f2c20427cfa0463f79f1d217e6cbc9ee85008790e670c6da
|
4
|
+
data.tar.gz: 6b0a853cb65b6be32f0e4e855cedc81168d8bc407cbfaadb2aad2ac374e1b594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d39ad0c61f725e01a267357ffa55d6cfba2fcd3a374d83d7e6d4432d1ce306066ca897e75366c1212ccffc3c896f82aee58fd24b58ba2120c67530f8085a6e98
|
7
|
+
data.tar.gz: e159923f394e4988b35611a748b5385b8288be0d36f6008db2c57039863a0843e8ea8b89340516e78b79f10c4d4a4e699d0b12d0cb485ca1432aace2d365dc9d
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@ 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.5.3] - 2019-11-01
|
7
|
+
### Added
|
8
|
+
- New feature, you can now specify a script to be run from the cloud-init process (it's saved on the instance as `/usr/local/bin/civo-user-init-script` with root ownership and only root permissions). `civo instance create --script=~/code/myscript.sh`
|
9
|
+
|
6
10
|
## [0.5.2] - 2019-11-01
|
7
11
|
### Fixed
|
8
12
|
- Updated bundler dependency requirements to allow for new versions of bundler (v. 2 onwards)
|
data/Gemfile.lock
CHANGED
data/lib/civo_cli/version.rb
CHANGED
data/lib/instance.rb
CHANGED
@@ -85,6 +85,11 @@ module CivoCLI
|
|
85
85
|
puts " Template ID : #{instance.template_id}"
|
86
86
|
puts " Snapshot ID : #{instance.snapshot_id}"
|
87
87
|
puts ""
|
88
|
+
if instance.script.present?
|
89
|
+
puts "-" * 26 + " INIT SCRIPT " + "-" * 26
|
90
|
+
puts instance.script
|
91
|
+
puts ""
|
92
|
+
end
|
88
93
|
puts "-" * 29 + " NOTES " + "-" * 29
|
89
94
|
puts ""
|
90
95
|
puts instance.notes
|
@@ -104,6 +109,7 @@ module CivoCLI
|
|
104
109
|
option :snapshot, banner: 'snapshot_id'
|
105
110
|
option :ssh_key, banner: 'ssh_key_id', aliases: '--ssh'
|
106
111
|
option :tags, banner: "'tag1 tag2 tag3...'"
|
112
|
+
option :script, type: :string, desc: "The filename of a file to be used as an initialization script", aliases: ["-s"], banner: "SCRIPT"
|
107
113
|
option :wait, type: :boolean
|
108
114
|
long_desc <<-LONGDESC
|
109
115
|
Create a new instance with hostname (randomly assigned if blank), instance size (default: g2.small),
|
@@ -138,11 +144,18 @@ module CivoCLI
|
|
138
144
|
options[:template] = DEFAULT_TEMPLATE
|
139
145
|
end
|
140
146
|
|
147
|
+
if options[:script]
|
148
|
+
unless File.exist?(File.expand_path(options[:script]))
|
149
|
+
puts "The file #{options[:script].colorize(:red)} doesn't exist or isn't readable"
|
150
|
+
exit 2
|
151
|
+
end
|
152
|
+
script = File.read(File.expand_path(options[:script]))
|
153
|
+
end
|
141
154
|
|
142
155
|
if options[:template]
|
143
|
-
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], template: options[:template], public_ip: options[:public_ip], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags])
|
156
|
+
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], template: options[:template], public_ip: options[:public_ip], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags], script: script)
|
144
157
|
elsif options[:snapshot]
|
145
|
-
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], snapshot_id: options[:snapshot], public_ip: options[:public_ip], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags])
|
158
|
+
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], snapshot_id: options[:snapshot], public_ip: options[:public_ip], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags], script: script)
|
146
159
|
end
|
147
160
|
|
148
161
|
if options[:wait]
|
@@ -214,6 +227,7 @@ module CivoCLI
|
|
214
227
|
exit 1
|
215
228
|
end
|
216
229
|
map "delete" => "remove"
|
230
|
+
map "rm" => "remove"
|
217
231
|
|
218
232
|
desc "reboot ID/HOSTNAME", "reboots instance with ID/hostname entered"
|
219
233
|
def reboot(id)
|
@@ -316,7 +330,7 @@ module CivoCLI
|
|
316
330
|
option :quiet, type: :boolean, aliases: '-q'
|
317
331
|
def public_ip(id)
|
318
332
|
CivoCLI::Config.set_api_auth
|
319
|
-
|
333
|
+
|
320
334
|
instance = detect_instance(id)
|
321
335
|
unless instance.public_ip.nil?
|
322
336
|
if options[:quiet]
|
@@ -324,7 +338,7 @@ module CivoCLI
|
|
324
338
|
else
|
325
339
|
puts "The public IP for #{instance.hostname.colorize(:green)} is #{instance.public_ip.colorize(:green)}"
|
326
340
|
end
|
327
|
-
else
|
341
|
+
else
|
328
342
|
puts "Error: Instance has no public IP"
|
329
343
|
exit 2
|
330
344
|
end
|
@@ -348,9 +362,9 @@ module CivoCLI
|
|
348
362
|
end
|
349
363
|
rescue Flexirest::HTTPException => e
|
350
364
|
puts e.result.reason.colorize(:red)
|
351
|
-
exit 1
|
365
|
+
exit 1
|
352
366
|
end
|
353
|
-
|
367
|
+
|
354
368
|
default_task :help
|
355
369
|
|
356
370
|
private
|