lono 6.1.11 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/acceptance.sh +19 -3
- data/.gitignore +2 -2
- data/CHANGELOG.md +16 -1
- data/README.md +18 -20
- data/Rakefile +1 -0
- data/lib/lono.rb +7 -5
- data/lib/lono/abstract_base.rb +25 -0
- data/lib/lono/api/client.rb +30 -0
- data/lib/lono/api/proxy.rb +58 -0
- data/lib/lono/api/repos.rb +8 -0
- data/lib/lono/api/verify.rb +13 -0
- data/lib/lono/app_file/base.rb +4 -11
- data/lib/lono/app_file/build.rb +1 -1
- data/lib/lono/app_file/upload.rb +1 -4
- data/lib/lono/autoloader.rb +3 -1
- data/lib/lono/aws_services.rb +9 -9
- data/lib/lono/aws_services/helper.rb +14 -0
- data/lib/lono/aws_services/{util.rb → stack.rb} +1 -9
- data/lib/lono/aws_services/stack_set.rb +41 -0
- data/lib/lono/blueprint.rb +2 -2
- data/lib/lono/blueprint/configset/loader.rb +7 -0
- data/lib/lono/blueprint/helper.rb +8 -2
- data/lib/lono/blueprint/meta.rb +4 -12
- data/lib/lono/blueprint/new.rb +3 -3
- data/lib/lono/blueprint/root.rb +6 -26
- data/lib/lono/bundle.rb +54 -0
- data/lib/lono/cfn.rb +31 -75
- data/lib/lono/cfn/base.rb +39 -136
- data/lib/lono/cfn/cancel.rb +14 -9
- data/lib/lono/cfn/create.rb +15 -19
- data/lib/lono/cfn/delete.rb +9 -9
- data/lib/lono/cfn/deploy.rb +4 -4
- data/lib/lono/cfn/download.rb +27 -9
- data/lib/lono/cfn/opts.rb +80 -0
- data/lib/lono/cfn/preview/changeset.rb +23 -23
- data/lib/lono/cfn/preview/codediff.rb +5 -6
- data/lib/lono/cfn/preview/param.rb +10 -10
- data/lib/lono/cfn/rollback.rb +5 -5
- data/lib/lono/cfn/status.rb +0 -10
- data/lib/lono/cfn/update.rb +22 -27
- data/lib/lono/clean.rb +3 -3
- data/lib/lono/cli.rb +69 -34
- data/lib/lono/code.rb +22 -0
- data/lib/lono/command.rb +7 -0
- data/lib/lono/config_location.rb +6 -13
- data/lib/lono/configset.rb +9 -0
- data/lib/lono/configset/combiner.rb +128 -0
- data/lib/lono/configset/evaluate_file.rb +8 -0
- data/lib/lono/configset/list.rb +67 -0
- data/lib/lono/configset/loader.rb +98 -0
- data/lib/lono/configset/loader/dsl.rb +9 -0
- data/lib/lono/configset/materializer/final.rb +10 -0
- data/lib/lono/configset/materializer/gems_builder.rb +81 -0
- data/lib/lono/configset/materializer/jade.rb +15 -0
- data/lib/lono/configset/materializer/source.rb +54 -0
- data/lib/lono/configset/meta.rb +19 -0
- data/lib/lono/configset/meta/dsl.rb +12 -0
- data/lib/lono/configset/new.rb +84 -0
- data/lib/lono/configset/preparer.rb +44 -0
- data/lib/lono/configset/register/base.rb +121 -0
- data/lib/lono/configset/register/blueprint.rb +16 -0
- data/lib/lono/configset/register/dsl.rb +15 -0
- data/lib/lono/configset/register/project.rb +12 -0
- data/lib/lono/configset/registry.rb +34 -0
- data/lib/lono/configset/resolver.rb +42 -0
- data/lib/lono/conventions.rb +18 -7
- data/lib/lono/core.rb +16 -20
- data/lib/lono/default/settings.yml +2 -3
- data/lib/lono/ext/bundler.rb +7 -0
- data/lib/lono/file_uploader.rb +8 -5
- data/lib/lono/finder/base.rb +140 -0
- data/lib/lono/finder/blueprint.rb +11 -0
- data/lib/lono/finder/blueprint/configset.rb +17 -0
- data/lib/lono/finder/configset.rb +11 -0
- data/lib/lono/generate.rb +93 -0
- data/lib/lono/help/blueprint/new.md +0 -1
- data/lib/lono/help/cfn/delete.md +1 -1
- data/lib/lono/help/cfn/deploy.md +5 -76
- data/lib/lono/help/cfn/status.md +0 -4
- data/lib/lono/help/cfn/update.md +1 -1
- data/lib/lono/help/code/convert.md +51 -0
- data/lib/lono/help/code/import.md +30 -0
- data/lib/lono/help/configsets.md +24 -0
- data/lib/lono/help/generate.md +4 -4
- data/lib/lono/help/new.md +1 -2
- data/lib/lono/help/sets/delete.md +8 -0
- data/lib/lono/help/sets/deploy.md +76 -0
- data/lib/lono/help/sets/instances/delete.md +21 -0
- data/lib/lono/help/sets/instances/list.md +14 -0
- data/lib/lono/help/sets/instances/status.md +15 -0
- data/lib/lono/help/sets/instances/sync.md +88 -0
- data/lib/lono/help/sets/status.md +23 -0
- data/lib/lono/help/upgrade.md +1 -0
- data/lib/lono/importer.rb +22 -0
- data/lib/lono/importer/base.rb +59 -0
- data/lib/lono/importer/converter.rb +19 -0
- data/lib/lono/importer/download.rb +46 -0
- data/lib/lono/importer/dsl.rb +36 -0
- data/lib/lono/importer/erb.rb +31 -0
- data/lib/lono/importer/params.rb +56 -0
- data/lib/lono/importer/service/coder.rb +81 -0
- data/lib/lono/inspector/base.rb +12 -22
- data/lib/lono/inspector/graph.rb +1 -1
- data/lib/lono/inspector/summary.rb +41 -17
- data/lib/lono/jade.rb +103 -0
- data/lib/lono/jade/circular.rb +26 -0
- data/lib/lono/jadespec.rb +41 -0
- data/lib/lono/new.rb +2 -2
- data/lib/lono/opts.rb +43 -0
- data/lib/lono/output/template.rb +48 -0
- data/lib/lono/param.rb +3 -5
- data/lib/lono/param/generator.rb +13 -33
- data/lib/lono/pro.rb +15 -0
- data/lib/lono/pro/base.rb +16 -0
- data/lib/lono/pro/repo.rb +27 -0
- data/lib/lono/project_checker.rb +4 -29
- data/lib/lono/registration.rb +15 -0
- data/lib/lono/registration/base.rb +37 -0
- data/lib/lono/registration/check.rb +15 -0
- data/lib/lono/registration/temp.rb +60 -0
- data/lib/lono/registration/user.rb +54 -0
- data/lib/lono/script/base.rb +1 -10
- data/lib/lono/script/upload.rb +2 -12
- data/lib/lono/seed.rb +2 -11
- data/lib/lono/seed/base.rb +55 -110
- data/lib/lono/sets.rb +38 -0
- data/lib/lono/sets/base.rb +45 -0
- data/lib/lono/sets/create.rb +30 -0
- data/lib/lono/sets/delete.rb +47 -0
- data/lib/lono/sets/deploy.rb +11 -0
- data/lib/lono/sets/instances.rb +33 -0
- data/lib/lono/sets/instances/base.rb +30 -0
- data/lib/lono/sets/instances/delete.rb +69 -0
- data/lib/lono/sets/instances/list.rb +13 -0
- data/lib/lono/sets/instances/opts.rb +29 -0
- data/lib/lono/sets/instances/status.rb +12 -0
- data/lib/lono/sets/instances/sync.rb +182 -0
- data/lib/lono/sets/list.rb +35 -0
- data/lib/lono/sets/opts.rb +18 -0
- data/lib/lono/sets/preview/codediff.rb +35 -0
- data/lib/lono/sets/preview/param.rb +32 -0
- data/lib/lono/sets/status.rb +116 -0
- data/lib/lono/sets/status/instance.rb +20 -0
- data/lib/lono/sets/status/instance/base.rb +120 -0
- data/lib/lono/sets/status/instance/completed.rb +35 -0
- data/lib/lono/sets/status/instance/deleted.rb +32 -0
- data/lib/lono/sets/status/instance/show.rb +7 -0
- data/lib/lono/sets/status/instances.rb +111 -0
- data/lib/lono/sets/summarize.rb +20 -0
- data/lib/lono/sets/time_spent.rb +11 -0
- data/lib/lono/sets/update.rb +81 -0
- data/lib/lono/template.rb +5 -7
- data/lib/lono/template/configset_injector.rb +50 -0
- data/lib/lono/template/context.rb +4 -4
- data/lib/lono/template/context/loader.rb +4 -16
- data/lib/lono/template/evaluate.rb +2 -1
- data/lib/lono/template/generator.rb +17 -15
- data/lib/lono/template/helper.rb +7 -7
- data/lib/lono/template/post_processor.rb +2 -12
- data/lib/lono/template/strategy/base.rb +4 -0
- data/lib/lono/template/{dsl.rb → strategy/dsl.rb} +4 -6
- data/lib/lono/template/{dsl → strategy/dsl}/builder.rb +11 -15
- data/lib/lono/template/{dsl → strategy/dsl}/builder/fn.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/helpers.rb +11 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/core_helper.rb +14 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb +48 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/lookup_helper.rb +27 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/s3_helper.rb +13 -0
- data/lib/lono/template/strategy/dsl/builder/helpers/tags_helper.rb +39 -0
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/base.rb +6 -17
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/condition.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/section/extensions.rb +9 -0
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/mapping.rb +1 -1
- data/lib/lono/template/{dsl/builder/section_methods.rb → strategy/dsl/builder/section/methods.rb} +9 -2
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/output.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/section/parameter.rb +69 -0
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/resource.rb +1 -1
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/resource/property_mover.rb +1 -1
- data/lib/lono/template/{dsl/builder → strategy/dsl/builder/section}/section.rb +1 -1
- data/lib/lono/template/{dsl → strategy/dsl}/builder/squeezer.rb +1 -1
- data/lib/lono/template/strategy/dsl/builder/stringify.rb +15 -0
- data/lib/lono/template/{dsl → strategy/dsl}/builder/syntax.rb +3 -2
- data/lib/lono/template/strategy/dsl/finalizer.rb +12 -0
- data/lib/lono/template/strategy/dsl/finalizer/parameter_groups.rb +56 -0
- data/lib/lono/template/{erb.rb → strategy/erb.rb} +5 -5
- data/lib/lono/template/strategy/source.rb +8 -0
- data/lib/lono/template/template.rb +1 -1
- data/lib/lono/template/upload.rb +4 -9
- data/lib/lono/template/util.rb +0 -40
- data/lib/lono/upgrade.rb +12 -10
- data/lib/lono/user_data.rb +4 -4
- data/lib/lono/utils/pretty_time.rb +14 -0
- data/lib/lono/utils/sure.rb +23 -0
- data/lib/lono/version.rb +1 -1
- data/lib/lono/yamler/loader.rb +52 -0
- data/lib/lono/yamler/validator.rb +51 -0
- data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +4 -0
- data/lib/templates/blueprint/README.md.tt +1 -1
- data/lib/templates/blueprint/seed/configs.rb +2 -2
- data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +17 -18
- data/lib/templates/blueprint_types/erb/app/templates/%blueprint_name%.yml +63 -4
- data/lib/templates/configset/%configset_name%.gemspec.tt +41 -0
- data/lib/templates/configset/.gitignore +11 -0
- data/lib/templates/configset/CHANGELOG.md +7 -0
- data/lib/templates/configset/Gemfile +4 -0
- data/lib/templates/configset/README.md.tt +3 -0
- data/lib/templates/configset/Rakefile.tt +9 -0
- data/lib/templates/configset/lib/configset.yml +20 -0
- data/lib/templates/skeleton/.gitignore +1 -0
- data/lib/templates/skeleton/Gemfile +0 -1
- data/lib/templates/skeleton/README.md +4 -4
- data/lib/templates/skeleton/configs/settings.yml +1 -1
- data/lono.gemspec +1 -4
- metadata +146 -79
- data/Guardfile +0 -19
- data/lib/lono/app_file.rb +0 -5
- data/lib/lono/blueprint/find.rb +0 -90
- data/lib/lono/blueprint/info.rb +0 -10
- data/lib/lono/blueprint/list.rb +0 -14
- data/lib/lono/cfn/current.rb +0 -95
- data/lib/lono/cfn/preview.rb +0 -4
- data/lib/lono/cfn/suffix.rb +0 -67
- data/lib/lono/cfn/util.rb +0 -27
- data/lib/lono/help/cfn/current.md +0 -18
- data/lib/lono/help/upgrade4.md +0 -25
- data/lib/lono/inspector.rb +0 -4
- data/lib/lono/output_template.rb +0 -35
- data/lib/lono/template/base.rb +0 -13
- data/lib/lono/template/dsl/builder/helpers.rb +0 -8
- data/lib/lono/template/dsl/builder/helpers/core_helper.rb +0 -107
- data/lib/lono/template/dsl/builder/helpers/param_helper.rb +0 -61
- data/lib/lono/template/dsl/builder/parameter.rb +0 -39
- data/lib/lono/upgrade/upgrade4.rb +0 -175
- data/lib/lono/upgrade/upgrade42.rb +0 -36
- data/lib/lono/upgrade/upgrade5.rb +0 -55
- data/lib/templates/blueprint/.meta/config.yml.tt +0 -4
- data/lib/templates/skeleton/Guardfile +0 -12
- data/lib/templates/upgrade5/blueprints/main/.lono/config.yml +0 -3
- data/lib/templates/upgrade5/blueprints/main/.meta/config.yml +0 -3
@@ -0,0 +1,21 @@
|
|
1
|
+
## Example
|
2
|
+
|
3
|
+
$ lono sets instances delete my-set --accounts 112233445566 --regions us-west-1 us-west-2
|
4
|
+
Are you sure you want to delete the my-set instances?
|
5
|
+
These stack instances will be deleted:
|
6
|
+
|
7
|
+
accounts: 112233445566
|
8
|
+
regions: us-west-1,us-west-2
|
9
|
+
|
10
|
+
|
11
|
+
Are you sure? (y/N) y
|
12
|
+
Stack Instance statuses... (takes a while)
|
13
|
+
Stack Instance: account 112233445566 region us-west-1 status CURRENT
|
14
|
+
Stack Instance: account 112233445566 region us-west-2 status CURRENT
|
15
|
+
Stack Instance: account 112233445566 region us-west-2 status OUTDATED reason User initiated operation
|
16
|
+
Stack Instance: account 112233445566 region us-west-1 status OUTDATED reason User initiated operation
|
17
|
+
Stack Instance: account 112233445566 region us-west-1 status DELETED
|
18
|
+
Stack Instance: account 112233445566 region us-west-2 status DELETED
|
19
|
+
Time took to complete stack set operation: 30s
|
20
|
+
Stack set operation completed.
|
21
|
+
$
|
@@ -0,0 +1,14 @@
|
|
1
|
+
## Example
|
2
|
+
|
3
|
+
$ lono sets instances list my-set
|
4
|
+
Stack Instance: account 112233445566 region ap-northeast-1 status CURRENT
|
5
|
+
Stack Instance: account 223344556677 region us-west-1 status CURRENT
|
6
|
+
Stack Instance: account 223344556677 region ap-northeast-1 status CURRENT
|
7
|
+
Stack Instance: account 223344556677 region us-west-2 status CURRENT
|
8
|
+
Stack Instance: account 223344556677 region ap-northeast-2 status CURRENT
|
9
|
+
Stack Instance: account 112233445566 region ap-northeast-2 status CURRENT
|
10
|
+
Stack Instance: account 112233445566 region us-west-2 status CURRENT
|
11
|
+
Stack Instance: account 112233445566 region us-west-1 status CURRENT
|
12
|
+
Time took to complete stack set operation: 4m 29s
|
13
|
+
Stack set operation completed.
|
14
|
+
$
|
@@ -0,0 +1,15 @@
|
|
1
|
+
## Example
|
2
|
+
|
3
|
+
$ lono sets instances status my-set
|
4
|
+
Stack Instance statuses... (takes a while)
|
5
|
+
Stack Instance: account 112233445566 region ap-northeast-1 status CURRENT
|
6
|
+
Stack Instance: account 112233445566 region us-west-1 status CURRENT
|
7
|
+
Stack Instance: account 112233445566 region us-west-2 status CURRENT
|
8
|
+
Stack Instance: account 112233445566 region ap-northeast-2 status CURRENT
|
9
|
+
Stack Instance: account 223344556677 region us-west-2 status CURRENT
|
10
|
+
Stack Instance: account 223344556677 region ap-northeast-2 status CURRENT
|
11
|
+
Stack Instance: account 223344556677 region us-west-1 status CURRENT
|
12
|
+
Stack Instance: account 223344556677 region ap-northeast-1 status CURRENT
|
13
|
+
Time took to complete stack set operation: 4m 29s
|
14
|
+
Stack set operation completed.
|
15
|
+
$
|
@@ -0,0 +1,88 @@
|
|
1
|
+
Provided:
|
2
|
+
|
3
|
+
configs/demo/accounts/development/my-set.txt
|
4
|
+
|
5
|
+
112233445566
|
6
|
+
223344556677
|
7
|
+
|
8
|
+
configs/demo/regions/development/my-set.txt
|
9
|
+
|
10
|
+
us-east-1
|
11
|
+
us-east-2
|
12
|
+
us-west-1
|
13
|
+
us-west-2
|
14
|
+
|
15
|
+
And then we update:
|
16
|
+
|
17
|
+
configs/demo/regions/development/my-set.txt
|
18
|
+
|
19
|
+
us-west-1
|
20
|
+
us-west-2
|
21
|
+
ap-northeast-1
|
22
|
+
ap-northeast-2
|
23
|
+
|
24
|
+
Running `lono sets instances sync` will delete and add the stack instances accordingly.
|
25
|
+
|
26
|
+
$ lono sets instances sync my-set --blueprint demo
|
27
|
+
Using regions for development: configs/demo/regions/development/my-set.sh
|
28
|
+
Using accounts for development: configs/demo/accounts/development/my-set.sh
|
29
|
+
Are you sure you want to sync stack instances?
|
30
|
+
lono will run:
|
31
|
+
create_stack_instances for:
|
32
|
+
accounts: 112233445566,223344556677
|
33
|
+
regions: ap-northeast-1,ap-northeast-2
|
34
|
+
|
35
|
+
Number of stack instances to be created: 4
|
36
|
+
delete_stack_instances for:
|
37
|
+
accounts: 112233445566,223344556677
|
38
|
+
regions: us-east-1,us-east-2
|
39
|
+
|
40
|
+
Number of stack instances to be deleted: 4
|
41
|
+
|
42
|
+
Are you sure? (y/N) y
|
43
|
+
=> Running create_stack_instances on:
|
44
|
+
accounts: 112233445566,223344556677
|
45
|
+
regions: ap-northeast-1,ap-northeast-2
|
46
|
+
Stack Instance statuses... (takes a while)
|
47
|
+
2019-12-19 10:59:07 PM Stack Instance: account 112233445566 region ap-northeast-1 status OUTDATED reason User initiated operation
|
48
|
+
2019-12-19 10:59:07 PM Stack Instance: account 223344556677 region ap-northeast-1 status OUTDATED reason User initiated operation
|
49
|
+
2019-12-19 10:59:07 PM Stack Instance: account 223344556677 region ap-northeast-2 status OUTDATED reason User initiated operation
|
50
|
+
2019-12-19 10:59:07 PM Stack Instance: account 112233445566 region ap-northeast-2 status OUTDATED reason User initiated operation
|
51
|
+
2019-12-19 10:59:17 PM Stack Instance: account 112233445566 region ap-northeast-1 status OUTDATED reason User Initiated
|
52
|
+
2019-12-19 10:59:26 PM Stack Instance: account 112233445566 region ap-northeast-1 status CURRENT
|
53
|
+
2019-12-19 10:59:40 PM Stack Instance: account 223344556677 region ap-northeast-1 status OUTDATED reason User Initiated
|
54
|
+
2019-12-19 10:59:49 PM Stack Instance: account 223344556677 region ap-northeast-1 status CURRENT
|
55
|
+
2019-12-19 11:00:04 PM Stack Instance: account 112233445566 region ap-northeast-2 status OUTDATED reason User Initiated
|
56
|
+
2019-12-19 11:00:17 PM Stack Instance: account 112233445566 region ap-northeast-2 status CURRENT
|
57
|
+
2019-12-19 11:00:27 PM Stack Instance: account 223344556677 region ap-northeast-2 status OUTDATED reason User Initiated
|
58
|
+
Time took to complete stack set operation: 1m 40s
|
59
|
+
Stack set operation completed.
|
60
|
+
Stack Set Operation Summary:
|
61
|
+
account 112233445566 region ap-northeast-2 status SUCCEEDED
|
62
|
+
account 112233445566 region ap-northeast-1 status SUCCEEDED
|
63
|
+
account 223344556677 region ap-northeast-2 status SUCCEEDED
|
64
|
+
account 223344556677 region ap-northeast-1 status SUCCEEDED
|
65
|
+
=> Running delete_stack_instances on:
|
66
|
+
accounts: 112233445566,223344556677
|
67
|
+
regions: us-east-1,us-east-2
|
68
|
+
Stack Instance statuses... (takes a while)
|
69
|
+
2019-12-19 11:00:40 PM Stack Instance: account 112233445566 region us-east-2 status CURRENT
|
70
|
+
2019-12-19 11:00:40 PM Stack Instance: account 112233445566 region us-east-1 status CURRENT
|
71
|
+
2019-12-19 11:00:40 PM Stack Instance: account 223344556677 region us-east-2 status CURRENT
|
72
|
+
2019-12-19 11:00:40 PM Stack Instance: account 223344556677 region us-east-1 status CURRENT
|
73
|
+
2019-12-19 11:00:40 PM Stack Instance: account 223344556677 region us-east-1 status OUTDATED reason User initiated operation
|
74
|
+
2019-12-19 11:00:41 PM Stack Instance: account 223344556677 region ap-northeast-2 status CURRENT
|
75
|
+
2019-12-19 11:00:44 PM Stack Instance: account 112233445566 region us-east-2 status OUTDATED reason User initiated operation
|
76
|
+
2019-12-19 11:00:45 PM Stack Instance: account 112233445566 region us-east-1 status OUTDATED reason User initiated operation
|
77
|
+
2019-12-19 11:00:45 PM Stack Instance: account 223344556677 region us-east-2 status OUTDATED reason User initiated operation
|
78
|
+
2019-12-19 11:01:03 PM Stack Instance: account 112233445566 region us-east-1 status DELETED
|
79
|
+
2019-12-19 11:01:17 PM Stack Instance: account 223344556677 region us-east-1 status DELETED
|
80
|
+
2019-12-19 11:01:31 PM Stack Instance: account 112233445566 region us-east-2 status DELETED
|
81
|
+
Time took to complete stack set operation: 1m 3s
|
82
|
+
Stack set operation completed.
|
83
|
+
Stack Set Operation Summary:
|
84
|
+
account 112233445566 region us-east-1 status SUCCEEDED
|
85
|
+
account 112233445566 region us-east-2 status SUCCEEDED
|
86
|
+
account 223344556677 region us-east-2 status SUCCEEDED
|
87
|
+
account 223344556677 region us-east-1 status SUCCEEDED
|
88
|
+
$
|
@@ -0,0 +1,23 @@
|
|
1
|
+
## Example
|
2
|
+
|
3
|
+
$ lono sets status my-set
|
4
|
+
Stack Set Operation Status: SUCCEEDED
|
5
|
+
Stack Instance statuses... (takes a while)
|
6
|
+
Stack Instance: account 112233445566 region ap-northeast-2 status CURRENT
|
7
|
+
Stack Instance: account 112233445566 region ap-northeast-1 status CURRENT
|
8
|
+
Stack Instance: account 223344556677 region us-west-1 status CURRENT
|
9
|
+
Stack Instance: account 223344556677 region ap-northeast-1 status CURRENT
|
10
|
+
Stack Instance: account 223344556677 region ap-northeast-2 status CURRENT
|
11
|
+
Stack Instance: account 112233445566 region us-west-1 status CURRENT
|
12
|
+
Stack Instance: account 112233445566 region us-west-2 status CURRENT
|
13
|
+
Stack Instance: account 223344556677 region us-west-2 status CURRENT
|
14
|
+
Stack Set Operation Summary:
|
15
|
+
account 223344556677 region us-west-1 status SUCCEEDED
|
16
|
+
account 112233445566 region us-west-2 status SUCCEEDED
|
17
|
+
account 112233445566 region ap-northeast-1 status SUCCEEDED
|
18
|
+
account 112233445566 region ap-northeast-2 status SUCCEEDED
|
19
|
+
account 223344556677 region ap-northeast-2 status SUCCEEDED
|
20
|
+
account 223344556677 region us-west-2 status SUCCEEDED
|
21
|
+
account 112233445566 region us-west-1 status SUCCEEDED
|
22
|
+
account 223344556677 region ap-northeast-1 status SUCCEEDED
|
23
|
+
$
|
@@ -0,0 +1 @@
|
|
1
|
+
The lono upgrade command works for v6 and onward.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Lono
|
2
|
+
class Importer
|
3
|
+
def initialize(options)
|
4
|
+
@options = options
|
5
|
+
|
6
|
+
Lono::ProjectChecker.check
|
7
|
+
@blueprint = Lono::Conventions.new(options).blueprint
|
8
|
+
# Dont use set_blueprint_root because it doesnt exist yet. The import creates it
|
9
|
+
Lono.blueprint_root = "#{Lono.root}/app/blueprints/#{@blueprint}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
# Examples:
|
14
|
+
# Lono::Importer::Erb.new(source, options.clone).run
|
15
|
+
# Lono::Importer::Dsl.new(source, options.clone).run
|
16
|
+
type = @options[:type] || 'dsl'
|
17
|
+
importer_class = "Lono::Importer::#{type.classify}"
|
18
|
+
importer_class = Object.const_get(importer_class)
|
19
|
+
importer_class.new(@options).run
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Lono::Importer
|
2
|
+
class Base < Lono::AbstractBase
|
3
|
+
include Download
|
4
|
+
include Thor::Actions
|
5
|
+
include Thor::Base
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
reinitialize(options)
|
9
|
+
@source = options[:source]
|
10
|
+
@tmp_path = "/tmp/lono/import/template.yml"
|
11
|
+
self.destination_root = Dir.pwd # Thor::Actions require destination_root to be set
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def summarize
|
16
|
+
return unless @options[:summary]
|
17
|
+
puts "Template Summary:"
|
18
|
+
Lono::Inspector::Summary.new(@options).run
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_params(template_path)
|
22
|
+
create_params_file(template_path, "development")
|
23
|
+
create_params_file(template_path, "production")
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_params_file(template_path, env)
|
27
|
+
params_path = if @blueprint != @template
|
28
|
+
"configs/#{@blueprint}/params/#{env}/#{@template}.txt"
|
29
|
+
else
|
30
|
+
"configs/#{@blueprint}/params/#{env}.txt"
|
31
|
+
end
|
32
|
+
params = Params.new(template_path, params_path)
|
33
|
+
params.create
|
34
|
+
end
|
35
|
+
|
36
|
+
# removes the ./ at the beginning if it's there in the path
|
37
|
+
def pretty_path(path)
|
38
|
+
path.sub("#{Lono.root}/",'')
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_dot_lono(type)
|
42
|
+
dot_lono = "#{Lono.blueprint_root}/.meta"
|
43
|
+
FileUtils.mkdir_p(dot_lono)
|
44
|
+
config = {
|
45
|
+
"blueprint_name" => @blueprint,
|
46
|
+
"template_type" => "#{type}",
|
47
|
+
}
|
48
|
+
text = YAML.dump(config)
|
49
|
+
IO.write("#{dot_lono}/config.yml", text)
|
50
|
+
end
|
51
|
+
|
52
|
+
def blueprint_name
|
53
|
+
return @options[:name] if @options[:name]
|
54
|
+
# Else infer name from the original source.
|
55
|
+
name = File.basename(@source, ".*")
|
56
|
+
@options[:casing] == "camelcase" ? name.camelize : name.underscore.dasherize
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Lono::Importer
|
2
|
+
class Converter
|
3
|
+
include Download
|
4
|
+
|
5
|
+
# source is a path
|
6
|
+
def initialize(options={})
|
7
|
+
@options = options
|
8
|
+
@source = options[:source]
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
tmp_path = "/tmp/lono/import/template.yml"
|
13
|
+
tmp_template_path = download_template(@source, tmp_path)
|
14
|
+
template = IO.read(tmp_template_path)
|
15
|
+
coder = Service::Coder.new(template, @options)
|
16
|
+
coder.translate
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "json"
|
2
|
+
require "open-uri"
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
class Lono::Importer
|
6
|
+
module Download
|
7
|
+
def download_template(source, dest_path)
|
8
|
+
template = read_source(source)
|
9
|
+
|
10
|
+
result = if json?(template)
|
11
|
+
# abusing YAML.dump(YAML.load()) to convert json to yaml
|
12
|
+
YAML.dump(YAML.load(template))
|
13
|
+
else
|
14
|
+
template # template is already in YAML format
|
15
|
+
end
|
16
|
+
|
17
|
+
folder = File.dirname(dest_path)
|
18
|
+
FileUtils.mkdir_p(folder) unless File.exist?(folder)
|
19
|
+
IO.write(dest_path, result)
|
20
|
+
dest_path
|
21
|
+
end
|
22
|
+
|
23
|
+
def read_source(source)
|
24
|
+
open(source).read
|
25
|
+
rescue OpenURI::HTTPError, SocketError, Errno::ENOENT
|
26
|
+
puts "ERROR: Unable to read source template provided: #{source}".color(:red)
|
27
|
+
e = $!
|
28
|
+
puts "#{e.class}: #{e.message}"
|
29
|
+
puts "Please double check the source provided."
|
30
|
+
exit 1
|
31
|
+
rescue Exception => e
|
32
|
+
puts "ERROR: Unable to read source template provided: #{source}".color(:red)
|
33
|
+
puts "General Exception Error:"
|
34
|
+
puts "#{e.class}: #{e.message}"
|
35
|
+
puts "Please double check the source provided."
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
def json?(text)
|
40
|
+
JSON.load(text)
|
41
|
+
true # if reach here than it's just
|
42
|
+
rescue JSON::ParserError
|
43
|
+
false # not json
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Lono::Importer
|
2
|
+
class Dsl < Base
|
3
|
+
def run
|
4
|
+
tmp_template_path = download_template(@source, @tmp_path)
|
5
|
+
template = IO.read(tmp_template_path)
|
6
|
+
|
7
|
+
Lono::Blueprint::New.start([@blueprint, "--import", "--type", "dsl"])
|
8
|
+
|
9
|
+
translate_to_dsl(template)
|
10
|
+
create_params(tmp_template_path)
|
11
|
+
# Let's not summarize the template in case the Ruby syntax is invalid with the import coder.
|
12
|
+
# Add summarize back in later
|
13
|
+
# summarize
|
14
|
+
|
15
|
+
final_message
|
16
|
+
end
|
17
|
+
|
18
|
+
def translate_to_dsl(template)
|
19
|
+
coder = Service::Coder.new(template, @options)
|
20
|
+
result = coder.translate
|
21
|
+
|
22
|
+
path = "#{Lono.config.templates_path}/#{@template}.rb"
|
23
|
+
FileUtils.mkdir_p(File.dirname(path))
|
24
|
+
create_file(path, result) # Thor::Action
|
25
|
+
end
|
26
|
+
|
27
|
+
def final_message
|
28
|
+
puts <<~EOL
|
29
|
+
#{"="*64}
|
30
|
+
Congrats 🎉 You have successfully imported a lono blueprint.
|
31
|
+
|
32
|
+
More info: https://lono.cloud/docs/core/blueprints
|
33
|
+
EOL
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Lono::Importer
|
2
|
+
class Erb < Base
|
3
|
+
def run
|
4
|
+
puts "=> Imported CloudFormation template.".color(:green)
|
5
|
+
template_path = "#{Lono.config.templates_path}/#{@template}.yml"
|
6
|
+
download_template(@source, template_path)
|
7
|
+
puts "Template created: #{pretty_path(template_path)}"
|
8
|
+
|
9
|
+
create_dot_lono("erb")
|
10
|
+
template_definition_path = add_template_definition
|
11
|
+
puts "Template definition added: #{pretty_path(template_definition_path)}"
|
12
|
+
|
13
|
+
create_params(template_path)
|
14
|
+
summarize
|
15
|
+
end
|
16
|
+
|
17
|
+
# Add template definition to app/definitions/base.rb.
|
18
|
+
def add_template_definition
|
19
|
+
path = "#{Lono.config.definitions_path}/base.rb"
|
20
|
+
lines = File.exist?(path) ? IO.readlines(path) : []
|
21
|
+
new_template_definition = %Q|template "#{@template}"|
|
22
|
+
unless lines.detect { |l| l.include?(new_template_definition) }
|
23
|
+
lines << ["\n", new_template_definition]
|
24
|
+
result = lines.join('')
|
25
|
+
FileUtils.mkdir_p(File.dirname(path))
|
26
|
+
IO.write(path, result)
|
27
|
+
end
|
28
|
+
path
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class Lono::Importer
|
2
|
+
class Params
|
3
|
+
include Thor::Actions
|
4
|
+
include Thor::Base
|
5
|
+
extend Memoist
|
6
|
+
|
7
|
+
attr_reader :options
|
8
|
+
def initialize(template_path, params_path)
|
9
|
+
@template_path, @params_path = template_path, params_path
|
10
|
+
@params_path = normalize_path(@params_path)
|
11
|
+
self.destination_root = Dir.pwd # Thor::Actions require destination_root to be set
|
12
|
+
@options = {} # For Thor::Actions to work
|
13
|
+
end
|
14
|
+
|
15
|
+
# Creates starter params/base/[stack-name].txt file
|
16
|
+
def create
|
17
|
+
result = []
|
18
|
+
required_parameters.each do |name, attributes|
|
19
|
+
result << "#{name}=#{attributes["Default"]}"
|
20
|
+
end
|
21
|
+
optional_parameters.each do |name, attributes|
|
22
|
+
key = "#{name}=".ljust(20, ' ')
|
23
|
+
result << "##{key} # optional"
|
24
|
+
end
|
25
|
+
content = result.join("\n") + "\n"
|
26
|
+
|
27
|
+
|
28
|
+
folder = File.dirname(@params_path)
|
29
|
+
FileUtils.mkdir_p(folder) unless File.exist?(folder)
|
30
|
+
create_file(@params_path, content) # Thor::Action
|
31
|
+
end
|
32
|
+
|
33
|
+
def required_parameters
|
34
|
+
parameters.reject { |logical_id, p| p["Default"] }
|
35
|
+
end
|
36
|
+
|
37
|
+
def optional_parameters
|
38
|
+
parameters.select { |logical_id, p| p["Default"] }
|
39
|
+
end
|
40
|
+
|
41
|
+
def parameters
|
42
|
+
template_data["Parameters"] || []
|
43
|
+
end
|
44
|
+
|
45
|
+
def template_data
|
46
|
+
YAML.load(IO.read(@template_path))
|
47
|
+
end
|
48
|
+
memoize :template_data
|
49
|
+
|
50
|
+
private
|
51
|
+
# Add Lono.root if not already there, helps cli_spec.rb to pass
|
52
|
+
def normalize_path(path)
|
53
|
+
path.include?(Lono.root.to_s) ? path : "#{Lono.root}/#{path}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|