lono 7.5.2 → 8.0.0.pre.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cody/README.md +5 -15
- data/.cody/acceptance/bin/build.sh +52 -0
- data/.cody/acceptance/buildspec.yml +10 -0
- data/.cody/acceptance/project.rb +6 -0
- data/.cody/{role.rb → acceptance/role.rb} +0 -0
- data/.cody/shared/script/install/lono.sh +40 -0
- data/.cody/shared/script/install.sh +5 -0
- data/CHANGELOG.md +46 -5
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +3 -1
- data/LICENSE.txt +201 -1
- data/README.md +6 -11
- data/lib/lono/api/client.rb +3 -2
- data/lib/lono/app/callable_option/concern.rb +12 -0
- data/lib/lono/app/callable_option.rb +56 -0
- data/lib/lono/app/inits.rb +13 -0
- data/lib/lono/app.rb +73 -0
- data/lib/lono/autoloader.rb +3 -2
- data/lib/lono/aws_services/helper.rb +41 -6
- data/lib/lono/aws_services.rb +37 -6
- data/lib/lono/blueprint.rb +3 -11
- data/lib/lono/booter.rb +28 -0
- data/lib/lono/builder/allow/base.rb +54 -0
- data/lib/lono/builder/allow/env.rb +17 -0
- data/lib/lono/builder/allow/region.rb +20 -0
- data/lib/lono/builder/allow.rb +8 -0
- data/lib/lono/builder/configset/combiner.rb +145 -0
- data/lib/lono/builder/configset/definition/base.rb +47 -0
- data/lib/lono/builder/configset/definition/context.rb +29 -0
- data/lib/lono/{configset/strategy/helpers/dsl → builder/configset/definition/dsl/syntax}/auth.rb +1 -1
- data/lib/lono/{configset/strategy/helpers/dsl/core.rb → builder/configset/definition/dsl/syntax/content.rb} +11 -3
- data/lib/lono/{configset/strategy/helpers/dsl/syntax.rb → builder/configset/definition/dsl/syntax/core.rb} +15 -9
- data/lib/lono/{configset/strategy/helpers/dsl → builder/configset/definition/dsl/syntax}/package.rb +1 -1
- data/lib/lono/builder/configset/definition/dsl/syntax.rb +5 -0
- data/lib/lono/{configset/strategy → builder/configset/definition}/dsl.rb +10 -14
- data/lib/lono/{configset/strategy → builder/configset/definition}/erb.rb +13 -16
- data/lib/lono/builder/configset/definition.rb +18 -0
- data/lib/lono/builder/configset/evaluator.rb +10 -0
- data/lib/lono/builder/configset/registration.rb +35 -0
- data/lib/lono/builder/context.rb +40 -0
- data/lib/lono/builder/dsl/evaluator.rb +45 -0
- data/lib/lono/builder/dsl/finalizer/base.rb +8 -0
- data/lib/lono/builder/dsl/finalizer/configsets.rb +20 -0
- data/lib/lono/builder/dsl/finalizer/files/base.rb +4 -0
- data/lib/lono/builder/dsl/finalizer/files/build.rb +58 -0
- data/lib/lono/builder/dsl/finalizer/files/replace.rb +31 -0
- data/lib/lono/builder/dsl/finalizer/files.rb +9 -0
- data/lib/lono/{template/strategy → builder}/dsl/finalizer/parameter_groups.rb +6 -5
- data/lib/lono/builder/dsl/finalizer.rb +15 -0
- data/lib/lono/{template/strategy/dsl/builder/helpers/ec2_helper.rb → builder/dsl/helpers/ec2.rb} +3 -3
- data/lib/lono/builder/dsl/helpers/files.rb +7 -0
- data/lib/lono/builder/dsl/helpers/partials.rb +140 -0
- data/lib/lono/{template/strategy/dsl/builder/helpers/s3_helper.rb → builder/dsl/helpers/s3.rb} +3 -3
- data/lib/lono/{template/context/ssm_fetcher.rb → builder/dsl/helpers/ssm/fetcher.rb} +5 -3
- data/lib/lono/{template/context/helpers.rb → builder/dsl/helpers/ssm.rb} +3 -3
- data/lib/lono/{template/strategy/dsl/builder/helpers/stack_helper.rb → builder/dsl/helpers/stack.rb} +14 -9
- data/lib/lono/{template/strategy/dsl/builder/helpers/tags_helper.rb → builder/dsl/helpers/tags.rb} +2 -2
- data/lib/lono/builder/dsl/helpers/template_file.rb +66 -0
- data/lib/lono/builder/dsl/helpers.rb +5 -0
- data/lib/lono/builder/dsl/syntax/core/base.rb +22 -0
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/condition.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/mapping.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/output.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/parameter.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/resource/property_mover.rb +12 -2
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/resource.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder/section → builder/dsl/syntax/core}/section.rb +1 -1
- data/lib/lono/builder/dsl/syntax/core/squeezer.rb +38 -0
- data/lib/lono/{template/strategy/dsl/builder/section/methods.rb → builder/dsl/syntax/core.rb} +8 -8
- data/lib/lono/{template/strategy/dsl/builder → builder/dsl/syntax}/fn.rb +2 -2
- data/lib/lono/{template/strategy/dsl/builder → builder/dsl}/syntax/parameter_group.rb +1 -1
- data/lib/lono/builder/dsl/syntax.rb +9 -0
- data/lib/lono/builder/dsl.rb +14 -0
- data/lib/lono/{param/generator.rb → builder/param.rb} +24 -22
- data/lib/lono/builder/template/aws_service.rb +15 -0
- data/lib/lono/builder/template/bashify.rb +43 -0
- data/lib/lono/{output/template.rb → builder/template/output.rb} +14 -7
- data/lib/lono/{template → builder/template}/post_processor.rb +4 -4
- data/lib/lono/builder/template/upload.rb +8 -0
- data/lib/lono/builder/template.rb +55 -0
- data/lib/lono/{template/strategy/dsl/builder → builder/util}/stringify.rb +1 -1
- data/lib/lono/bundler/cli/base.rb +10 -0
- data/lib/lono/bundler/cli/bundle.rb +44 -0
- data/lib/lono/bundler/cli/clean.rb +27 -0
- data/lib/lono/bundler/cli/help/bundle.md +3 -0
- data/lib/lono/bundler/cli/help.rb +11 -0
- data/lib/lono/bundler/cli.rb +7 -0
- data/lib/lono/bundler/component/concerns/local_concern.rb +10 -0
- data/lib/lono/bundler/component/concerns/notation_concern.rb +59 -0
- data/lib/lono/bundler/component/concerns/path_concern.rb +68 -0
- data/lib/lono/bundler/component/concerns/stack_concern.rb +60 -0
- data/lib/lono/bundler/component/fetcher/base.rb +27 -0
- data/lib/lono/bundler/component/fetcher/gcs.rb +69 -0
- data/lib/lono/bundler/component/fetcher/git.rb +69 -0
- data/lib/lono/bundler/component/fetcher/local.rb +15 -0
- data/lib/lono/bundler/component/fetcher/s3.rb +66 -0
- data/lib/lono/bundler/component/fetcher.rb +18 -0
- data/lib/lono/bundler/component/http/concern.rb +45 -0
- data/lib/lono/bundler/component/http/source.rb +19 -0
- data/lib/lono/bundler/component/org_repo.rb +65 -0
- data/lib/lono/bundler/component/props/extension.rb +18 -0
- data/lib/lono/bundler/component/props/typer.rb +41 -0
- data/lib/lono/bundler/component/props.rb +122 -0
- data/lib/lono/bundler/component/registry.rb +136 -0
- data/lib/lono/bundler/component.rb +52 -0
- data/lib/lono/bundler/config.rb +18 -0
- data/lib/lono/bundler/dsl/syntax.rb +46 -0
- data/lib/lono/bundler/dsl.rb +21 -0
- data/lib/lono/bundler/exporter/base.rb +6 -0
- data/lib/lono/bundler/exporter/copy.rb +22 -0
- data/lib/lono/bundler/exporter.rb +50 -0
- data/lib/lono/bundler/extract/tar.rb +33 -0
- data/lib/lono/bundler/extract/zip.rb +16 -0
- data/lib/lono/bundler/info.rb +39 -0
- data/lib/lono/bundler/list.rb +26 -0
- data/lib/lono/bundler/lockfile/version_comparer.rb +56 -0
- data/lib/lono/bundler/lockfile/yamler.rb +36 -0
- data/lib/lono/bundler/lockfile.rb +66 -0
- data/lib/lono/bundler/lonofile.rb +32 -0
- data/lib/lono/bundler/runner.rb +27 -0
- data/lib/lono/bundler/syncer.rb +70 -0
- data/lib/lono/bundler/util/git.rb +37 -0
- data/lib/lono/bundler/util/logging.rb +7 -0
- data/lib/lono/bundler/util/sure.rb +5 -0
- data/lib/lono/{bundle.rb → bundler.rb} +38 -4
- data/lib/lono/cfn/base.rb +9 -195
- data/lib/lono/cfn/cancel.rb +12 -29
- data/lib/lono/cfn/concerns/build.rb +10 -0
- data/lib/lono/cfn/concerns/template_output.rb +10 -0
- data/lib/lono/cfn/concerns.rb +43 -0
- data/lib/lono/cfn/delete.rb +8 -32
- data/lib/lono/cfn/deploy/base.rb +4 -0
- data/lib/lono/cfn/deploy/iam.rb +48 -0
- data/lib/lono/cfn/deploy/notification.rb +8 -0
- data/lib/lono/cfn/deploy/operable.rb +18 -0
- data/lib/lono/cfn/deploy/opts.rb +49 -0
- data/lib/lono/cfn/deploy/rollback.rb +46 -0
- data/lib/lono/cfn/deploy/tags.rb +18 -0
- data/lib/lono/cfn/deploy.rb +100 -5
- data/lib/lono/cfn/download.rb +4 -7
- data/lib/lono/cfn/output.rb +49 -0
- data/lib/lono/cfn/plan/base.rb +19 -0
- data/lib/lono/cfn/plan/changeset/base.rb +19 -0
- data/lib/lono/cfn/plan/changeset/notifications.rb +24 -0
- data/lib/lono/cfn/plan/changeset/outputs.rb +25 -0
- data/lib/lono/cfn/plan/changeset/resources.rb +48 -0
- data/lib/lono/cfn/plan/changeset/tags.rb +16 -0
- data/lib/lono/cfn/plan/changeset.rb +136 -0
- data/lib/lono/cfn/plan/concerns.rb +10 -0
- data/lib/lono/cfn/plan/delete.rb +16 -0
- data/lib/lono/cfn/plan/diff/base.rb +10 -0
- data/lib/lono/cfn/plan/diff/data.rb +62 -0
- data/lib/lono/cfn/plan/diff/file.rb +57 -0
- data/lib/lono/cfn/plan/new.rb +26 -0
- data/lib/lono/cfn/{preview → plan}/param.rb +26 -34
- data/lib/lono/cfn/plan/summary.rb +16 -0
- data/lib/lono/cfn/plan/template.rb +28 -0
- data/lib/lono/cfn/plan.rb +34 -0
- data/lib/lono/cfn/show.rb +30 -0
- data/lib/lono/cfn/status.rb +1 -1
- data/lib/lono/cli/abstract.rb +11 -0
- data/lib/lono/cli/base.rb +11 -0
- data/lib/lono/cli/build.rb +47 -0
- data/lib/lono/cli/bundle.rb +21 -0
- data/lib/lono/cli/cfn/opts.rb +59 -0
- data/lib/lono/cli/cfn.rb +19 -0
- data/lib/lono/cli/clean.rb +23 -0
- data/lib/lono/cli/code.rb +22 -0
- data/lib/lono/{completion.rb → cli/completion.rb} +2 -2
- data/lib/lono/{help → cli/help}/blueprint/new.md +4 -4
- data/lib/lono/{help/generate.md → cli/help/build.md} +6 -6
- data/lib/lono/{help → cli/help}/cfn/cancel.md +0 -0
- data/lib/lono/cli/help/cfn/download.md +3 -0
- data/lib/lono/{help → cli/help}/cfn/preview.md +9 -8
- data/lib/lono/{help → cli/help}/cfn/status.md +0 -1
- data/lib/lono/cli/help/cfn.md +4 -0
- data/lib/lono/{help → cli/help}/code/convert.md +0 -0
- data/lib/lono/{help → cli/help}/code/import.md +2 -2
- data/lib/lono/{help → cli/help}/completion.md +3 -3
- data/lib/lono/{help → cli/help}/completion_script.md +0 -0
- data/lib/lono/{help → cli/help}/configsets.md +0 -0
- data/lib/lono/cli/help/down.md +13 -0
- data/lib/lono/cli/help/new/helper/blueprint.md +17 -0
- data/lib/lono/cli/help/new/helper/project.md +16 -0
- data/lib/lono/cli/help/new/project.md +34 -0
- data/lib/lono/{help → cli/help}/param/generate.md +0 -0
- data/lib/lono/cli/help/param.md +6 -0
- data/lib/lono/{help → cli/help}/pro/blueprints.md +0 -0
- data/lib/lono/{help → cli/help}/pro/configsets.md +0 -0
- data/lib/lono/{help → cli/help}/script/build.md +0 -0
- data/lib/lono/{help → cli/help}/script/upload.md +0 -0
- data/lib/lono/cli/help/seed.md +24 -0
- data/lib/lono/cli/help/summary.md +33 -0
- data/lib/lono/{help → cli/help}/template/bashify.md +0 -0
- data/lib/lono/cli/help/template/generate.md +7 -0
- data/lib/lono/{help → cli/help}/template.md +0 -0
- data/lib/lono/cli/help/up.md +30 -0
- data/lib/lono/{help → cli/help}/user_data.md +3 -3
- data/lib/lono/cli/help.rb +56 -0
- data/lib/lono/cli/list.rb +25 -0
- data/lib/lono/cli/new/blueprint.rb +29 -0
- data/lib/lono/cli/new/concerns.rb +16 -0
- data/lib/lono/cli/new/configset.rb +37 -0
- data/lib/lono/{extension/new.rb → cli/new/extension.rb} +2 -10
- data/lib/lono/cli/new/helper/blueprint.rb +26 -0
- data/lib/lono/cli/new/helper/project.rb +24 -0
- data/lib/lono/cli/new/helper.rb +13 -0
- data/lib/lono/cli/new/project.rb +77 -0
- data/lib/lono/cli/new/sequence.rb +56 -0
- data/lib/lono/cli/new/shim.rb +59 -0
- data/lib/lono/cli/new/test/blueprint.rb +23 -0
- data/lib/lono/cli/new/test/sequence.rb +10 -0
- data/lib/lono/cli/new/test.rb +8 -0
- data/lib/lono/cli/new.rb +27 -0
- data/lib/lono/{opts.rb → cli/opts.rb} +9 -12
- data/lib/lono/{s3.rb → cli/s3.rb} +9 -7
- data/lib/lono/cli/script/base.rb +5 -0
- data/lib/lono/cli/script/build.rb +72 -0
- data/lib/lono/cli/script/upload.rb +49 -0
- data/lib/lono/{script.rb → cli/script.rb} +2 -2
- data/lib/lono/cli/seed.rb +9 -0
- data/lib/lono/cli/status.rb +18 -0
- data/lib/lono/cli/test.rb +35 -0
- data/lib/lono/cli.rb +78 -109
- data/lib/lono/command.rb +27 -1
- data/lib/lono/component.rb +29 -0
- data/lib/lono/concerns/aws_info.rb +14 -0
- data/lib/lono/concerns/names.rb +9 -0
- data/lib/lono/configset.rb +11 -10
- data/lib/lono/core.rb +25 -54
- data/lib/lono/ext/core/module.rb +31 -0
- data/lib/lono/ext/core/object.rb +32 -0
- data/lib/lono/ext/core/string.rb +9 -0
- data/lib/lono/ext.rb +4 -0
- data/lib/lono/files/base.rb +12 -0
- data/lib/lono/files/builder.rb +37 -0
- data/lib/lono/files/compressor.rb +53 -0
- data/lib/lono/files/concerns/post_processing.rb +35 -0
- data/lib/lono/files/concerns/registration.rb +13 -0
- data/lib/lono/files/registry.rb +6 -0
- data/lib/lono/files.rb +37 -0
- data/lib/lono/importer/base.rb +6 -6
- data/lib/lono/importer/download.rb +7 -7
- data/lib/lono/importer/dsl.rb +3 -3
- data/lib/lono/importer/service/coder.rb +67 -63
- data/lib/lono/importer.rb +1 -10
- data/lib/lono/inspector/base.rb +7 -7
- data/lib/lono/inspector/summary.rb +18 -19
- data/lib/lono/layering/layer.rb +112 -0
- data/lib/lono/layering.rb +13 -55
- data/lib/lono/logger/formatter.rb +13 -0
- data/lib/lono/logger.rb +32 -0
- data/lib/lono/names.rb +50 -0
- data/lib/lono/plugin/meta.rb +30 -0
- data/lib/lono/plugin/tester.rb +13 -0
- data/lib/lono/plugin.rb +10 -0
- data/lib/lono/s3/aws_setup.rb +4 -3
- data/lib/lono/s3/bucket.rb +42 -42
- data/lib/lono/s3/rollback.rb +8 -0
- data/lib/lono/s3/uploader.rb +33 -34
- data/lib/lono/script/base.rb +3 -3
- data/lib/lono/script/build.rb +11 -12
- data/lib/lono/script/upload.rb +7 -7
- data/lib/lono/seeder.rb +110 -0
- data/lib/lono/user_data.rb +10 -13
- data/lib/lono/utils/logging.rb +7 -0
- data/lib/lono/utils/{pretty_time.rb → pretty.rb} +6 -2
- data/lib/lono/utils/quit.rb +7 -0
- data/lib/lono/utils/rsync.rb +4 -2
- data/lib/lono/utils/sure.rb +4 -4
- data/lib/lono/version.rb +1 -1
- data/lib/lono/yamler/validator.rb +7 -22
- data/lib/lono.rb +15 -12
- data/lib/templates/blueprint/template.rb +2 -0
- data/lib/templates/configset/configset.rb +2 -0
- data/lib/templates/examples/blueprint/template.rb +9 -0
- data/lib/templates/{configset/lib → examples/configset}/configset.rb +0 -0
- data/lib/templates/helper/%underscore_name%_helper.rb.tt +6 -0
- data/lib/templates/{skeleton → project}/.gitignore +1 -2
- data/lib/templates/project/Gemfile.tt +11 -0
- data/lib/templates/project/README.md +9 -0
- data/lib/templates/project/config/app.rb +3 -0
- data/lib/templates/shim/lono +7 -0
- data/lono.gemspec +51 -44
- metadata +282 -296
- data/.circleci/README.md +0 -3
- data/.circleci/config.yml +0 -58
- data/.cody/acceptance.sh +0 -49
- data/.cody/buildspec.yml +0 -9
- data/.cody/demo.rb +0 -38
- data/.cody/project.rb +0 -6
- data/.gitmodules +0 -3
- data/lib/lono/abstract_base.rb +0 -25
- data/lib/lono/app_file/base.rb +0 -28
- data/lib/lono/app_file/build/lambda_layer/ruby_packager.rb +0 -153
- data/lib/lono/app_file/build/lambda_layer.rb +0 -20
- data/lib/lono/app_file/build.rb +0 -84
- data/lib/lono/app_file/registry/item.rb +0 -24
- data/lib/lono/app_file/registry.rb +0 -16
- data/lib/lono/app_file/upload.rb +0 -12
- data/lib/lono/aws_services/stack.rb +0 -41
- data/lib/lono/aws_services/stack_set.rb +0 -41
- data/lib/lono/blueprint/configset/loader.rb +0 -7
- data/lib/lono/blueprint/helper.rb +0 -24
- data/lib/lono/blueprint/meta.rb +0 -30
- data/lib/lono/blueprint/new.rb +0 -127
- data/lib/lono/blueprint/root.rb +0 -25
- data/lib/lono/cfn/create.rb +0 -41
- data/lib/lono/cfn/opts.rb +0 -88
- data/lib/lono/cfn/preview/changeset.rb +0 -168
- data/lib/lono/cfn/preview/codediff.rb +0 -41
- data/lib/lono/cfn/preview/diff_viewer.rb +0 -23
- data/lib/lono/cfn/rollback.rb +0 -26
- data/lib/lono/cfn/update.rb +0 -71
- data/lib/lono/cfn.rb +0 -75
- data/lib/lono/clean.rb +0 -14
- data/lib/lono/code.rb +0 -22
- data/lib/lono/configset/combiner.rb +0 -162
- data/lib/lono/configset/evaluate_file.rb +0 -8
- data/lib/lono/configset/generator.rb +0 -57
- data/lib/lono/configset/list.rb +0 -67
- data/lib/lono/configset/meta/dsl.rb +0 -12
- data/lib/lono/configset/meta.rb +0 -19
- data/lib/lono/configset/new.rb +0 -77
- data/lib/lono/configset/preparer.rb +0 -44
- data/lib/lono/configset/register/base.rb +0 -122
- data/lib/lono/configset/register/blueprint.rb +0 -16
- data/lib/lono/configset/register/dsl.rb +0 -14
- data/lib/lono/configset/register/project.rb +0 -13
- data/lib/lono/configset/resolver.rb +0 -47
- data/lib/lono/configset/s3_file/build.rb +0 -33
- data/lib/lono/configset/s3_file/item.rb +0 -38
- data/lib/lono/configset/s3_file/registry.rb +0 -12
- data/lib/lono/configset/s3_file/upload.rb +0 -12
- data/lib/lono/configset/strategy/base.rb +0 -83
- data/lib/lono/configset/strategy/helpers/dsl.rb +0 -8
- data/lib/lono/configset/strategy/helpers/erb.rb +0 -9
- data/lib/lono/conventions.rb +0 -23
- data/lib/lono/core/config.rb +0 -22
- data/lib/lono/default/settings.yml +0 -21
- data/lib/lono/extension/helper.rb +0 -13
- data/lib/lono/extension/list.rb +0 -40
- data/lib/lono/extension.rb +0 -9
- data/lib/lono/extensions/dsl.rb +0 -11
- data/lib/lono/extensions/loader.rb +0 -30
- data/lib/lono/extensions/preparer.rb +0 -26
- data/lib/lono/extensions/register.rb +0 -15
- data/lib/lono/extensions.rb +0 -18
- data/lib/lono/file_uploader.rb +0 -21
- data/lib/lono/finder/base.rb +0 -152
- data/lib/lono/finder/blueprint/configset.rb +0 -17
- data/lib/lono/finder/blueprint.rb +0 -11
- data/lib/lono/finder/configset.rb +0 -11
- data/lib/lono/finder/extension.rb +0 -11
- data/lib/lono/generate.rb +0 -111
- data/lib/lono/help/cfn/create.md +0 -26
- data/lib/lono/help/cfn/delete.md +0 -13
- data/lib/lono/help/cfn/deploy.md +0 -21
- data/lib/lono/help/cfn/download.md +0 -3
- data/lib/lono/help/cfn/update.md +0 -49
- data/lib/lono/help/cfn.md +0 -7
- data/lib/lono/help/new.md +0 -57
- data/lib/lono/help/param.md +0 -6
- data/lib/lono/help/seed.md +0 -23
- data/lib/lono/help/set_instances/delete.md +0 -21
- data/lib/lono/help/set_instances/deploy.md +0 -31
- data/lib/lono/help/set_instances/list.md +0 -14
- data/lib/lono/help/set_instances/status.md +0 -15
- data/lib/lono/help/set_instances/sync.md +0 -92
- data/lib/lono/help/sets/delete.md +0 -8
- data/lib/lono/help/sets/deploy.md +0 -76
- data/lib/lono/help/sets/status.md +0 -23
- data/lib/lono/help/summary.md +0 -33
- data/lib/lono/help/template/generate.md +0 -7
- data/lib/lono/help/upgrade.md +0 -1
- data/lib/lono/help/xgraph.md +0 -16
- data/lib/lono/help.rb +0 -15
- data/lib/lono/importer/erb.rb +0 -31
- data/lib/lono/inspector/graph.rb +0 -125
- data/lib/lono/jade/circular.rb +0 -26
- data/lib/lono/jade/materializer/final.rb +0 -10
- data/lib/lono/jade/materializer/gems_builder.rb +0 -81
- data/lib/lono/jade/materializer/source.rb +0 -54
- data/lib/lono/jade/materializer.rb +0 -15
- data/lib/lono/jade/registry.rb +0 -64
- data/lib/lono/jade.rb +0 -110
- data/lib/lono/jadespec.rb +0 -68
- data/lib/lono/new/helper.rb +0 -15
- data/lib/lono/new.rb +0 -95
- data/lib/lono/param.rb +0 -14
- data/lib/lono/pro/base.rb +0 -16
- data/lib/lono/pro/repo.rb +0 -28
- data/lib/lono/pro.rb +0 -15
- data/lib/lono/project_checker.rb +0 -35
- data/lib/lono/registration/base.rb +0 -37
- data/lib/lono/registration/check.rb +0 -15
- data/lib/lono/registration/temp.rb +0 -53
- data/lib/lono/registration/user.rb +0 -60
- data/lib/lono/seed/base.rb +0 -116
- data/lib/lono/seed/service_role.rb +0 -11
- data/lib/lono/seed.rb +0 -39
- data/lib/lono/sequence.rb +0 -35
- data/lib/lono/set_instances/base.rb +0 -30
- data/lib/lono/set_instances/changeable.rb +0 -53
- data/lib/lono/set_instances/create.rb +0 -7
- data/lib/lono/set_instances/delete.rb +0 -47
- data/lib/lono/set_instances/deploy.rb +0 -52
- data/lib/lono/set_instances/list.rb +0 -13
- data/lib/lono/set_instances/opts.rb +0 -37
- data/lib/lono/set_instances/status.rb +0 -12
- data/lib/lono/set_instances/sync.rb +0 -181
- data/lib/lono/set_instances/update.rb +0 -15
- data/lib/lono/set_instances.rb +0 -54
- data/lib/lono/sets/base.rb +0 -50
- data/lib/lono/sets/create.rb +0 -27
- data/lib/lono/sets/delete.rb +0 -43
- data/lib/lono/sets/deploy.rb +0 -11
- data/lib/lono/sets/list.rb +0 -35
- data/lib/lono/sets/opts.rb +0 -18
- data/lib/lono/sets/preview/codediff.rb +0 -35
- data/lib/lono/sets/preview/param.rb +0 -32
- data/lib/lono/sets/status/instance/base.rb +0 -120
- data/lib/lono/sets/status/instance/completed.rb +0 -35
- data/lib/lono/sets/status/instance/deleted.rb +0 -32
- data/lib/lono/sets/status/instance/show.rb +0 -7
- data/lib/lono/sets/status/instance.rb +0 -20
- data/lib/lono/sets/status/instances.rb +0 -136
- data/lib/lono/sets/status.rb +0 -128
- data/lib/lono/sets/summarize.rb +0 -22
- data/lib/lono/sets/time_spent.rb +0 -11
- data/lib/lono/sets/update.rb +0 -74
- data/lib/lono/sets/waiter.rb +0 -23
- data/lib/lono/sets.rb +0 -34
- data/lib/lono/setting.rb +0 -75
- data/lib/lono/template/aws_service.rb +0 -20
- data/lib/lono/template/bashify.rb +0 -39
- data/lib/lono/template/configset_injector.rb +0 -52
- data/lib/lono/template/context/loader/load_files.rb +0 -24
- data/lib/lono/template/context/loader.rb +0 -52
- data/lib/lono/template/context.rb +0 -29
- data/lib/lono/template/evaluate.rb +0 -40
- data/lib/lono/template/generator.rb +0 -23
- data/lib/lono/template/helper.rb +0 -152
- data/lib/lono/template/strategy/base.rb +0 -4
- data/lib/lono/template/strategy/common/helpers.rb +0 -44
- data/lib/lono/template/strategy/dsl/builder/helpers/core_helper.rb +0 -14
- data/lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb +0 -48
- data/lib/lono/template/strategy/dsl/builder/helpers.rb +0 -16
- data/lib/lono/template/strategy/dsl/builder/section/base.rb +0 -30
- data/lib/lono/template/strategy/dsl/builder/squeezer.rb +0 -24
- data/lib/lono/template/strategy/dsl/builder/syntax/extend_with.rb +0 -9
- data/lib/lono/template/strategy/dsl/builder/syntax.rb +0 -11
- data/lib/lono/template/strategy/dsl/builder.rb +0 -59
- data/lib/lono/template/strategy/dsl/finalizer.rb +0 -12
- data/lib/lono/template/strategy/dsl.rb +0 -14
- data/lib/lono/template/strategy/erb.rb +0 -82
- data/lib/lono/template/strategy/source.rb +0 -8
- data/lib/lono/template/template.rb +0 -54
- data/lib/lono/template/upload.rb +0 -23
- data/lib/lono/template/util.rb +0 -8
- data/lib/lono/template.rb +0 -24
- data/lib/lono/upgrade.rb +0 -20
- data/lib/lono/utils/generators/tree.rb +0 -18
- data/lib/lono/utils/item/file_methods.rb +0 -29
- data/lib/lono/utils/item/zip.rb +0 -42
- data/lib/templates/blueprint/%blueprint_name%.gemspec.tt +0 -45
- data/lib/templates/blueprint/.gitignore +0 -11
- data/lib/templates/blueprint/CHANGELOG.md +0 -7
- data/lib/templates/blueprint/Gemfile +0 -4
- data/lib/templates/blueprint/README.md.tt +0 -33
- data/lib/templates/blueprint/Rakefile.tt +0 -9
- data/lib/templates/blueprint/seed/configs.rb +0 -28
- data/lib/templates/blueprint_types/dsl/app/templates/%blueprint_name%.rb +0 -36
- data/lib/templates/blueprint_types/dsl/app/user_data/bootstrap.sh +0 -2
- data/lib/templates/blueprint_types/erb/app/definitions/base.rb.tt +0 -1
- data/lib/templates/blueprint_types/erb/app/templates/%blueprint_name%.yml +0 -67
- data/lib/templates/configset/%configset_name%.gemspec.tt +0 -42
- data/lib/templates/configset/.gitignore +0 -10
- data/lib/templates/configset/CHANGELOG.md +0 -7
- data/lib/templates/configset/Gemfile +0 -4
- data/lib/templates/configset/README.md.tt +0 -3
- data/lib/templates/configset/Rakefile.tt +0 -9
- data/lib/templates/extension/%extension_name%.gemspec.tt +0 -46
- data/lib/templates/extension/.gitignore +0 -11
- data/lib/templates/extension/.rspec +0 -3
- data/lib/templates/extension/CHANGELOG.md +0 -7
- data/lib/templates/extension/Gemfile.tt +0 -4
- data/lib/templates/extension/Rakefile.tt +0 -9
- data/lib/templates/extension/spec/spec_helper.rb.tt +0 -29
- data/lib/templates/skeleton/Gemfile +0 -3
- data/lib/templates/skeleton/README.md +0 -58
- data/lib/templates/skeleton/configs/settings.yml +0 -13
- data/vendor/cfn-status/CHANGELOG.md +0 -14
- data/vendor/cfn-status/Gemfile +0 -4
- data/vendor/cfn-status/Gemfile.lock +0 -49
- data/vendor/cfn-status/LICENSE.txt +0 -21
- data/vendor/cfn-status/README.md +0 -58
- data/vendor/cfn-status/Rakefile +0 -6
- data/vendor/cfn-status/bin/console +0 -14
- data/vendor/cfn-status/bin/setup +0 -8
- data/vendor/cfn-status/cfn-status.gemspec +0 -30
- data/vendor/cfn-status/lib/cfn-status.rb +0 -1
- data/vendor/cfn-status/lib/cfn_status/aws_service.rb +0 -51
- data/vendor/cfn-status/lib/cfn_status/version.rb +0 -3
- data/vendor/cfn-status/lib/cfn_status.rb +0 -245
- data/vendor/cfn-status/spec/fixtures/cfn/pages/fresh/describe_stack_events-1.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/pages/fresh/describe_stack_events-2.json +0 -1104
- data/vendor/cfn-status/spec/fixtures/cfn/pages/fresh/describe_stack_events-3.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/pages/updating/describe_stack_events-1.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/pages/updating/describe_stack_events-2.json +0 -1104
- data/vendor/cfn-status/spec/fixtures/cfn/pages/updating/describe_stack_events-3.json +0 -1103
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +0 -1080
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +0 -1080
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +0 -1086
- data/vendor/cfn-status/spec/lib/cfn_status_spec.rb +0 -153
- data/vendor/cfn-status/spec/spec_helper.rb +0 -14
data/lib/lono/blueprint/meta.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require "yaml"
|
|
2
|
-
|
|
3
|
-
class Lono::Blueprint
|
|
4
|
-
class Meta
|
|
5
|
-
extend Memoist
|
|
6
|
-
|
|
7
|
-
def initialize(blueprint)
|
|
8
|
-
@blueprint = blueprint
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def jadespec
|
|
12
|
-
Lono::Finder::Blueprint.find(@blueprint)
|
|
13
|
-
end
|
|
14
|
-
memoize :jadespec
|
|
15
|
-
|
|
16
|
-
def auto_camelize?(target_section)
|
|
17
|
-
auto_camelize = jadespec.auto_camelize
|
|
18
|
-
# auto_camelize.nil? for backward compatibility
|
|
19
|
-
return true if auto_camelize.nil? || auto_camelize == true
|
|
20
|
-
|
|
21
|
-
if auto_camelize == "except_resource"
|
|
22
|
-
return target_section != "resource"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
if auto_camelize.is_a?(Array)
|
|
26
|
-
auto_camelize.include?(target_section)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
data/lib/lono/blueprint/new.rb
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
class Lono::Blueprint
|
|
2
|
-
class New < Lono::Sequence
|
|
3
|
-
include Helper
|
|
4
|
-
include Lono::Utils::Generators::Tree
|
|
5
|
-
|
|
6
|
-
argument :blueprint_name
|
|
7
|
-
|
|
8
|
-
def self.source_root
|
|
9
|
-
templates = File.expand_path("../../templates", File.dirname(__FILE__))
|
|
10
|
-
"#{templates}/blueprint"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def self.cli_options
|
|
14
|
-
[
|
|
15
|
-
[:bundle, type: :boolean, default: true, desc: "Runs bundle install on the project"],
|
|
16
|
-
[:demo, type: :boolean, default: true, desc: "Include demo template"],
|
|
17
|
-
[:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."],
|
|
18
|
-
[:from_new, type: :boolean, desc: "Called from `lono new` command."],
|
|
19
|
-
[:import, type: :boolean, desc: "Flag for lono code import"],
|
|
20
|
-
[:project_name, default: '', desc: "Only used with from_new internally"],
|
|
21
|
-
[:type, default: "dsl", desc: "Blueprint type: dsl or erb"],
|
|
22
|
-
]
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
cli_options.each do |args|
|
|
26
|
-
class_option(*args)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# for specs
|
|
30
|
-
def set_cwd
|
|
31
|
-
@cwd = "#{Lono.root}/app/blueprints"
|
|
32
|
-
|
|
33
|
-
if options[:from_new]
|
|
34
|
-
# At this point @cwd will have the project_name from `lono new`
|
|
35
|
-
# Yup, it's confusing. Here's an example to explain:
|
|
36
|
-
#
|
|
37
|
-
# lono new my-infra - sets @cwd = my-infra
|
|
38
|
-
#
|
|
39
|
-
# Then within the new Thor::Group this is called
|
|
40
|
-
#
|
|
41
|
-
# Lono::Blueprint::New.start(["ec2", "--from-new"])
|
|
42
|
-
#
|
|
43
|
-
# So @cwd = my-infra/blueprints
|
|
44
|
-
@cwd = "#{options[:project_name]}/app/blueprints"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def set_variables
|
|
49
|
-
@demo = @options[:demo]
|
|
50
|
-
@demo = false if ENV["LONO_ORG"] # overrides --demo CLI option
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def create_project
|
|
54
|
-
puts "=> Creating new blueprint called #{blueprint_name}."
|
|
55
|
-
directory ".", "#{@cwd}/#{blueprint_name}", directory_options
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def create_app_folder
|
|
59
|
-
return if @options[:import]
|
|
60
|
-
|
|
61
|
-
if @demo
|
|
62
|
-
directory "../blueprint_types/#{@options[:type]}", "#{@cwd}/#{blueprint_name}"
|
|
63
|
-
else
|
|
64
|
-
empty_directory "#{@cwd}/#{blueprint_name}/app/templates"
|
|
65
|
-
create_file "#{@cwd}/#{blueprint_name}/app/templates/#{blueprint_name}.rb"
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def create_empty_directories
|
|
70
|
-
# Note: Not using Lono::Core::Config::PATHS.keys to create all of them because
|
|
71
|
-
# think it is more common to not have all the folders. Instead create them explicitly.
|
|
72
|
-
empty_directory "#{@cwd}/#{blueprint_name}/app/templates"
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def create_license
|
|
76
|
-
return unless ENV['LONO_LICENSE_FILE']
|
|
77
|
-
copy_file ENV['LONO_LICENSE_FILE'], "#{@cwd}/#{blueprint_name}/LICENSE.txt"
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def create_readme
|
|
81
|
-
return unless ENV['LONO_README_FILE']
|
|
82
|
-
template ENV['LONO_README_FILE'], "#{@cwd}/#{blueprint_name}/README.md"
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
# After this commands are executed with the newly created project
|
|
86
|
-
def set_destination_root
|
|
87
|
-
destination_root = "#{@cwd}/#{blueprint_name}"
|
|
88
|
-
self.destination_root = destination_root
|
|
89
|
-
@old_dir = Dir.pwd # for reset_current_dir
|
|
90
|
-
FileUtils.cd(self.destination_root)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def welcome_message
|
|
94
|
-
return if options[:from_new] || options[:import]
|
|
95
|
-
puts <<~EOL
|
|
96
|
-
#{"="*64}
|
|
97
|
-
Congrats 🎉 You have successfully created a lono blueprint.
|
|
98
|
-
|
|
99
|
-
Cd into your blueprint and check things out.
|
|
100
|
-
|
|
101
|
-
cd #{blueprint_name}
|
|
102
|
-
|
|
103
|
-
More info: https://lono.cloud/docs/core/blueprints
|
|
104
|
-
|
|
105
|
-
EOL
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def tree
|
|
109
|
-
tree_structure("blueprint")
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# Reason: So `lono code import` prints out the params values with relative paths
|
|
113
|
-
# when the config files are generated.
|
|
114
|
-
def reset_current_dir
|
|
115
|
-
FileUtils.cd(@old_dir)
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
private
|
|
119
|
-
def directory_options
|
|
120
|
-
if ENV['LONO_README_FILE']
|
|
121
|
-
{exclude_pattern: /README/}
|
|
122
|
-
else
|
|
123
|
-
{}
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
data/lib/lono/blueprint/root.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require "bundler"
|
|
2
|
-
|
|
3
|
-
class Lono::Blueprint
|
|
4
|
-
module Root
|
|
5
|
-
# Switch the lono root
|
|
6
|
-
def set_blueprint_root(blueprint)
|
|
7
|
-
blueprint_root = find_blueprint_root(blueprint)
|
|
8
|
-
if blueprint_root
|
|
9
|
-
Lono.blueprint_root = blueprint_root
|
|
10
|
-
else
|
|
11
|
-
puts <<~EOL.color(:red)
|
|
12
|
-
ERROR: Unable to find the blueprint #{blueprint.inspect}.
|
|
13
|
-
Are you sure its in your Gemfile or in the blueprints folder with the correct name?
|
|
14
|
-
EOL
|
|
15
|
-
Lono::Finder::Blueprint.list
|
|
16
|
-
ENV['LONO_TEST'] ? raise("Unable to find blueprint: #{blueprint.inspect}") : exit(1)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def find_blueprint_root(blueprint)
|
|
21
|
-
config = Lono::Finder::Blueprint.find(blueprint) # blueprint_root
|
|
22
|
-
config.root if config
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
data/lib/lono/cfn/create.rb
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
require "yaml"
|
|
2
|
-
|
|
3
|
-
class Lono::Cfn
|
|
4
|
-
class Create < Base
|
|
5
|
-
# save is the interface method
|
|
6
|
-
# aws cloudformation create-stack --stack-name prod-hi-123456789 --parameters file://output/params/prod-hi-123456789.json --template-body file://output/prod-hi.json
|
|
7
|
-
def save(parameters)
|
|
8
|
-
message = "Creating #{@stack.color(:green)} stack."
|
|
9
|
-
if @options[:noop]
|
|
10
|
-
puts "NOOP #{message}"
|
|
11
|
-
return
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
delete_rollback_stack
|
|
15
|
-
|
|
16
|
-
if stack_exists?(@stack)
|
|
17
|
-
puts "Cannot create #{@stack.color(:green)} stack because it already exists.".color(:red)
|
|
18
|
-
return
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
unless File.exist?(template_path)
|
|
22
|
-
puts "Cannot create #{@stack.color(:green)} template not found: #{template_path}."
|
|
23
|
-
return
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
options = {
|
|
27
|
-
capabilities: capabilities, # ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]
|
|
28
|
-
disable_rollback: !@options[:rollback],
|
|
29
|
-
parameters: parameters,
|
|
30
|
-
stack_name: @stack,
|
|
31
|
-
}
|
|
32
|
-
options[:notification_arns] = notification_arns if notification_arns
|
|
33
|
-
options[:tags] = tags unless tags.empty?
|
|
34
|
-
set_template_url!(options)
|
|
35
|
-
|
|
36
|
-
show_options(options, "cfn.create_stack")
|
|
37
|
-
cfn.create_stack(options) # TODO: COMMENT OUT FOR TESTING
|
|
38
|
-
puts message unless @options[:mute]
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
data/lib/lono/cfn/opts.rb
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
class Lono::Cfn
|
|
2
|
-
class Opts < Lono::Opts
|
|
3
|
-
def create
|
|
4
|
-
notification_arns_option
|
|
5
|
-
base_options
|
|
6
|
-
wait_options
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def update
|
|
10
|
-
notification_arns_option
|
|
11
|
-
base_options
|
|
12
|
-
update_options
|
|
13
|
-
wait_options
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def deploy
|
|
17
|
-
update
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def delete
|
|
21
|
-
wait_options
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def cancel
|
|
25
|
-
wait_options
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def preview
|
|
29
|
-
base_options
|
|
30
|
-
update_options
|
|
31
|
-
with_cli_scope do
|
|
32
|
-
option :keep, type: :boolean, desc: "keep the changeset instead of deleting it afterwards"
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def download
|
|
37
|
-
base_options
|
|
38
|
-
with_cli_scope do
|
|
39
|
-
option :name, desc: "Name you want to save the template as. Default: existing stack name."
|
|
40
|
-
option :source, desc: "url or path to file with template"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# Lono::Cfn and Lono::Sets
|
|
45
|
-
def base_options(rollback: true)
|
|
46
|
-
with_cli_scope do
|
|
47
|
-
if rollback
|
|
48
|
-
option :rollback, type: :boolean, desc: "rollback", default: true
|
|
49
|
-
end
|
|
50
|
-
# common to Lono::Cfn and Lono::Sets
|
|
51
|
-
option :source, desc: "url or path to file with template"
|
|
52
|
-
option :blueprint, desc: "override convention and specify the template file to use"
|
|
53
|
-
option :capabilities, type: :array, desc: "iam capabilities. Ex: CAPABILITY_IAM, CAPABILITY_NAMED_IAM"
|
|
54
|
-
option :config, aliases: "c", desc: "override convention and specify both the param and variable file to use"
|
|
55
|
-
option :iam, type: :boolean, desc: "Shortcut for common IAM capabilities: CAPABILITY_IAM, CAPABILITY_NAMED_IAM"
|
|
56
|
-
option :param, aliases: "p", desc: "override convention and specify the param file to use"
|
|
57
|
-
option :tags, type: :hash, desc: "Tags for the stack. IE: Name:api-web Owner:bob"
|
|
58
|
-
option :template, desc: "override convention and specify the template file to use"
|
|
59
|
-
option :variable, aliases: "v", desc: "override convention and specify the variable file to use"
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def wait_options
|
|
64
|
-
with_cli_scope do
|
|
65
|
-
option :wait, type: :boolean, desc: "Wait for stack operation to complete.", default: true
|
|
66
|
-
option :sure, type: :boolean, desc: "Skip are you sure prompt" # moved to base but used by commands like `lono cfn delete` also. Just keep here.
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def update_options(change_set: true)
|
|
71
|
-
with_cli_scope do
|
|
72
|
-
if change_set
|
|
73
|
-
option :change_set, type: :boolean, default: true, desc: "Uses generated change set to update the stack. If false, will perform normal update-stack."
|
|
74
|
-
option :changeset_preview, type: :boolean, default: true, desc: "Show ChangeSet changes preview."
|
|
75
|
-
end
|
|
76
|
-
# common to Lono::Cfn and Lono::Sets
|
|
77
|
-
option :codediff_preview, type: :boolean, default: true, desc: "Show codediff changes preview."
|
|
78
|
-
option :param_preview, type: :boolean, default: true, desc: "Show parameter diff preview."
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def notification_arns_option
|
|
83
|
-
with_cli_scope do
|
|
84
|
-
option :notification_arns, type: :array, desc: "The Simple Notification Service (SNS) topic ARNs to publish stack related events."
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
module Lono::Cfn::Preview
|
|
2
|
-
class Changeset < Lono::Cfn::Base
|
|
3
|
-
# Override run from Base superclass, the run method is different enough with Preview
|
|
4
|
-
def run
|
|
5
|
-
puts "Changeset Preview:".color(:green)
|
|
6
|
-
|
|
7
|
-
if @options[:noop]
|
|
8
|
-
puts "NOOP CloudFormation preview for #{@stack} update"
|
|
9
|
-
return
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
parameters = generate_all
|
|
13
|
-
success = preview_change_set(parameters)
|
|
14
|
-
delete_change_set if success && !@options[:keep] # Clean up and delete the change set
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def preview_change_set(parameters)
|
|
18
|
-
success = create_change_set(parameters)
|
|
19
|
-
display_change_set if success
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def create_change_set(parameters)
|
|
23
|
-
unless stack_exists?(@stack)
|
|
24
|
-
puts "WARN: Cannot create a change set for the stack because the #{@stack} does not exists.".color(:yellow)
|
|
25
|
-
return false
|
|
26
|
-
end
|
|
27
|
-
exit_unless_updatable!
|
|
28
|
-
|
|
29
|
-
options = {
|
|
30
|
-
change_set_name: change_set_name,
|
|
31
|
-
stack_name: @stack,
|
|
32
|
-
parameters: parameters,
|
|
33
|
-
}
|
|
34
|
-
options[:notification_arns] = notification_arns if notification_arns
|
|
35
|
-
options[:tags] = tags unless tags.empty?
|
|
36
|
-
set_template_url!(options)
|
|
37
|
-
show_options(options, "cfn.create_change_set")
|
|
38
|
-
begin
|
|
39
|
-
# Tricky for preview need to set capabilities so that it gets updated. For Base#run save within the begin block already.
|
|
40
|
-
options[:capabilities] = capabilities # ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]
|
|
41
|
-
cfn.create_change_set(options)
|
|
42
|
-
rescue Aws::CloudFormation::Errors::InsufficientCapabilitiesException => e
|
|
43
|
-
# If coming from cfn_preview_command automatically add iam capabilities
|
|
44
|
-
cfn_preview_command = ARGV.join(" ").include?("cfn preview")
|
|
45
|
-
if cfn_preview_command
|
|
46
|
-
# e.message is "Requires capabilities : [CAPABILITY_IAM]"
|
|
47
|
-
# grab CAPABILITY_IAM with regexp
|
|
48
|
-
capabilities = e.message.match(/\[(.*)\]/)[1]
|
|
49
|
-
@options.merge!(capabilities: [capabilities])
|
|
50
|
-
retry
|
|
51
|
-
end
|
|
52
|
-
yes = rerun_with_iam?(e)
|
|
53
|
-
retry if yes
|
|
54
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
|
55
|
-
handle_error(e)
|
|
56
|
-
end
|
|
57
|
-
true
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# Example errors:
|
|
61
|
-
# "Template error: variable names in Fn::Sub syntax must contain only alphanumeric characters, underscores, periods, and colons"
|
|
62
|
-
def handle_error(e)
|
|
63
|
-
raise if ENV['FULL_BACKTRACE']
|
|
64
|
-
|
|
65
|
-
if e.message =~ /^Parameters: / || e.message =~ /^Template error: /
|
|
66
|
-
puts "Error creating CloudFormation preview because invalid CloudFormation parameters. Full error message:".color(:red)
|
|
67
|
-
puts e.message
|
|
68
|
-
puts "For full backtrace run command again with FULL_BACKTRACE=1"
|
|
69
|
-
quit(1)
|
|
70
|
-
else
|
|
71
|
-
raise
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def display_change_set
|
|
76
|
-
print "Generating CloudFormation Change Set for preview.."
|
|
77
|
-
change_set = describe_change_set
|
|
78
|
-
until change_set_finished?(change_set) do
|
|
79
|
-
change_set = describe_change_set
|
|
80
|
-
sleep 1
|
|
81
|
-
print '.'
|
|
82
|
-
end
|
|
83
|
-
puts
|
|
84
|
-
|
|
85
|
-
case change_set.status
|
|
86
|
-
when "CREATE_COMPLETE"
|
|
87
|
-
puts "CloudFormation preview for '#{@stack}' stack update. Changes:"
|
|
88
|
-
changes = change_set.changes.sort_by do |change|
|
|
89
|
-
change["resource_change"]["action"]
|
|
90
|
-
end
|
|
91
|
-
changes.each do |change|
|
|
92
|
-
display_change(change)
|
|
93
|
-
end
|
|
94
|
-
when "FAILED"
|
|
95
|
-
puts "WARN: Fail to create a CloudFormation preview for '#{@stack}' stack update. Reason:".color(:yellow)
|
|
96
|
-
puts change_set.status_reason
|
|
97
|
-
quit(0)
|
|
98
|
-
else
|
|
99
|
-
raise "hell: never come here"
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def delete_change_set
|
|
104
|
-
cfn.delete_change_set(
|
|
105
|
-
change_set_name: change_set_name,
|
|
106
|
-
stack_name: @stack
|
|
107
|
-
)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def execute_change_set
|
|
111
|
-
cfn.execute_change_set(
|
|
112
|
-
change_set_name: change_set_name,
|
|
113
|
-
stack_name: @stack
|
|
114
|
-
)
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# generates a change set name
|
|
118
|
-
def change_set_name
|
|
119
|
-
@change_set_name ||= "changeset-#{Time.now.strftime("%Y%d%m%H%M%S")}"
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
private
|
|
123
|
-
# Private: formats a Aws::CloudFormation::Types::Change in pretty human readable form
|
|
124
|
-
#
|
|
125
|
-
# change - Aws::CloudFormation::Types::Change
|
|
126
|
-
#
|
|
127
|
-
# Examples
|
|
128
|
-
#
|
|
129
|
-
# display_change(change)
|
|
130
|
-
# => Remove AWS::Route53::RecordSet: DnsRecord testsubdomain.sub.tongueroo.com
|
|
131
|
-
#
|
|
132
|
-
# Returns nil
|
|
133
|
-
#
|
|
134
|
-
# change.to_h
|
|
135
|
-
# {:type=>"Resource",
|
|
136
|
-
# :resource_change=>
|
|
137
|
-
# {:action=>"Remove",
|
|
138
|
-
# :logical_resource_id=>"DnsRecord",
|
|
139
|
-
# :physical_resource_id=>"testsubdomain.sub.tongueroo.com",
|
|
140
|
-
# :resource_type=>"AWS::Route53::RecordSet",
|
|
141
|
-
# :scope=>[],
|
|
142
|
-
# :details=>[]}}
|
|
143
|
-
def display_change(change)
|
|
144
|
-
message = if change.type == "Resource"
|
|
145
|
-
c = change.resource_change
|
|
146
|
-
"#{c.action} #{c.resource_type}: #{c.logical_resource_id} #{c.physical_resource_id}"
|
|
147
|
-
else
|
|
148
|
-
change.to_h
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
colors = { Remove: :red, Add: :green, Modify: :yellow }
|
|
152
|
-
action = change.resource_change.action.to_sym
|
|
153
|
-
message = message.color(colors[action]) if colors.has_key?(action)
|
|
154
|
-
puts message
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def change_set_finished?(change_set)
|
|
158
|
-
change_set.status =~ /_COMPLETE/ || change_set.status == "FAILED"
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
def describe_change_set
|
|
162
|
-
cfn.describe_change_set(
|
|
163
|
-
change_set_name: change_set_name,
|
|
164
|
-
stack_name: @stack
|
|
165
|
-
)
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
module Lono::Cfn::Preview
|
|
2
|
-
class Codediff < Lono::Cfn::Base
|
|
3
|
-
include DiffViewer
|
|
4
|
-
include Lono::AwsServices
|
|
5
|
-
|
|
6
|
-
def run
|
|
7
|
-
puts "Code Diff Preview:".color(:green)
|
|
8
|
-
|
|
9
|
-
unless stack_exists?(@stack)
|
|
10
|
-
puts "WARN: Cannot create a diff for the stack because the #{@stack} does not exists.".color(:yellow)
|
|
11
|
-
return
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
if @options[:noop]
|
|
15
|
-
puts "NOOP Generating CloudFormation source code diff..."
|
|
16
|
-
else
|
|
17
|
-
generate_all # from Base superclass. Generates the output lono teplates
|
|
18
|
-
puts "Generating CloudFormation source code diff..."
|
|
19
|
-
download_existing_cfn_template
|
|
20
|
-
show_diff(existing_template_path, new_cfn_template)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def download_existing_cfn_template
|
|
25
|
-
resp = cfn.get_template(
|
|
26
|
-
stack_name: @stack,
|
|
27
|
-
template_stage: "Original"
|
|
28
|
-
)
|
|
29
|
-
IO.write(existing_template_path, resp.template_body)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# for clarity
|
|
33
|
-
def new_cfn_template
|
|
34
|
-
template_path
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def existing_template_path
|
|
38
|
-
"/tmp/existing_stack.yml"
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module Lono::Cfn::Preview
|
|
2
|
-
module DiffViewer
|
|
3
|
-
def show_diff(existing_path, new_path)
|
|
4
|
-
command = "#{diff_viewer} #{existing_path} #{new_path}"
|
|
5
|
-
puts "Running: #{command}"
|
|
6
|
-
out = `#{command}`
|
|
7
|
-
if out.strip == ''
|
|
8
|
-
puts "There were no differences."
|
|
9
|
-
else
|
|
10
|
-
puts out
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def diff_viewer
|
|
15
|
-
return ENV['LONO_DIFF'] if ENV['LONO_DIFF']
|
|
16
|
-
colordiff_installed = system("type colordiff > /dev/null 2>&1")
|
|
17
|
-
unless colordiff_installed
|
|
18
|
-
puts "INFO: colordiff it not available. Recommend installing it."
|
|
19
|
-
end
|
|
20
|
-
colordiff_installed ? "colordiff" : "diff"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
data/lib/lono/cfn/rollback.rb
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
class Lono::Cfn
|
|
2
|
-
class Rollback
|
|
3
|
-
extend Memoist
|
|
4
|
-
include Lono::AwsServices
|
|
5
|
-
|
|
6
|
-
def initialize(stack)
|
|
7
|
-
@stack = stack
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def delete_stack
|
|
11
|
-
stack = find_stack(@stack)
|
|
12
|
-
if stack && rollback_complete?(stack)
|
|
13
|
-
puts "Existing stack in ROLLBACK_COMPLETE state. Deleting stack before continuing."
|
|
14
|
-
cfn.delete_stack(stack_name: @stack)
|
|
15
|
-
status.wait
|
|
16
|
-
status.reset
|
|
17
|
-
true
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def status
|
|
22
|
-
Lono::Cfn::Status.new(@stack)
|
|
23
|
-
end
|
|
24
|
-
memoize :status
|
|
25
|
-
end
|
|
26
|
-
end
|
data/lib/lono/cfn/update.rb
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
class Lono::Cfn
|
|
2
|
-
class Update < Base
|
|
3
|
-
# save is the interface method
|
|
4
|
-
# aws cloudformation update-stack --stack-name prod-hi-123456789 --parameters file://output/params/prod-hi-123456789.json --template-body file://output/prod-hi.json
|
|
5
|
-
def save(parameters)
|
|
6
|
-
message = "Updating #{@stack} stack"
|
|
7
|
-
if @options[:noop]
|
|
8
|
-
puts "NOOP #{message}"
|
|
9
|
-
return
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
deleted = delete_rollback_stack
|
|
13
|
-
if deleted
|
|
14
|
-
Create.new(@options).save(parameters)
|
|
15
|
-
return
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
unless stack_exists?(@stack)
|
|
19
|
-
puts "Cannot update a stack because the #{@stack} does not exists."
|
|
20
|
-
return
|
|
21
|
-
end
|
|
22
|
-
exit_unless_updatable!
|
|
23
|
-
|
|
24
|
-
options = @options.merge(mute_params: true, mute_using: true, keep: true)
|
|
25
|
-
# create new copy of preview when update_stack is called because of IAM retry logic
|
|
26
|
-
changeset_preview = Lono::Cfn::Preview::Changeset.new(options)
|
|
27
|
-
|
|
28
|
-
param_preview.run if @options[:param_preview]
|
|
29
|
-
codediff_preview.run if @options[:codediff_preview]
|
|
30
|
-
changeset_preview.run if @options[:changeset_preview]
|
|
31
|
-
sure?("Are you sure you want to update the #{@stack} stack?")
|
|
32
|
-
|
|
33
|
-
if @options[:change_set] # defaults to this
|
|
34
|
-
message << " via change set: #{changeset_preview.change_set_name}"
|
|
35
|
-
changeset_preview.execute_change_set
|
|
36
|
-
else
|
|
37
|
-
standard_update(parameters)
|
|
38
|
-
end
|
|
39
|
-
puts message unless @options[:mute]
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def standard_update(parameters)
|
|
43
|
-
options = {
|
|
44
|
-
stack_name: @stack,
|
|
45
|
-
parameters: parameters,
|
|
46
|
-
capabilities: capabilities, # ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]
|
|
47
|
-
disable_rollback: !@options[:rollback],
|
|
48
|
-
}
|
|
49
|
-
options[:notification_arns] = notification_arns if notification_arns
|
|
50
|
-
options[:tags] = tags unless tags.empty?
|
|
51
|
-
set_template_url!(options)
|
|
52
|
-
show_options(options, "cfn.update_stack")
|
|
53
|
-
begin
|
|
54
|
-
cfn.update_stack(options)
|
|
55
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
|
56
|
-
puts "ERROR: #{e.message}".color(:red)
|
|
57
|
-
false
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def codediff_preview
|
|
62
|
-
Lono::Cfn::Preview::Codediff.new(@options.merge(mute_params: true, mute_using: true))
|
|
63
|
-
end
|
|
64
|
-
memoize :codediff_preview
|
|
65
|
-
|
|
66
|
-
def param_preview
|
|
67
|
-
Lono::Cfn::Preview::Param.new(@options)
|
|
68
|
-
end
|
|
69
|
-
memoize :param_preview
|
|
70
|
-
end
|
|
71
|
-
end
|