Skip to content

Commit b6c37e6

Browse files
authored
Merge pull request #71 from jgnagy/feature/preprocess-rendering
Adding render option to apply preprocessing
2 parents 1a410a1 + 7ba8a8c commit b6c37e6

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
skull_island (2.3.3)
4+
skull_island (2.3.4)
55
deepsort (~> 0.4)
66
erubi (~> 1.8)
77
linguistics (~> 2.1)

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Commands:
5656
skull_island help [COMMAND] # Describe available commands or one specific command
5757
skull_island import [OPTIONS] [INPUT|-] # Import a configuration from INPUT
5858
skull_island migrate [OPTIONS] [INPUT|-] [OUTPUT|-] # Migrate an older config from INPUT to OUTPUT
59+
skull_island render [INPUT|-] # Render out preprocessed YAML for troubleshooting
5960
skull_island reset # Fully reset a gateway (removing all config)
6061
skull_island version # Display the current installed version of skull_island
6162

@@ -149,6 +150,16 @@ To use this functionality, either add the `project` key to your configuration fi
149150

150151
When using the `project` feature of Skull Island, the CLI tool will automatically clean up old resources no longer found in your config file. This is, in fact, the _only_ circumstance under which this tool actually removes resources. Use this feature with care, as it can delete large swaths of your configuration if used incorrectly. It is **critical** that this value is unique since this project functionality is used to delete resources.
151152

153+
#### Troubleshooting Import Failures
154+
155+
If you're having trouble importing some YAML -- especially if you've done a lot of templating or have a lot of embedded ruby in your template -- you can use the `render` command to just output the raw, preprocessed YAML that Skull Island would attempt to import:
156+
157+
```sh
158+
skull_island render /path/to/some/template.yml
159+
```
160+
161+
This is safe to do on your local machine since it doesn't connect to a gateway. It will leave `lookup` functions but otherwise will leave the YAML without embedded ruby. This can then be linted with any YAML linter to help discover YAML-related formatting issues, etc., that cause import issues.
162+
152163
### Migrating
153164

154165
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.3 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:

lib/skull_island/cli.rb

+6
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ def reset
132132
].each { |clname| reset_class(clname, options['project']) }
133133
end
134134

135+
desc('render [INPUT|-]', 'Render out preprocessed YAML for troubleshooting')
136+
def render(input_file = '-')
137+
raw ||= acquire_input(input_file, options['verbose'])
138+
puts erb_preprocess(raw)
139+
end
140+
135141
desc('version', 'Display the current installed version of skull_island')
136142
def version
137143
puts "SkullIsland Version: #{SkullIsland::VERSION}"

lib/skull_island/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ module SkullIsland
44
VERSION = [
55
2, # Major
66
3, # Minor
7-
3 # Patch
7+
4 # Patch
88
].join('.')
99
end

0 commit comments

Comments
 (0)