lono 7.4.11 → 8.0.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +33 -5
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +5 -1
- data/LICENSE.txt +201 -1
- data/README.md +6 -5
- data/lib/lono/api/client.rb +3 -2
- data/lib/lono/app/inits.rb +13 -0
- data/lib/lono/app.rb +71 -0
- data/lib/lono/app_file/base.rb +1 -1
- data/lib/lono/app_file/build/lambda_layer/ruby_packager.rb +9 -9
- data/lib/lono/app_file/build/lambda_layer.rb +3 -3
- data/lib/lono/app_file/build.rb +9 -14
- data/lib/lono/app_file/registry/item.rb +4 -4
- data/lib/lono/app_file/upload.rb +1 -1
- data/lib/lono/autoloader.rb +2 -2
- data/lib/lono/aws_services/helper.rb +43 -6
- data/lib/lono/aws_services.rb +37 -6
- data/lib/lono/blueprint.rb +18 -9
- data/lib/lono/booter.rb +28 -0
- data/lib/lono/{template → builder}/context/helpers.rb +1 -1
- data/lib/lono/{template → builder}/context/loader/load_files.rb +5 -6
- data/lib/lono/builder/context/loader.rb +35 -0
- data/lib/lono/builder/context/params.rb +7 -0
- data/lib/lono/{template → builder}/context/ssm_fetcher.rb +1 -1
- data/lib/lono/{template → builder}/context.rb +5 -9
- data/lib/lono/{param/generator.rb → builder/param.rb} +21 -22
- data/lib/lono/builder/template/aws_service.rb +15 -0
- data/lib/lono/builder/template/bashify.rb +43 -0
- data/lib/lono/{template → builder/template}/configset_injector.rb +4 -4
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/fn.rb +2 -2
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/core_helper.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/ec2_helper.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/file_helper.rb +8 -12
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/s3_helper.rb +2 -2
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/stack_helper.rb +11 -8
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers/tags_helper.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/helpers.rb +2 -2
- data/lib/lono/builder/template/dsl/evaluator/section/base.rb +23 -0
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/condition.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/mapping.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/methods.rb +7 -7
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/output.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/parameter.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/resource/property_mover.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/resource.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/section/section.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/squeezer.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/stringify.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/syntax/extend_with.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/syntax/parameter_group.rb +1 -1
- data/lib/lono/{template/strategy/dsl/builder → builder/template/dsl/evaluator}/syntax.rb +3 -3
- data/lib/lono/builder/template/dsl/evaluator.rb +45 -0
- data/lib/lono/{template/strategy → builder/template}/dsl/finalizer/parameter_groups.rb +2 -2
- data/lib/lono/{template/strategy → builder/template}/dsl/finalizer.rb +1 -1
- data/lib/lono/builder/template/dsl.rb +14 -0
- data/lib/lono/{template → builder/template}/evaluate.rb +18 -6
- data/lib/lono/builder/template/helpers.rb +149 -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/{template → builder/template}/upload.rb +3 -5
- data/lib/lono/builder/template.rb +55 -0
- 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 +19 -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 +34 -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 -196
- data/lib/lono/cfn/cancel.rb +9 -26
- 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 +49 -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 +71 -5
- data/lib/lono/cfn/download.rb +5 -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 +52 -0
- data/lib/lono/cfn/plan/diff/file.rb +56 -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 +33 -0
- data/lib/lono/cfn/show.rb +30 -0
- data/lib/lono/cfn/status.rb +1 -1
- data/lib/lono/cli/abstract.rb +17 -0
- data/lib/lono/cli/base.rb +9 -0
- data/lib/lono/cli/build.rb +101 -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 +22 -0
- data/lib/lono/{code.rb → cli/code.rb} +2 -2
- 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 -0
- 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/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/{help → cli/help}/seed.md +2 -2
- 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 +28 -0
- data/lib/lono/cli/new/blueprint.rb +33 -0
- data/lib/lono/cli/new/concerns.rb +16 -0
- data/lib/lono/{configset/new.rb → cli/new/configset.rb} +2 -9
- data/lib/lono/{extension/new.rb → cli/new/extension.rb} +2 -10
- data/lib/lono/cli/new/helper.rb +32 -0
- data/lib/lono/cli/new/project.rb +77 -0
- data/lib/lono/cli/new/sequence.rb +51 -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 +31 -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/test.rb +35 -0
- data/lib/lono/cli.rb +80 -106
- data/lib/lono/command.rb +27 -0
- data/lib/lono/configset/{generator.rb → builder.rb} +9 -7
- data/lib/lono/configset/combiner.rb +8 -6
- data/lib/lono/configset/evaluate_file.rb +1 -1
- data/lib/lono/configset/meta.rb +1 -1
- data/lib/lono/configset/s3_file/build.rb +5 -4
- data/lib/lono/configset/s3_file/item.rb +1 -1
- data/lib/lono/configset/s3_file/upload.rb +2 -2
- data/lib/lono/configset/strategy/base.rb +6 -6
- data/lib/lono/configset/strategy/helpers/dsl/core.rb +1 -1
- data/lib/lono/core.rb +25 -54
- data/lib/lono/extensions/dsl.rb +2 -5
- data/lib/lono/extensions/loader.rb +1 -12
- data/lib/lono/extensions.rb +2 -2
- data/lib/lono/importer/base.rb +5 -5
- data/lib/lono/importer/download.rb +7 -7
- data/lib/lono/importer/dsl.rb +3 -3
- data/lib/lono/importer/service/coder.rb +10 -10
- data/lib/lono/importer.rb +1 -10
- data/lib/lono/inspector/base.rb +7 -7
- data/lib/lono/inspector/summary.rb +19 -17
- data/lib/lono/layering/layer.rb +126 -0
- data/lib/lono/layering.rb +13 -55
- data/lib/lono/logger/formatter.rb +13 -0
- data/lib/lono/logger.rb +33 -0
- data/lib/lono/lookup.rb +12 -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 +19 -19
- data/lib/lono/s3/uploader.rb +10 -12
- 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/{seed → seeder}/service_role.rb +1 -1
- data/lib/lono/{seed/base.rb → seeder.rb} +21 -36
- data/lib/lono/user_data.rb +8 -13
- data/lib/lono/utils/context.rb +15 -0
- data/lib/lono/utils/item/zip.rb +5 -5
- 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.rb +7 -11
- data/lib/templates/blueprint/template.rb +2 -0
- data/lib/templates/configset/{lib/configset.rb → configset.rb} +0 -0
- data/lib/templates/examples/blueprint/template.rb +9 -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 -43
- metadata +261 -264
- 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/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/configset/list.rb +0 -67
- 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.rb +0 -16
- 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/ext/bundler.rb +0 -7
- 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/preparer.rb +0 -26
- data/lib/lono/extensions/register.rb +0 -15
- 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 -107
- 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/sets/delete.md +0 -8
- data/lib/lono/help/sets/deploy.md +0 -76
- data/lib/lono/help/sets/instances/delete.md +0 -21
- data/lib/lono/help/sets/instances/list.md +0 -14
- data/lib/lono/help/sets/instances/status.md +0 -15
- data/lib/lono/help/sets/instances/sync.md +0 -90
- 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.rb +0 -39
- data/lib/lono/sequence.rb +0 -35
- data/lib/lono/sets/base.rb +0 -50
- data/lib/lono/sets/create.rb +0 -30
- data/lib/lono/sets/delete.rb +0 -52
- data/lib/lono/sets/deploy.rb +0 -11
- data/lib/lono/sets/instances/base.rb +0 -30
- data/lib/lono/sets/instances/delete.rb +0 -69
- data/lib/lono/sets/instances/list.rb +0 -13
- data/lib/lono/sets/instances/opts.rb +0 -29
- data/lib/lono/sets/instances/status.rb +0 -12
- data/lib/lono/sets/instances/sync.rb +0 -180
- data/lib/lono/sets/instances.rb +0 -33
- 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 -133
- data/lib/lono/sets/status.rb +0 -116
- data/lib/lono/sets/summarize.rb +0 -20
- data/lib/lono/sets/time_spent.rb +0 -11
- data/lib/lono/sets/update.rb +0 -81
- data/lib/lono/sets.rb +0 -38
- 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/context/loader.rb +0 -52
- 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/section/base.rb +0 -30
- data/lib/lono/template/strategy/dsl/builder.rb +0 -59
- 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/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/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
@@ -1,29 +0,0 @@
|
|
1
|
-
ENV["<%= extension_underscore_name.upcase %>_TEST"] = "1"
|
2
|
-
|
3
|
-
# CodeClimate test coverage: https://docs.codeclimate.com/docs/configuring-test-coverage
|
4
|
-
# require 'simplecov'
|
5
|
-
# SimpleCov.start
|
6
|
-
|
7
|
-
require "pp"
|
8
|
-
require "byebug"
|
9
|
-
root = File.expand_path("../", File.dirname(__FILE__))
|
10
|
-
require "#{root}/lib/<%= extension_name %>"
|
11
|
-
|
12
|
-
module Helper
|
13
|
-
def execute(cmd)
|
14
|
-
puts "Running: #{cmd}" if show_command?
|
15
|
-
out = `#{cmd}`
|
16
|
-
puts out if show_command?
|
17
|
-
out
|
18
|
-
end
|
19
|
-
|
20
|
-
# Added SHOW_COMMAND because DEBUG is also used by other libraries like
|
21
|
-
# bundler and it shows its internal debugging logging also.
|
22
|
-
def show_command?
|
23
|
-
ENV['DEBUG'] || ENV['SHOW_COMMAND']
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
RSpec.configure do |c|
|
28
|
-
c.include Helper
|
29
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# Lono CloudFormation Starter README
|
2
|
-
|
3
|
-
This folder contains the code that represents your infrastructure built with CloudFormation.
|
4
|
-
|
5
|
-
## Overview
|
6
|
-
|
7
|
-
The CloudFormations templates are generated by a tool called [lono](https://lono.cloud/).
|
8
|
-
|
9
|
-
## Updating the Infrastructure
|
10
|
-
|
11
|
-
The general steps to update the infrastructure:
|
12
|
-
|
13
|
-
1. Add and edit the blueprints
|
14
|
-
2. Generate CloudFormation templates
|
15
|
-
3. Deploy the stack
|
16
|
-
|
17
|
-
Steps 2-3 are automated with lono and performed together with:
|
18
|
-
|
19
|
-
lono cfn deploy STACK_NAME
|
20
|
-
|
21
|
-
Here are some useful flags:
|
22
|
-
|
23
|
-
lono cfn deploy STACK_NAME --sure
|
24
|
-
|
25
|
-
More info: [lono cfn deploy](https://lono.cloud/reference/lono-cfn-deploy/)
|
26
|
-
|
27
|
-
## Structure
|
28
|
-
|
29
|
-
The structure of a lono project looks like this:
|
30
|
-
|
31
|
-
More info: [Project Structure](https://lono.cloud/docs/structure/)
|
32
|
-
|
33
|
-
## Generating Templates from Blueprints
|
34
|
-
|
35
|
-
If you would like to just generate the templates and not update the CloudFormation stack you can do so with:
|
36
|
-
|
37
|
-
lono generate BLUEPRINT_NAME
|
38
|
-
|
39
|
-
## Configs
|
40
|
-
|
41
|
-
You may want to take a look at the configs folder to change params and variables. For example:
|
42
|
-
|
43
|
-
* configs/demo/params
|
44
|
-
* configs/demo/variables
|
45
|
-
|
46
|
-
## Deploy
|
47
|
-
|
48
|
-
To launch the stack:
|
49
|
-
|
50
|
-
lono cfn deploy demo
|
51
|
-
|
52
|
-
## More help
|
53
|
-
|
54
|
-
You can get help by adding `-h` to the end of commands.
|
55
|
-
|
56
|
-
lono cfn update -h
|
57
|
-
|
58
|
-
Help is also provided in the [Lono Docs](https://lono.cloud/docs/).
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# More info: https://lono.cloud/docs/settings/
|
2
|
-
# The base config is specially treated. It gets included the other environments automatically.
|
3
|
-
# Yaml also directly supports merging with & and <<* syntax but doing it automatically
|
4
|
-
# for a cleaner syntax.
|
5
|
-
base:
|
6
|
-
|
7
|
-
development:
|
8
|
-
# The aws_profile tightly binds LONO_ENV to AWS_PROFILE and vice-versa.
|
9
|
-
# aws_profile: dev
|
10
|
-
|
11
|
-
production:
|
12
|
-
# The aws_profile tightly binds LONO_ENV to AWS_PROFILE and vice-versa.
|
13
|
-
# aws_profile: prd
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Change Log
|
2
|
-
|
3
|
-
All notable changes to this project will be documented in this file.
|
4
|
-
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
|
-
|
6
|
-
## [UNRELEASED]
|
7
|
-
- #1 Breaking change: rename Rename to CfnStatus, cfn/status to cfn_status
|
8
|
-
- Handle large templates and long stack_events via paginating the cfn.describe_stack_events until
|
9
|
-
|
10
|
-
## [0.2.0]
|
11
|
-
- allow require "cfn-status" to work also
|
12
|
-
|
13
|
-
## [0.1.0]
|
14
|
-
- Initial release
|
data/vendor/cfn-status/Gemfile
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
cfn-status (0.2.0)
|
5
|
-
aws-sdk-cloudformation
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
aws-eventstream (1.0.3)
|
11
|
-
aws-partitions (1.246.0)
|
12
|
-
aws-sdk-cloudformation (1.29.0)
|
13
|
-
aws-sdk-core (~> 3, >= 3.71.0)
|
14
|
-
aws-sigv4 (~> 1.1)
|
15
|
-
aws-sdk-core (3.82.0)
|
16
|
-
aws-eventstream (~> 1.0, >= 1.0.2)
|
17
|
-
aws-partitions (~> 1, >= 1.239.0)
|
18
|
-
aws-sigv4 (~> 1.1)
|
19
|
-
jmespath (~> 1.0)
|
20
|
-
aws-sigv4 (1.1.0)
|
21
|
-
aws-eventstream (~> 1.0, >= 1.0.2)
|
22
|
-
diff-lcs (1.3)
|
23
|
-
jmespath (1.4.0)
|
24
|
-
rake (10.5.0)
|
25
|
-
rspec (3.9.0)
|
26
|
-
rspec-core (~> 3.9.0)
|
27
|
-
rspec-expectations (~> 3.9.0)
|
28
|
-
rspec-mocks (~> 3.9.0)
|
29
|
-
rspec-core (3.9.0)
|
30
|
-
rspec-support (~> 3.9.0)
|
31
|
-
rspec-expectations (3.9.0)
|
32
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.9.0)
|
34
|
-
rspec-mocks (3.9.0)
|
35
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.9.0)
|
37
|
-
rspec-support (3.9.0)
|
38
|
-
|
39
|
-
PLATFORMS
|
40
|
-
ruby
|
41
|
-
|
42
|
-
DEPENDENCIES
|
43
|
-
bundler (~> 2.0)
|
44
|
-
cfn-status!
|
45
|
-
rake (~> 10.0)
|
46
|
-
rspec (~> 3.0)
|
47
|
-
|
48
|
-
BUNDLED WITH
|
49
|
-
2.0.2
|
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2019 Tung Nguyen
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/vendor/cfn-status/README.md
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# Cfn Status
|
2
|
-
|
3
|
-
[![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
|
4
|
-
|
5
|
-
Helper library provides status of CloudFormation stack.
|
6
|
-
|
7
|
-
## Usage
|
8
|
-
|
9
|
-
Add this line to your gem's gemspec:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem.add_development_dependency "cfn-status"
|
13
|
-
```
|
14
|
-
|
15
|
-
Require it to your library:
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
require "cfn_status"
|
19
|
-
```
|
20
|
-
|
21
|
-
Use like so:
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
status = CfnStatus.new(stack_name)
|
25
|
-
status.run # prints out stack events
|
26
|
-
```
|
27
|
-
|
28
|
-
The `status.run` will:
|
29
|
-
|
30
|
-
* print out the most recent stack events and return right away if the stack is in a completed state.
|
31
|
-
* print out the most recent stack events and poll for more events until the stack in a completed state.
|
32
|
-
|
33
|
-
To find out whether the most recent completed state of the stack was a success or a fail, you can use `status.success?`.
|
34
|
-
|
35
|
-
```ruby
|
36
|
-
status.success?
|
37
|
-
```
|
38
|
-
|
39
|
-
If you need to just wait for the stack to complete, you can also use `status.wait`.
|
40
|
-
|
41
|
-
```ruby
|
42
|
-
status.wait
|
43
|
-
status.success?
|
44
|
-
```
|
45
|
-
|
46
|
-
## Development
|
47
|
-
|
48
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
49
|
-
|
50
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
51
|
-
|
52
|
-
## Contributing
|
53
|
-
|
54
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cfn-status.
|
55
|
-
|
56
|
-
## License
|
57
|
-
|
58
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/vendor/cfn-status/Rakefile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "cfn_status"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/vendor/cfn-status/bin/setup
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "cfn_status/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "cfn-status"
|
8
|
-
spec.version = CfnStatus::VERSION
|
9
|
-
spec.authors = ["Tung Nguyen"]
|
10
|
-
spec.email = ["tongueroo@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = "CloudFormation status library"
|
13
|
-
spec.homepage = "https://github.com/tongueroo/cfn-status"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
end
|
21
|
-
spec.bindir = "exe"
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = ["lib"]
|
24
|
-
|
25
|
-
spec.add_dependency "aws-sdk-cloudformation"
|
26
|
-
|
27
|
-
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require "cfn_status"
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require "aws-sdk-cloudformation"
|
2
|
-
|
3
|
-
class CfnStatus
|
4
|
-
module AwsService
|
5
|
-
def cfn
|
6
|
-
@cfn ||= Aws::CloudFormation::Client.new
|
7
|
-
end
|
8
|
-
|
9
|
-
def stack_exists?(stack_name)
|
10
|
-
return true if ENV['TEST']
|
11
|
-
return false if @options[:noop]
|
12
|
-
|
13
|
-
exist = nil
|
14
|
-
begin
|
15
|
-
# When the stack does not exist an exception is raised. Example:
|
16
|
-
# Aws::CloudFormation::Errors::ValidationError: Stack with id blah does not exist
|
17
|
-
cfn.describe_stacks(stack_name: stack_name)
|
18
|
-
exist = true
|
19
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
20
|
-
if e.message =~ /does not exist/
|
21
|
-
exist = false
|
22
|
-
elsif e.message.include?("'stackName' failed to satisfy constraint")
|
23
|
-
# Example of e.message when describe_stack with invalid stack name
|
24
|
-
# "1 validation error detected: Value 'instance_and_route53' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*"
|
25
|
-
puts "Invalid stack name: #{stack_name}"
|
26
|
-
puts "Full error message: #{e.message}"
|
27
|
-
exit 1
|
28
|
-
else
|
29
|
-
raise # re-raise exception because unsure what other errors can happen
|
30
|
-
end
|
31
|
-
end
|
32
|
-
exist
|
33
|
-
end
|
34
|
-
|
35
|
-
def find_stack(stack_name)
|
36
|
-
resp = cfn.describe_stacks(stack_name: stack_name)
|
37
|
-
resp.stacks.first
|
38
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
39
|
-
# example: Stack with id demo-web does not exist
|
40
|
-
if e.message =~ /Stack with/ && e.message =~ /does not exist/
|
41
|
-
nil
|
42
|
-
else
|
43
|
-
raise
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def rollback_complete?(stack)
|
48
|
-
stack&.stack_status == 'ROLLBACK_COMPLETE'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,245 +0,0 @@
|
|
1
|
-
require "cfn_status/version"
|
2
|
-
|
3
|
-
class CfnStatus
|
4
|
-
class Error < StandardError; end
|
5
|
-
|
6
|
-
autoload :AwsService, "cfn_status/aws_service"
|
7
|
-
include AwsService
|
8
|
-
|
9
|
-
attr_reader :events
|
10
|
-
def initialize(stack_name, options={})
|
11
|
-
@stack_name = stack_name
|
12
|
-
@options = options
|
13
|
-
reset
|
14
|
-
end
|
15
|
-
|
16
|
-
def run
|
17
|
-
unless stack_exists?(@stack_name)
|
18
|
-
puts "The stack #{@stack_name.color(:green)} does not exist."
|
19
|
-
return true
|
20
|
-
end
|
21
|
-
|
22
|
-
resp = cfn.describe_stacks(stack_name: @stack_name)
|
23
|
-
stack = resp.stacks.first
|
24
|
-
|
25
|
-
puts "The current status for the stack #{@stack_name.color(:green)} is #{stack.stack_status.color(:green)}"
|
26
|
-
if stack.stack_status =~ /_IN_PROGRESS$/
|
27
|
-
puts "Stack events (tailing):"
|
28
|
-
# tail all events until done
|
29
|
-
@hide_time_took = true
|
30
|
-
wait
|
31
|
-
else
|
32
|
-
puts "Stack events:"
|
33
|
-
# show the last events that was user initiated
|
34
|
-
refresh_events
|
35
|
-
show_events(final: true)
|
36
|
-
end
|
37
|
-
success?
|
38
|
-
end
|
39
|
-
|
40
|
-
def reset
|
41
|
-
@events = [] # constantly replaced with recent events
|
42
|
-
@last_shown_event_id = nil
|
43
|
-
@stack_deletion_completed = nil
|
44
|
-
end
|
45
|
-
|
46
|
-
# check for /(_COMPLETE|_FAILED)$/ status
|
47
|
-
def wait
|
48
|
-
puts "Waiting for stack to complete"
|
49
|
-
start_time = Time.now
|
50
|
-
|
51
|
-
refresh_events
|
52
|
-
until completed || @stack_deletion_completed
|
53
|
-
show_events(final: false)
|
54
|
-
end
|
55
|
-
show_events(final: true) # show the final event
|
56
|
-
|
57
|
-
if @stack_deletion_completed
|
58
|
-
puts "Stack #{@stack_name} deleted."
|
59
|
-
return
|
60
|
-
end
|
61
|
-
|
62
|
-
# Never gets beyond here when deleting a stack because the describe stack returns nothing
|
63
|
-
# once the stack is deleted. Gets here for stack create and update though.
|
64
|
-
|
65
|
-
if last_event_status =~ /_FAILED/
|
66
|
-
puts "Stack failed: #{last_event_status}".color(:red)
|
67
|
-
puts "Stack reason #{@events[0]["resource_status_reason"]}".color(:red)
|
68
|
-
elsif last_event_status =~ /_ROLLBACK_/
|
69
|
-
puts "Stack rolled back: #{last_event_status}".color(:red)
|
70
|
-
else # success
|
71
|
-
puts "Stack success status: #{last_event_status}".color(:green)
|
72
|
-
end
|
73
|
-
|
74
|
-
return if @hide_time_took # set in run
|
75
|
-
took = Time.now - start_time
|
76
|
-
puts "Time took for stack deployment: #{pretty_time(took).color(:green)}."
|
77
|
-
success?
|
78
|
-
end
|
79
|
-
|
80
|
-
def completed
|
81
|
-
last_event_status =~ /(_COMPLETE|_FAILED)$/ &&
|
82
|
-
@events[0]["logical_resource_id"] == @stack_name &&
|
83
|
-
@events[0]["resource_type"] == "AWS::CloudFormation::Stack"
|
84
|
-
end
|
85
|
-
|
86
|
-
def last_event_status
|
87
|
-
@events.dig(0, "resource_status")
|
88
|
-
end
|
89
|
-
|
90
|
-
# Only shows new events
|
91
|
-
def show_events(final: false)
|
92
|
-
if @last_shown_event_id.nil?
|
93
|
-
i = start_index
|
94
|
-
print_events(i)
|
95
|
-
else
|
96
|
-
i = last_shown_index
|
97
|
-
# puts "last_shown index #{i}"
|
98
|
-
print_events(i-1) unless i == 0
|
99
|
-
end
|
100
|
-
|
101
|
-
return if final
|
102
|
-
sleep 5 unless ENV['TEST']
|
103
|
-
refresh_events
|
104
|
-
end
|
105
|
-
|
106
|
-
def print_events(i)
|
107
|
-
@events[0..i].reverse.each do |e|
|
108
|
-
print_event(e)
|
109
|
-
end
|
110
|
-
|
111
|
-
@last_shown_event_id = @events[0]["event_id"]
|
112
|
-
# puts "@last_shown_event_id #{@last_shown_event_id.inspect}"
|
113
|
-
end
|
114
|
-
|
115
|
-
def print_event(e)
|
116
|
-
message = [
|
117
|
-
event_time(e["timestamp"]),
|
118
|
-
e["resource_status"],
|
119
|
-
e["resource_type"],
|
120
|
-
e["logical_resource_id"],
|
121
|
-
e["resource_status_reason"]
|
122
|
-
].join(" ")
|
123
|
-
message = message.color(:red) if e["resource_status"] =~ /_FAILED/
|
124
|
-
puts message
|
125
|
-
end
|
126
|
-
|
127
|
-
# https://stackoverflow.com/questions/18000432/rails-12-hour-am-pm-range-for-a-day
|
128
|
-
def event_time(timestamp)
|
129
|
-
Time.parse(timestamp.to_s).localtime.strftime("%I:%M:%S%p")
|
130
|
-
end
|
131
|
-
|
132
|
-
# Refreshes the @events in memory.
|
133
|
-
#
|
134
|
-
def refresh_events
|
135
|
-
resp = cfn.describe_stack_events(stack_name: @stack_name)
|
136
|
-
@events = resp["stack_events"]
|
137
|
-
|
138
|
-
# refresh_events uses add_events_pages and resp["next_token"] to load all events until:
|
139
|
-
#
|
140
|
-
# 1. @last_shown_event_id found - if @last_shown_event_id is set
|
141
|
-
# 2. User Initiated Event found - fallback when @last_shown_event_id is not set
|
142
|
-
#
|
143
|
-
if @last_shown_event_id
|
144
|
-
add_events_pages(resp, :last_shown_index)
|
145
|
-
else
|
146
|
-
add_events_pages(resp, :start_index)
|
147
|
-
end
|
148
|
-
|
149
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
150
|
-
if e.message =~ /Stack .* does not exis/
|
151
|
-
@stack_deletion_completed = true
|
152
|
-
else
|
153
|
-
raise
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
# Examples:
|
158
|
-
#
|
159
|
-
# add_events_pages(:start_index)
|
160
|
-
# add_events_pages(:last_shown_index)
|
161
|
-
#
|
162
|
-
# if index_method is start_index
|
163
|
-
# loops add_events_pagess through describe_stack_events until "User Initiated" is found
|
164
|
-
#
|
165
|
-
# if index_method is last_shown_index
|
166
|
-
# loops add_events_pagess through describe_stack_events until last_shown_index is found
|
167
|
-
#
|
168
|
-
def add_events_pages(resp, index_method)
|
169
|
-
found = !!send(index_method)
|
170
|
-
until found
|
171
|
-
resp = cfn.describe_stack_events(stack_name: @stack_name, next_token: resp["next_token"])
|
172
|
-
@events += resp["stack_events"]
|
173
|
-
found = !!send(index_method)
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
# Should always find a "User Initiated" stack event when @last_shown_index is not set
|
178
|
-
def start_index
|
179
|
-
@events.find_index do |event|
|
180
|
-
event["resource_type"] == "AWS::CloudFormation::Stack" &&
|
181
|
-
event["resource_status_reason"] == "User Initiated"
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
def last_shown_index
|
186
|
-
@events.find_index do |event|
|
187
|
-
event["event_id"] == @last_shown_event_id
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def success?
|
192
|
-
resource_status = @events[0]["resource_status"]
|
193
|
-
%w[CREATE_COMPLETE UPDATE_COMPLETE].include?(resource_status)
|
194
|
-
end
|
195
|
-
|
196
|
-
def update_rollback?
|
197
|
-
@events[0]["resource_status"] == "UPDATE_ROLLBACK_COMPLETE"
|
198
|
-
end
|
199
|
-
|
200
|
-
def find_update_failed_event
|
201
|
-
i = @events.find_index do |event|
|
202
|
-
event["resource_type"] == "AWS::CloudFormation::Stack" &&
|
203
|
-
event["resource_status_reason"] == "User Initiated"
|
204
|
-
end
|
205
|
-
|
206
|
-
@events[0..i].reverse.find do |e|
|
207
|
-
e["resource_status"] == "UPDATE_FAILED"
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
def rollback_error_message
|
212
|
-
return unless update_rollback?
|
213
|
-
|
214
|
-
event = find_update_failed_event
|
215
|
-
return unless event
|
216
|
-
|
217
|
-
reason = event["resource_status_reason"]
|
218
|
-
messages_map.each do |pattern, message|
|
219
|
-
if reason =~ pattern
|
220
|
-
return message
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
reason # default message is original reason if not found in messages map
|
225
|
-
end
|
226
|
-
|
227
|
-
def messages_map
|
228
|
-
{
|
229
|
-
/CloudFormation cannot update a stack when a custom-named resource requires replacing/ => "A workaround is to run ufo again with STATIC_NAME=0 and to switch to dynamic names for resources. Then run ufo again with STATIC_NAME=1 to get back to statically name resources. Note, there are caveats with the workaround.",
|
230
|
-
/cannot be associated with more than one load balancer/ => "There's was an issue updating the stack. Target groups can only be associated with one load balancer at a time. The workaround for this is to use UFO_FORCE_TARGET_GROUP=1 and run the command again. This will force the recreation of the target group resource.",
|
231
|
-
/SetSubnets is not supported for load balancers of type/ => "Changing subnets for Network Load Balancers is currently not supported. You can try workarouding this with UFO_FORCE_ELB=1 and run the command again. This will force the recreation of the elb resource."
|
232
|
-
}
|
233
|
-
end
|
234
|
-
|
235
|
-
# http://stackoverflow.com/questions/4175733/convert-duration-to-hoursminutesseconds-or-similar-in-rails-3-or-ruby
|
236
|
-
def pretty_time(total_seconds)
|
237
|
-
minutes = (total_seconds / 60) % 60
|
238
|
-
seconds = total_seconds % 60
|
239
|
-
if total_seconds < 60
|
240
|
-
"#{seconds.to_i}s"
|
241
|
-
else
|
242
|
-
"#{minutes.to_i}m #{seconds.to_i}s"
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|