lono 4.0.2 → 4.0.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 +5 -0
- data/lib/lono/cli.rb +9 -8
- data/lib/lono/help/cfn/preview.md +1 -1
- data/lib/lono/help/cfn/update.md +27 -0
- data/lib/lono/help/completion.md +1 -1
- data/lib/lono/help/completion_script.md +1 -1
- data/lib/lono/help/import.md +30 -3
- data/lib/lono/help/summary.md +2 -2
- data/lib/lono/help/user_data.md +1 -1
- data/lib/lono/help/xgraph.md +2 -2
- data/lib/lono/importer.rb +0 -2
- data/lib/lono/template/helper.rb +5 -1
- data/lib/lono/version.rb +1 -1
- 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: 8ba5e18a4dfb8c1e380410585608cb85e2c99337337b99c4c65f507641286017
|
4
|
+
data.tar.gz: c98670aa02f8cae8b814cb10b0db1f4c250c82d5a4938d214e27694fba8efca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c03529f77875e6b7959c50cd7b8d5980829dbd4d9dbdab08972ca68b90a51d28f86184612853bf63c96fb2f30bf3e4723d526b7d0a81c8ca65c5901425ab80f2
|
7
|
+
data.tar.gz: 3b0e254cea2dce5f9f2b10157afb4262fadec5a6695ed66fc50127bed025cfc7d615c2879fdf3801edc8c63d7f6fb3f2ba79cff50cd571b96bb752587f62df23
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [4.0.3]
|
7
|
+
- update cli docs
|
8
|
+
- make `--name` option for lono import optional
|
9
|
+
- simplified template_params helper return structure
|
10
|
+
|
6
11
|
## [4.0.2]
|
7
12
|
- update cli docs
|
8
13
|
|
data/lib/lono/cli.rb
CHANGED
@@ -9,13 +9,14 @@ module Lono
|
|
9
9
|
|
10
10
|
desc "import SOURCE", "Imports CloudFormation template and lono-fies it."
|
11
11
|
long_desc Help.text(:import)
|
12
|
-
option :name,
|
12
|
+
option :name, default: nil, desc: "final name of downloaded template without extension"
|
13
|
+
option :casing, default: "dasherize", desc: "camelcase or dasherize the template name"
|
13
14
|
option :summary, default: true, type: :boolean, desc: "provide template summary after import"
|
14
15
|
def import(source)
|
15
16
|
Importer.new(source, options).run
|
16
17
|
end
|
17
18
|
|
18
|
-
desc "generate", "Generate both CloudFormation templates and parameters files"
|
19
|
+
desc "generate", "Generate both CloudFormation templates and parameters files."
|
19
20
|
long_desc Help.text(:generate)
|
20
21
|
option :clean, type: :boolean, default: true, desc: "remove all output files before generating"
|
21
22
|
option :quiet, type: :boolean, desc: "silence the output"
|
@@ -26,7 +27,7 @@ module Lono
|
|
26
27
|
Param::Generator.generate_all(options)
|
27
28
|
end
|
28
29
|
|
29
|
-
desc "user_data NAME", "Generates user_data script for debugging"
|
30
|
+
desc "user_data NAME", "Generates user_data script for debugging."
|
30
31
|
long_desc Help.text(:user_data)
|
31
32
|
option :clean, type: :boolean, default: true, desc: "remove all output/user_data files before generating"
|
32
33
|
def user_data(name)
|
@@ -34,13 +35,13 @@ module Lono
|
|
34
35
|
UserData.new(options.merge(name: name)).generate
|
35
36
|
end
|
36
37
|
|
37
|
-
desc "summary STACK", "Prints summary of CloudFormation template"
|
38
|
+
desc "summary STACK", "Prints summary of CloudFormation template."
|
38
39
|
long_desc Help.text("summary")
|
39
40
|
def summary(name)
|
40
41
|
Lono::Inspector::Summary.new(name, options).run
|
41
42
|
end
|
42
43
|
|
43
|
-
desc "xgraph STACK", "Graphs dependencies tree of CloudFormation template resources"
|
44
|
+
desc "xgraph STACK", "Graphs dependencies tree of CloudFormation template resources."
|
44
45
|
long_desc Help.text("xgraph")
|
45
46
|
option :display, type: :string, desc: "graph or text", default: "graph"
|
46
47
|
option :noop, type: :boolean, desc: "noop mode"
|
@@ -48,18 +49,18 @@ module Lono
|
|
48
49
|
Lono::Inspector::Graph.new(name, options).run
|
49
50
|
end
|
50
51
|
|
51
|
-
desc "clean", "
|
52
|
+
desc "clean", "Removes `output` folder."
|
52
53
|
def clean
|
53
54
|
Clean.new(options).run
|
54
55
|
end
|
55
56
|
|
56
|
-
desc "completion *PARAMS", "
|
57
|
+
desc "completion *PARAMS", "Prints words for auto-completion."
|
57
58
|
long_desc Help.text("completion")
|
58
59
|
def completion(*params)
|
59
60
|
Completer.new(CLI, *params).run
|
60
61
|
end
|
61
62
|
|
62
|
-
desc "completion_script", "
|
63
|
+
desc "completion_script", "Generates a script that can be eval to setup auto-completion."
|
63
64
|
long_desc Help.text("completion_script")
|
64
65
|
def completion_script
|
65
66
|
Completer::Script.generate
|
@@ -20,7 +20,7 @@ The preview includes colors:
|
|
20
20
|
|
21
21
|
<img src="/img/reference/lono-cfn-preview.png" alt="Stack Update" class="doc-photo">
|
22
22
|
|
23
|
-
|
23
|
+
There are two types of "diffs" in the preview.
|
24
24
|
|
25
25
|
1. Source code diff of the templates. This is generated by downloading the current CloudFormation template and comparing it with the locally generated one using `colordiff`.
|
26
26
|
2. CloudFormation Change Set list of changes. This is generated using [AWS CloudFormation Change Set](https://medium.com/boltops/a-simple-introduction-to-cloudformation-part-4-change-sets-dry-run-mode-c14e41dfeab7) feature.
|
data/lib/lono/help/cfn/update.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
## Examples
|
2
2
|
|
3
|
+
Let's say we make a simple change to a template, like changing the default InstanceType from `t2.small` to `t2.micro`. Here's what happens when you run `lono cfn update`
|
4
|
+
|
5
|
+
```sh
|
6
|
+
lono cfn update ec2
|
7
|
+
```
|
8
|
+
|
9
|
+
The output should look similiar to this:
|
10
|
+
|
11
|
+
<img src="/img/tutorials/ec2/cfn-update-instance-type.png" alt="Stack Update" class="doc-photo">
|
12
|
+
|
13
|
+
Notice that before the update gets performed lono provides a preview of the changes that are about to take place. There are two types of "diffs" in the preview.
|
14
|
+
|
15
|
+
1. Source code diff of the templates. This is generated by downloading the current CloudFormation template and comparing it with the locally generated one using `colordiff`.
|
16
|
+
2. CloudFormation Change Set list of changes. This is generated using [AWS CloudFormation Change Set](https://medium.com/boltops/a-simple-introduction-to-cloudformation-part-4-change-sets-dry-run-mode-c14e41dfeab7) feature.
|
17
|
+
|
18
|
+
You are prompted with an "Are you sure?" confirmation before lono continues.
|
19
|
+
|
20
|
+
By default, the update command will display a preview of the stack changes before applying the update and prompt to check if you are sure. If you want to bypass the are you sure prompt, use the `--sure` option.
|
21
|
+
|
22
|
+
```
|
23
|
+
lono cfn update ec2 --sure
|
24
|
+
```
|
25
|
+
|
26
|
+
## Conventions: template and param
|
27
|
+
|
28
|
+
Lono follows some [coventions](http://lono.cloud/docs/conventions/) that helps keep the commands short. We'll go through an example to explain:
|
29
|
+
|
3
30
|
Provided that you are in a lono project and have a `my-stack` lono template definition. To update a stack you can simply run:
|
4
31
|
|
5
32
|
lono cfn update my-stack
|
data/lib/lono/help/completion.md
CHANGED
data/lib/lono/help/import.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
## Examples
|
2
2
|
|
3
|
-
lono import /path/to/file
|
4
|
-
lono import http://url.com/path/to/template.json
|
5
|
-
lono import http://url.com/path/to/template.yml
|
3
|
+
lono import /path/to/file --name my-stack
|
4
|
+
lono import http://url.com/path/to/template.json --name my-stack
|
5
|
+
lono import http://url.com/path/to/template.yml --name my-stack
|
6
6
|
|
7
7
|
## Example Output
|
8
8
|
|
@@ -25,3 +25,30 @@
|
|
25
25
|
Here are contents of the params config/params/base/ec2.txt file:
|
26
26
|
KeyName=
|
27
27
|
#InstanceType= # optional
|
28
|
+
|
29
|
+
### Template name: CamelCase or dasherize
|
30
|
+
|
31
|
+
If you do not specify the `--name` option, `lono import` sets a name based on the filename of the imported file. It converts the name to a dasherize version of the filename by default.
|
32
|
+
|
33
|
+
You can specify whether or not to CamelCase or dasherize the name of the final template file with the `--casing` option. Examples:
|
34
|
+
|
35
|
+
Dasherize:
|
36
|
+
|
37
|
+
```sh
|
38
|
+
lono import https://s3.amazonaws.com/cloudformation-templates-us-east-1/EC2InstanceWithSecurityGroupSample.template --casing dasherize
|
39
|
+
```
|
40
|
+
|
41
|
+
CamelCase:
|
42
|
+
|
43
|
+
```sh
|
44
|
+
lono import https://s3.amazonaws.com/cloudformation-templates-us-east-1/EC2InstanceWithSecurityGroupSample.template --casing camelcase
|
45
|
+
```
|
46
|
+
|
47
|
+
The default is dasherize.
|
48
|
+
|
49
|
+
Question: You might be wondering, why does lono import has dasherize vs underscore?
|
50
|
+
|
51
|
+
Answer: I prefer filenames to be underscore. However, CloudFormation stack names do not allow underscores in their naming, so it is encourage to either dasherize or camelize your template names so the stack name and the template name can be the same.
|
52
|
+
|
53
|
+
This blog post [Introducing the lono import Command](https://blog.boltops.com/2017/09/15/introducing-the-lono-import-command) also covers `lono import`.
|
54
|
+
|
data/lib/lono/help/summary.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
The `lono summary` command helps you quickly understand a CloudFormation template.
|
2
2
|
|
3
3
|
## Examples
|
4
4
|
|
@@ -16,4 +16,4 @@ Lono inspect is provides commands to help you quickly understand a CloudFormatio
|
|
16
16
|
2 Total
|
17
17
|
$
|
18
18
|
|
19
|
-
Blog Post also covers this: [lono
|
19
|
+
Blog Post also covers this: [lono summary Tutorial Introduction](https://blog.boltops.com/2017/09/18/lono-inspect-summary-tutorial-introduction)
|
data/lib/lono/help/user_data.md
CHANGED
data/lib/lono/help/xgraph.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
## Example
|
2
2
|
|
3
|
-
With more complex CloudFormation templates, the dependency get
|
3
|
+
With more complex CloudFormation templates, the dependency can get difficult to follow. Visualizing the dependencies is helpful.
|
4
4
|
|
5
5
|
lono import https://s3.amazonaws.com/solutions-reference/aws-waf-security-automations/latest/aws-waf-security-automations.template --name waf
|
6
|
-
lono
|
6
|
+
lono xgraph waf
|
7
7
|
|
8
8
|
This above command generates a dependency chart. The command uses the DependsOn attribute specified in each resource to figure this out. It does not show implied dependencies that CloudFormaton automatically computes for us. The chart looks like this:
|
9
9
|
|
data/lib/lono/importer.rb
CHANGED
@@ -104,8 +104,6 @@ class Lono::Importer
|
|
104
104
|
def template_name
|
105
105
|
return @options[:name] if @options[:name]
|
106
106
|
# Else infer name from the original source.
|
107
|
-
# Not really being used since --name is now required but leaving in place
|
108
|
-
# in case we decide to make --name optional again
|
109
107
|
name = File.basename(@source, ".*")
|
110
108
|
@options[:casing] == "camelcase" ? name.camelize : name.underscore.dasherize
|
111
109
|
end
|
data/lib/lono/template/helper.rb
CHANGED
@@ -69,7 +69,11 @@ BASH_CODE
|
|
69
69
|
}.merge(@options)
|
70
70
|
generator = Lono::Param::Generator.new(param_name, generator_options)
|
71
71
|
# do not generate because lono cfn calling logic already generated it we only need the values
|
72
|
-
generator.params # Returns Array in underscore keys format
|
72
|
+
params = generator.params # Returns Array in underscore keys format
|
73
|
+
# convert Array to simplified hash structure
|
74
|
+
params.inject({}) do |h, param|
|
75
|
+
h.merge(param[:parameter_key] => param[:parameter_value])
|
76
|
+
end
|
73
77
|
end
|
74
78
|
|
75
79
|
# Adjust the partial path so that it will use app/user_data
|
data/lib/lono/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|