skull_island 2.0.3 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +45 -2
- data/.travis.yml +3 -1
- data/Gemfile.lock +82 -64
- data/README.md +24 -8
- data/lib/skull_island/cli.rb +10 -6
- data/lib/skull_island/helpers/meta.rb +1 -1
- data/lib/skull_island/helpers/resource.rb +16 -7
- data/lib/skull_island/lru_cache.rb +1 -1
- data/lib/skull_island/resource.rb +8 -5
- data/lib/skull_island/resource_collection.rb +4 -3
- data/lib/skull_island/resources/ca_certificate.rb +31 -3
- data/lib/skull_island/resources/certificate.rb +31 -5
- data/lib/skull_island/resources/consumer.rb +8 -3
- data/lib/skull_island/resources/jwt_credential.rb +4 -1
- data/lib/skull_island/resources/plugin.rb +22 -12
- data/lib/skull_island/resources/route.rb +10 -2
- data/lib/skull_island/resources/service.rb +80 -6
- data/lib/skull_island/resources/upstream.rb +2 -0
- data/lib/skull_island/resources/upstream_target.rb +6 -3
- data/lib/skull_island/validations/api_client.rb +1 -1
- data/lib/skull_island/validations/resource.rb +1 -1
- data/lib/skull_island/version.rb +2 -2
- data/skull_island.gemspec +3 -3
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b580af68447c1bdadffd52b9cce45c163f07c2e6bfe2c5b76253ae8085483f84
|
4
|
+
data.tar.gz: 1b99ae3de3e193ccef606b2e33afe879e790dd092152476e860dc312ac6254ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26105aab8efbcb318bf00f025023c4e96e8eded052f9082aa663eace7228a5cd9a85ffca9fc5ac57edc6668a558ec2f6bf0d4d41bb5f6d4300b899d0ce8d22d1
|
7
|
+
data.tar.gz: 8448f3c52ab2dbebbd7de55b7fe174277b9833b91876bd97bd803685b5eab3d39af589af93d180c8f0b4c136859d1892b3ab3b71838e74b478299533da7fa1f9
|
data/.rubocop.yml
CHANGED
@@ -1,14 +1,35 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.5
|
3
|
+
NewCops: enable
|
3
4
|
|
4
5
|
Metrics/MethodLength:
|
5
6
|
Max: 50
|
6
7
|
|
8
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
9
|
+
Enabled: true
|
10
|
+
|
7
11
|
Layout/LineLength:
|
8
12
|
Max: 100
|
9
13
|
|
14
|
+
Layout/SpaceAroundMethodCallOperator:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
Lint/ConstantDefinitionInBlock:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/**/*_spec.rb'
|
20
|
+
- 'spec/spec_helper.rb'
|
21
|
+
|
22
|
+
Lint/MissingSuper:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Lint/RaiseException:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
Lint/StructNewOverride:
|
29
|
+
Enabled: true
|
30
|
+
|
10
31
|
Metrics/ClassLength:
|
11
|
-
Max:
|
32
|
+
Max: 200
|
12
33
|
|
13
34
|
Metrics/ModuleLength:
|
14
35
|
Max: 175
|
@@ -16,9 +37,13 @@ Metrics/ModuleLength:
|
|
16
37
|
- 'lib/skull_island/helpers/resource.rb'
|
17
38
|
|
18
39
|
Metrics/CyclomaticComplexity:
|
19
|
-
Max:
|
40
|
+
Max: 8
|
41
|
+
|
42
|
+
Metrics/ParameterLists:
|
43
|
+
Max: 6
|
20
44
|
|
21
45
|
Metrics/PerceivedComplexity:
|
46
|
+
Max: 8
|
22
47
|
Exclude:
|
23
48
|
- 'lib/skull_island/cli.rb'
|
24
49
|
|
@@ -40,6 +65,24 @@ Security/Eval:
|
|
40
65
|
Exclude:
|
41
66
|
- 'lib/skull_island/cli.rb'
|
42
67
|
|
68
|
+
Style/ExponentialNotation:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
Style/HashEachMethods:
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
Style/HashTransformKeys:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
Style/HashTransformValues:
|
78
|
+
Enabled: false
|
79
|
+
|
43
80
|
Style/NumericLiterals:
|
44
81
|
Exclude:
|
45
82
|
- 'spec/**/*_spec.rb'
|
83
|
+
|
84
|
+
Style/OptionalBooleanParameter:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
Style/SlicingWithRange:
|
88
|
+
Enabled: true
|
data/.travis.yml
CHANGED
@@ -3,7 +3,8 @@ cache: bundler
|
|
3
3
|
rvm:
|
4
4
|
- 2.5
|
5
5
|
- 2.6
|
6
|
-
|
6
|
+
- 2.7
|
7
|
+
before_install: gem install bundler -v '~> 2.0'
|
7
8
|
deploy:
|
8
9
|
provider: rubygems
|
9
10
|
api_key:
|
@@ -11,4 +12,5 @@ deploy:
|
|
11
12
|
gem: skull_island
|
12
13
|
on:
|
13
14
|
tags: true
|
15
|
+
rvm: 2.6
|
14
16
|
repo: jgnagy/skull_island
|
data/Gemfile.lock
CHANGED
@@ -1,130 +1,148 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
skull_island (2.
|
4
|
+
skull_island (2.2.2)
|
5
5
|
deepsort (~> 0.4)
|
6
6
|
erubi (~> 1.8)
|
7
7
|
json (~> 2.1)
|
8
8
|
linguistics (~> 2.1)
|
9
9
|
rest-client (~> 2.1)
|
10
|
-
thor (~> 0
|
10
|
+
thor (~> 1.0)
|
11
11
|
will_paginate (~> 3.1)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
activesupport (5.2.4.4)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (>= 0.7, < 2)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
tzinfo (~> 1.1)
|
21
|
+
addressable (2.7.0)
|
22
|
+
public_suffix (>= 2.0.2, < 5.0)
|
23
|
+
ast (2.4.2)
|
24
|
+
concurrent-ruby (1.1.8)
|
19
25
|
coveralls (0.7.1)
|
20
26
|
multi_json (~> 1.3)
|
21
27
|
rest-client
|
22
28
|
simplecov (>= 0.7)
|
23
29
|
term-ansicolor
|
24
30
|
thor
|
25
|
-
deepsort (0.4.
|
26
|
-
diff-lcs (1.
|
27
|
-
docile (1.3.
|
31
|
+
deepsort (0.4.5)
|
32
|
+
diff-lcs (1.4.4)
|
33
|
+
docile (1.3.5)
|
28
34
|
domain_name (0.5.20190701)
|
29
35
|
unf (>= 0.0.5, < 1.0.0)
|
30
|
-
erubi (1.
|
31
|
-
|
32
|
-
|
33
|
-
faraday (0.17.3)
|
36
|
+
erubi (1.10.0)
|
37
|
+
faraday (1.3.0)
|
38
|
+
faraday-net_http (~> 1.0)
|
34
39
|
multipart-post (>= 1.2, < 3)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
ruby2_keywords
|
41
|
+
faraday-net_http (1.0.1)
|
42
|
+
faraday_middleware (1.0.0)
|
43
|
+
faraday (~> 1.0)
|
44
|
+
gh (0.18.0)
|
45
|
+
activesupport (~> 5.0)
|
46
|
+
addressable (~> 2.4)
|
47
|
+
faraday (~> 1.0)
|
48
|
+
faraday_middleware (~> 1.0)
|
42
49
|
multi_json (~> 1.0)
|
43
50
|
net-http-persistent (~> 2.9)
|
44
51
|
net-http-pipeline
|
45
|
-
highline (
|
52
|
+
highline (2.0.3)
|
46
53
|
http-accept (1.7.0)
|
47
54
|
http-cookie (1.0.3)
|
48
55
|
domain_name (~> 0.5)
|
49
|
-
|
50
|
-
|
56
|
+
i18n (1.8.7)
|
57
|
+
concurrent-ruby (~> 1.0)
|
58
|
+
json (2.5.1)
|
59
|
+
json_pure (2.5.1)
|
51
60
|
launchy (2.4.3)
|
52
61
|
addressable (~> 2.3)
|
53
62
|
linguistics (2.1.0)
|
54
63
|
loggability (~> 0.11)
|
55
|
-
loggability (0.
|
64
|
+
loggability (0.18.2)
|
56
65
|
mime-types (3.3.1)
|
57
66
|
mime-types-data (~> 3.2015)
|
58
|
-
mime-types-data (3.
|
59
|
-
|
67
|
+
mime-types-data (3.2020.1104)
|
68
|
+
minitest (5.14.3)
|
69
|
+
multi_json (1.15.0)
|
60
70
|
multipart-post (2.1.1)
|
61
71
|
net-http-persistent (2.9.4)
|
62
72
|
net-http-pipeline (1.0.1)
|
63
73
|
netrc (0.11.0)
|
64
|
-
parallel (1.
|
65
|
-
parser (
|
66
|
-
ast (~> 2.4.
|
74
|
+
parallel (1.20.1)
|
75
|
+
parser (3.0.0.0)
|
76
|
+
ast (~> 2.4.1)
|
77
|
+
public_suffix (4.0.6)
|
67
78
|
pusher-client (0.6.2)
|
68
79
|
json
|
69
80
|
websocket (~> 1.0)
|
70
81
|
rainbow (3.0.0)
|
71
|
-
rake (
|
82
|
+
rake (13.0.3)
|
83
|
+
regexp_parser (2.0.3)
|
72
84
|
rest-client (2.1.0)
|
73
85
|
http-accept (>= 1.7.0, < 2.0)
|
74
86
|
http-cookie (>= 1.0.2, < 2.0)
|
75
87
|
mime-types (>= 1.16, < 4.0)
|
76
88
|
netrc (~> 0.8)
|
77
89
|
rexml (3.2.4)
|
78
|
-
rspec (3.
|
79
|
-
rspec-core (~> 3.
|
80
|
-
rspec-expectations (~> 3.
|
81
|
-
rspec-mocks (~> 3.
|
82
|
-
rspec-core (3.
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-expectations (3.
|
90
|
+
rspec (3.10.0)
|
91
|
+
rspec-core (~> 3.10.0)
|
92
|
+
rspec-expectations (~> 3.10.0)
|
93
|
+
rspec-mocks (~> 3.10.0)
|
94
|
+
rspec-core (3.10.1)
|
95
|
+
rspec-support (~> 3.10.0)
|
96
|
+
rspec-expectations (3.10.1)
|
85
97
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-mocks (3.
|
98
|
+
rspec-support (~> 3.10.0)
|
99
|
+
rspec-mocks (3.10.1)
|
88
100
|
diff-lcs (>= 1.2.0, < 2.0)
|
89
|
-
rspec-support (~> 3.
|
90
|
-
rspec-support (3.
|
91
|
-
rubocop (0.
|
92
|
-
jaro_winkler (~> 1.5.1)
|
101
|
+
rspec-support (~> 3.10.0)
|
102
|
+
rspec-support (3.10.1)
|
103
|
+
rubocop (0.93.1)
|
93
104
|
parallel (~> 1.10)
|
94
|
-
parser (>= 2.7.
|
105
|
+
parser (>= 2.7.1.5)
|
95
106
|
rainbow (>= 2.2.2, < 4.0)
|
107
|
+
regexp_parser (>= 1.8)
|
96
108
|
rexml
|
109
|
+
rubocop-ast (>= 0.6.0)
|
97
110
|
ruby-progressbar (~> 1.7)
|
98
|
-
unicode-display_width (>= 1.4.0, <
|
99
|
-
|
100
|
-
|
111
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
112
|
+
rubocop-ast (1.4.1)
|
113
|
+
parser (>= 2.7.1.5)
|
114
|
+
ruby-progressbar (1.11.0)
|
115
|
+
ruby2_keywords (0.0.4)
|
116
|
+
simplecov (0.21.2)
|
101
117
|
docile (~> 1.1)
|
102
118
|
simplecov-html (~> 0.11)
|
103
|
-
|
119
|
+
simplecov_json_formatter (~> 0.1)
|
120
|
+
simplecov-html (0.12.3)
|
121
|
+
simplecov_json_formatter (0.1.2)
|
104
122
|
sync (0.5.0)
|
105
123
|
term-ansicolor (1.7.1)
|
106
124
|
tins (~> 1.0)
|
107
|
-
thor (
|
108
|
-
|
125
|
+
thor (1.1.0)
|
126
|
+
thread_safe (0.3.6)
|
127
|
+
tins (1.28.0)
|
109
128
|
sync
|
110
|
-
travis (1.
|
111
|
-
|
112
|
-
|
113
|
-
faraday_middleware (~> 0.9, >= 0.9.1)
|
129
|
+
travis (1.10.0)
|
130
|
+
faraday (~> 1.0)
|
131
|
+
faraday_middleware (~> 1.0)
|
114
132
|
gh (~> 0.13)
|
115
|
-
highline (~>
|
116
|
-
|
133
|
+
highline (~> 2.0)
|
134
|
+
json_pure (~> 2.3)
|
135
|
+
launchy (~> 2.1, < 2.5.0)
|
117
136
|
pusher-client (~> 0.4)
|
118
|
-
|
119
|
-
|
120
|
-
ethon (>= 0.8.0)
|
137
|
+
tzinfo (1.2.9)
|
138
|
+
thread_safe (~> 0.1)
|
121
139
|
unf (0.1.4)
|
122
140
|
unf_ext
|
123
|
-
unf_ext (0.0.7.
|
124
|
-
unicode-display_width (1.
|
125
|
-
websocket (1.2.
|
141
|
+
unf_ext (0.0.7.7)
|
142
|
+
unicode-display_width (1.7.0)
|
143
|
+
websocket (1.2.9)
|
126
144
|
will_paginate (3.3.0)
|
127
|
-
yard (0.9.
|
145
|
+
yard (0.9.26)
|
128
146
|
|
129
147
|
PLATFORMS
|
130
148
|
ruby
|
@@ -132,7 +150,7 @@ PLATFORMS
|
|
132
150
|
DEPENDENCIES
|
133
151
|
bundler (~> 2.0)
|
134
152
|
coveralls (~> 0.7)
|
135
|
-
rake (~>
|
153
|
+
rake (~> 13.0)
|
136
154
|
rspec (~> 3.0)
|
137
155
|
rubocop (~> 0.50)
|
138
156
|
simplecov (~> 0.17)
|
@@ -141,4 +159,4 @@ DEPENDENCIES
|
|
141
159
|
yard (~> 0.9.20)
|
142
160
|
|
143
161
|
BUNDLED WITH
|
144
|
-
2.
|
162
|
+
2.2.6
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Skull Island
|
2
2
|
|
3
|
-
A full-featured SDK for [Kong](https://konghq.com/kong/) 2.
|
3
|
+
A full-featured SDK for [Kong](https://konghq.com/kong/) 2.2.x (with support 2.0.x and 2.1.x, and for migrating from 0.14.x, 1.1.x, 1.2.x, 1.4.x, and 1.5.x). Note that this is unofficial (meaning this project is in no way officially endorsed, recommended, or related to Kong [as a company](https://konghq.com/) or an [open-source project](https://github.com/Kong/kong)). It is also in no way related to the [pet toy company](https://www.kongcompany.com/) by the same name (but hopefully that was obvious).
|
4
4
|
|
5
5
|
![Gem](https://img.shields.io/gem/v/skull_island)
|
6
6
|
![Travis (.org)](https://img.shields.io/travis/jgnagy/skull_island)
|
@@ -30,7 +30,7 @@ gem install skull_island
|
|
30
30
|
Or add this to your Gemfile:
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
gem 'skull_island', '~> 2.
|
33
|
+
gem 'skull_island', '~> 2.2'
|
34
34
|
```
|
35
35
|
|
36
36
|
Or add this to your .gemspec:
|
@@ -38,7 +38,7 @@ Or add this to your .gemspec:
|
|
38
38
|
```ruby
|
39
39
|
Gem::Specification.new do |spec|
|
40
40
|
# ...
|
41
|
-
spec.add_runtime_dependency 'skull_island', '~> 2.
|
41
|
+
spec.add_runtime_dependency 'skull_island', '~> 2.2'
|
42
42
|
# ...
|
43
43
|
end
|
44
44
|
```
|
@@ -149,7 +149,7 @@ When using the `project` feature of Skull Island, the CLI tool will automaticall
|
|
149
149
|
|
150
150
|
### Migrating
|
151
151
|
|
152
|
-
With Skull Island, it is possible to migrate a configuration from a 0.14.x, 1.1.x, 1.2.x, 1.4.x, or 1.5.x gateway to the most recent compatible gateway. If you have a previous export, you can just run `skull_island migrate /path/to/export.yml` and you'll receive a 2.
|
152
|
+
With Skull Island, it is possible to migrate a configuration from a 0.14.x, 1.1.x, 1.2.x, 1.4.x, or 1.5.x gateway to the most recent compatible gateway. If you have a previous export, you can just run `skull_island migrate /path/to/export.yml` and you'll receive a 2.2 compatible config on standard out. If you'd prefer, you can have that config written to a file as well (just like the export command) like so:
|
153
153
|
|
154
154
|
```sh
|
155
155
|
skull_island migrate /path/to/export.yml /output/location/migrated.yml
|
@@ -159,7 +159,7 @@ While this hasn't been heavily tested for all possible use-cases, any configurat
|
|
159
159
|
|
160
160
|
If you don't have a previous export, you'll need to install an older version of this gem using something like `gem install --version '~> 0.14' skull_island`, then perform an `export`, then you can switch back to the latest version of the gem for migrating and importing.
|
161
161
|
|
162
|
-
While it would be possible to make migration _automatic_ for the `import` command, `skull_island` intentionally doesn't do this to avoid the appearance that the config is losslessly compatible across versions. In reality, the newer config version has additional features (like tagging) that are used heavily by skull_island. It makes sense to this author to maintain the migration component and the normal functionality as distinct features to encourage the use of the newer capabilities in 1.1 and beyond. That said, Skull Island does allow 1.
|
162
|
+
While it would be possible to make migration _automatic_ for the `import` command, `skull_island` intentionally doesn't do this to avoid the appearance that the config is losslessly compatible across versions. In reality, the newer config version has additional features (like tagging) that are used heavily by skull_island. It makes sense to this author to maintain the migration component and the normal functionality as distinct features to encourage the use of the newer capabilities in 1.1 and beyond. That said, Skull Island does allow 1.x, 2.0.x, and 2.1.x version configurations to be applied to 2.2 gateways, but not the opposite.
|
163
163
|
|
164
164
|
### Reset A Gateway
|
165
165
|
|
@@ -188,7 +188,7 @@ If you're wondering what version of `skull_island` is installed, use:
|
|
188
188
|
```sh
|
189
189
|
$ skull_island version
|
190
190
|
|
191
|
-
SkullIsland Version: 2.
|
191
|
+
SkullIsland Version: 2.2.0
|
192
192
|
```
|
193
193
|
|
194
194
|
### File Format
|
@@ -197,7 +197,7 @@ The import/export/migrate CLI functions produce YAML with support for embedded R
|
|
197
197
|
|
198
198
|
```yaml
|
199
199
|
---
|
200
|
-
version: '2.
|
200
|
+
version: '2.2'
|
201
201
|
project: FooV2
|
202
202
|
certificates: []
|
203
203
|
ca_certificates:
|
@@ -398,7 +398,7 @@ service.routes.size
|
|
398
398
|
# => 4
|
399
399
|
```
|
400
400
|
|
401
|
-
From here, the SDK mostly wraps the attributes described in the [Kong API Docs](https://docs.konghq.com/2.
|
401
|
+
From here, the SDK mostly wraps the attributes described in the [Kong API Docs](https://docs.konghq.com/2.2.x/admin-api/). For simplicity, I'll go over the resource types and attributes this SDK supports manipulating. Rely on the API documentation to determine which attributes are required and under which conditions.
|
402
402
|
|
403
403
|
#### CA Certificates
|
404
404
|
|
@@ -419,6 +419,14 @@ resource.created_at
|
|
419
419
|
# => #<DateTime: 2018-07-17T12:51:28+00:00 ((2458317j,46288s,0n),+0s,2299161j)>
|
420
420
|
```
|
421
421
|
|
422
|
+
Skull Island includes support for adding a _virtual_ `name` attribute to CA Certificates (useful for maintaining them over time) based on a metadata tag that Skull Island will manage for you:
|
423
|
+
|
424
|
+
```ruby
|
425
|
+
resource.name = 'internalca'
|
426
|
+
resource.name
|
427
|
+
# => "internalca"
|
428
|
+
```
|
429
|
+
|
422
430
|
#### Certificates
|
423
431
|
|
424
432
|
```ruby
|
@@ -438,6 +446,14 @@ resource.created_at
|
|
438
446
|
# => #<DateTime: 2018-07-17T12:51:28+00:00 ((2458317j,46288s,0n),+0s,2299161j)>
|
439
447
|
```
|
440
448
|
|
449
|
+
Skull Island includes support for adding a _virtual_ `name` attribute to Certificates (useful for maintaining them over time) based on a metadata tag that Skull Island will manage for you:
|
450
|
+
|
451
|
+
```ruby
|
452
|
+
resource.name = 'apicert'
|
453
|
+
resource.name
|
454
|
+
# => "apicert"
|
455
|
+
```
|
456
|
+
|
441
457
|
#### Consumers (along with their Access Control Lists and Credentials)
|
442
458
|
|
443
459
|
Note that for Consumer credentials, only [`key-auth`](https://docs.konghq.com/hub/kong-inc/key-auth/), [`jwt`](https://docs.konghq.com/hub/kong-inc/jwt/), and [`basic-auth`](https://docs.konghq.com/hub/kong-inc/basic-auth/) are currently supported.
|
data/lib/skull_island/cli.rb
CHANGED
@@ -30,7 +30,7 @@ module SkullIsland
|
|
30
30
|
|
31
31
|
validate_server_version
|
32
32
|
|
33
|
-
output = { 'version' => '2.
|
33
|
+
output = { 'version' => '2.2' }
|
34
34
|
output['project'] = options['project'] if options['project']
|
35
35
|
|
36
36
|
[
|
@@ -43,7 +43,7 @@ module SkullIsland
|
|
43
43
|
].each { |clname| export_class(clname, output) }
|
44
44
|
|
45
45
|
if output_file == '-'
|
46
|
-
|
46
|
+
$stdout.puts output.to_yaml
|
47
47
|
else
|
48
48
|
File.write(full_filename, output.to_yaml)
|
49
49
|
end
|
@@ -96,7 +96,7 @@ module SkullIsland
|
|
96
96
|
|
97
97
|
if output_file == '-'
|
98
98
|
warn '[INFO] Outputting to STDOUT' if options['verbose']
|
99
|
-
|
99
|
+
$stdout.puts output.to_yaml
|
100
100
|
else
|
101
101
|
full_filename = File.expand_path(output_file)
|
102
102
|
dirname = File.dirname(full_filename)
|
@@ -175,7 +175,7 @@ module SkullIsland
|
|
175
175
|
def acquire_input(input_file, verbose = false)
|
176
176
|
if input_file == '-'
|
177
177
|
warn '[INFO] Reading from STDIN' if verbose
|
178
|
-
|
178
|
+
$stdin.read
|
179
179
|
else
|
180
180
|
full_filename = File.expand_path(input_file)
|
181
181
|
unless File.exist?(full_filename) && File.ftype(full_filename) == 'file'
|
@@ -191,7 +191,7 @@ module SkullIsland
|
|
191
191
|
end
|
192
192
|
|
193
193
|
def validate_config_version(version)
|
194
|
-
if version && ['1.1', '1.2', '1.4', '1.5', '2.0'].include?(version)
|
194
|
+
if version && ['1.1', '1.2', '1.4', '1.5', '2.0', '2.1', '2.2'].include?(version)
|
195
195
|
validate_server_version
|
196
196
|
elsif version && ['0.14', '1.0'].include?(version)
|
197
197
|
warn '[CRITICAL] Config version is too old. Try `migrate` instead of `import`.'
|
@@ -213,8 +213,12 @@ module SkullIsland
|
|
213
213
|
|
214
214
|
def validate_server_version
|
215
215
|
server_version = SkullIsland::APIClient.about_service['version']
|
216
|
-
|
216
|
+
case server_version
|
217
|
+
when /^2.[12]/
|
217
218
|
true
|
219
|
+
when /^2.0/
|
220
|
+
warn "[WARN] Older server version #{server_version} detected! " \
|
221
|
+
'You may encounter Service resource API exceptions.'
|
218
222
|
else
|
219
223
|
warn '[CRITICAL] Server version mismatch!'
|
220
224
|
exit 1
|