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
data/lib/lono/sets/instances.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
class Instances < Lono::Command
|
3
|
-
opts = Opts.new(self)
|
4
|
-
|
5
|
-
desc "delete STACK_SET", "Delete CloudFormation stack set instances."
|
6
|
-
long_desc Lono::Help.text("sets/instances/delete")
|
7
|
-
opts.delete
|
8
|
-
def delete(stack)
|
9
|
-
Delete.new(options.merge(stack: stack)).run
|
10
|
-
end
|
11
|
-
|
12
|
-
desc "sync STACK_SET", "Sync CloudFormation stack set instances."
|
13
|
-
long_desc Lono::Help.text("sets/instances/sync")
|
14
|
-
opts.sync
|
15
|
-
def sync(stack)
|
16
|
-
Sync.new(options.merge(stack: stack)).run
|
17
|
-
end
|
18
|
-
|
19
|
-
desc "list STACK_SET", "List CloudFormation stack set instances."
|
20
|
-
long_desc Lono::Help.text("sets/instances/list")
|
21
|
-
def list(stack)
|
22
|
-
List.new(options.merge(stack: stack)).run
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "status STACK_SET", "Show current status of stack instances."
|
26
|
-
long_desc Lono::Help.text("sets/instances/status")
|
27
|
-
def status(stack)
|
28
|
-
instances_status = Status.new(options.merge(stack: stack))
|
29
|
-
success = instances_status.run
|
30
|
-
exit 3 unless success
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/lib/lono/sets/list.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require "text-table"
|
2
|
-
|
3
|
-
class Lono::Sets
|
4
|
-
class List
|
5
|
-
include Lono::AwsServices
|
6
|
-
|
7
|
-
def initialize(options={})
|
8
|
-
@options = options
|
9
|
-
end
|
10
|
-
|
11
|
-
def run
|
12
|
-
table = Text::Table.new
|
13
|
-
table.head = ["Stack Set Name", "Status"]
|
14
|
-
summaries = stack_sets_summaries
|
15
|
-
summaries.each do |s|
|
16
|
-
table.rows << [s.stack_set_name, s.status]
|
17
|
-
end
|
18
|
-
puts table
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
def stack_sets_summaries
|
23
|
-
next_token, summaries = :start, []
|
24
|
-
while next_token
|
25
|
-
o = {}
|
26
|
-
o[:next_token] = next_token unless next_token == :start or next_token.nil?
|
27
|
-
o[:status] = @options[:status].upcase if @options[:status] && @options[:status] != "all"
|
28
|
-
resp = cfn.list_stack_sets(o)
|
29
|
-
next_token = resp.next_token
|
30
|
-
summaries += resp.summaries
|
31
|
-
end
|
32
|
-
summaries
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/lono/sets/opts.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
class Opts < Lono::Cfn::Opts
|
3
|
-
def deploy
|
4
|
-
super
|
5
|
-
operation_preferences_options
|
6
|
-
end
|
7
|
-
|
8
|
-
def operation_preferences_options
|
9
|
-
with_cli_scope do
|
10
|
-
option :region_order, type: :array, desc: "region_order"
|
11
|
-
option :failure_tolerance_count, type: :numeric, desc: "failure_tolerance_count"
|
12
|
-
option :failure_tolerance_percentage, type: :numeric, desc: "failure_tolerance_percentage"
|
13
|
-
option :max_concurrent_count, type: :numeric, desc: "max_concurrent_count"
|
14
|
-
option :max_concurrent_percentage, type: :numeric, desc: "max_concurrent_percentage"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Lono::Sets::Preview
|
2
|
-
class Codediff < Lono::Sets::Base
|
3
|
-
include Lono::Cfn::Preview::DiffViewer
|
4
|
-
|
5
|
-
def run
|
6
|
-
unless stack_set_exists?(@stack)
|
7
|
-
puts "WARN: Cannot create a diff for the stack set because the #{@stack} does not exists.".color(:yellow)
|
8
|
-
return
|
9
|
-
end
|
10
|
-
|
11
|
-
if @options[:noop]
|
12
|
-
puts "NOOP Generating CloudFormation source code diff..."
|
13
|
-
else
|
14
|
-
generate_all # from Base superclass. Generates the output lono teplates
|
15
|
-
puts "Generating CloudFormation source code diff..."
|
16
|
-
download_existing_cfn_template
|
17
|
-
show_diff(existing_template_path, new_cfn_template)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def download_existing_cfn_template
|
22
|
-
resp = cfn.describe_stack_set(stack_set_name: @stack)
|
23
|
-
IO.write(existing_template_path, resp.stack_set.template_body)
|
24
|
-
end
|
25
|
-
|
26
|
-
# for clarity
|
27
|
-
def new_cfn_template
|
28
|
-
template_path
|
29
|
-
end
|
30
|
-
|
31
|
-
def existing_template_path
|
32
|
-
"/tmp/existing_stack_set.yml"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Lono::Sets::Preview
|
2
|
-
# Inherits from Lono::Cfn::Preview::Param and override what's needed:
|
3
|
-
#
|
4
|
-
# stack_parameters
|
5
|
-
#
|
6
|
-
class Param < Lono::Cfn::Preview::Param
|
7
|
-
def run
|
8
|
-
return unless stack_set_exists?(@stack)
|
9
|
-
|
10
|
-
generated_parameters # eager call generated_parameters so its output is above Parameter Diff Preview
|
11
|
-
puts "Parameter Diff Preview:".color(:green)
|
12
|
-
if @options[:noop]
|
13
|
-
puts "NOOP CloudFormation parameters preview for #{@stack} update"
|
14
|
-
return
|
15
|
-
end
|
16
|
-
|
17
|
-
write_to_tmp(existing_path, existing_params)
|
18
|
-
write_to_tmp(new_path, new_params)
|
19
|
-
|
20
|
-
show_diff(existing_path, new_path)
|
21
|
-
end
|
22
|
-
|
23
|
-
def stack_parameters
|
24
|
-
stack_set_parameters
|
25
|
-
end
|
26
|
-
|
27
|
-
def stack_set_parameters
|
28
|
-
resp = cfn.describe_stack_set(stack_set_name: @stack)
|
29
|
-
resp.stack_set.parameters
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,120 +0,0 @@
|
|
1
|
-
# The Completed and Deleted classes inherit from Base.
|
2
|
-
# They implement `tail` and should not override `show`.
|
3
|
-
#
|
4
|
-
# They guarantee at least one status line is shown.
|
5
|
-
# After which they start a thread that tails until a "terminal" status is detected. However, describe_stack_instance
|
6
|
-
# resp.stack_instance.status returns:
|
7
|
-
#
|
8
|
-
# CURRENT, OUTDATED, INOPERABLE
|
9
|
-
#
|
10
|
-
# There is no well-defined terminal status. For example, sometimes the terminal status is `CURRENT`, when the stack
|
11
|
-
# instance updates successfully:
|
12
|
-
#
|
13
|
-
# CURRENT -> OUTDATED -> CURRENT (terminal)
|
14
|
-
#
|
15
|
-
# But sometimes the terminal state is `OUTDATED`, when the stack instance fails to update:
|
16
|
-
#
|
17
|
-
# CURRENT -> OUTDATED (terminal)
|
18
|
-
#
|
19
|
-
# Essentially, the `describe_stack_instance` resp does not provide enough information to determine the completion of
|
20
|
-
# the `tail` logic.
|
21
|
-
#
|
22
|
-
# Hence the Completed and Deleted classes cannot be used to control the end of the polling loop. Instead, the calling
|
23
|
-
# logic is responsible for and should control when to end the polling loop.
|
24
|
-
#
|
25
|
-
# Example in Lono::Sets::Status::Instances:
|
26
|
-
#
|
27
|
-
# with_instances do |instance|
|
28
|
-
# Thread.new { instance.tail(to) }
|
29
|
-
# end.map(&:join)
|
30
|
-
# wait_until_stack_set_operation_complete
|
31
|
-
#
|
32
|
-
# The Instances logic waits on the operation results instead because its more accurate. We know from
|
33
|
-
# `describe_stack_set_operation` when the status is actually complete. The describe_stack_set_operation
|
34
|
-
# stack_set_operation.status is one of RUNNING, SUCCEEDED, FAILED, STOPPING, STOPPED.
|
35
|
-
#
|
36
|
-
# In this case, there are threads within threads. The first thread at the Instances level starts polling status
|
37
|
-
# in parallel. The instance.tail delegates to the Completed and Deleted classes.
|
38
|
-
#
|
39
|
-
# Finally, the Completed and Deleted classes are designed to block with the first poll request. So it can show at
|
40
|
-
# least one status line. Then it starts it's own thread to poll for more statuses. Those latter statuses are not
|
41
|
-
# guaranteed to be shown. This is the responsibility of the Instances class since it has the information required to
|
42
|
-
# determine when to finish the polling loop.
|
43
|
-
#
|
44
|
-
class Lono::Sets::Status::Instance
|
45
|
-
class Base
|
46
|
-
include Lono::AwsServices
|
47
|
-
|
48
|
-
class_attribute :show_time_progress
|
49
|
-
class_attribute :delay_factor
|
50
|
-
|
51
|
-
def initialize(stack_instance)
|
52
|
-
@stack_instance = stack_instance
|
53
|
-
@shown = []
|
54
|
-
@output = "" # for say method and specs
|
55
|
-
end
|
56
|
-
|
57
|
-
def show_instance(stack_instance)
|
58
|
-
already_shown = @shown.detect do |o|
|
59
|
-
o[:account] == stack_instance[:account] &&
|
60
|
-
o[:region] == stack_instance[:region] &&
|
61
|
-
o[:status] == stack_instance[:status] &&
|
62
|
-
o[:status_reason] == stack_instance[:status_reason]
|
63
|
-
end
|
64
|
-
return if already_shown
|
65
|
-
|
66
|
-
s = stack_instance
|
67
|
-
say status_line(s.account, s.region, s.status, s.status_reason)
|
68
|
-
end
|
69
|
-
|
70
|
-
def show_time_progress
|
71
|
-
self.class.show_time_progress
|
72
|
-
end
|
73
|
-
|
74
|
-
def status_line(account, region, status, reason=nil)
|
75
|
-
time = Time.now.strftime("%F %I:%M:%S%p") if show_time_progress
|
76
|
-
items = [
|
77
|
-
time,
|
78
|
-
"Stack Instance:",
|
79
|
-
"account".color(:purple), account,
|
80
|
-
"region".color(:purple), region,
|
81
|
-
"status".color(:purple), status,
|
82
|
-
]
|
83
|
-
items += ["reason".color(:purple), reason] if reason
|
84
|
-
items.compact.join(" ")
|
85
|
-
end
|
86
|
-
|
87
|
-
def say(text)
|
88
|
-
ENV["LONO_TEST"] ? @output << "#{text}\n" : puts(text)
|
89
|
-
end
|
90
|
-
|
91
|
-
def describe_stack_instance
|
92
|
-
retries = 0
|
93
|
-
begin
|
94
|
-
cfn.describe_stack_instance(
|
95
|
-
stack_instance_account: @stack_instance.account,
|
96
|
-
stack_instance_region: @stack_instance.region,
|
97
|
-
stack_set_name: @stack_instance.stack_set_id)
|
98
|
-
rescue Aws::CloudFormation::Errors::Throttling => e
|
99
|
-
retries += 1
|
100
|
-
delay = 2 ** retries
|
101
|
-
if ENV['LONO_DEBUG_THROTTLE']
|
102
|
-
puts "#{e.class}: #{e.message}"
|
103
|
-
puts "Backing off for #{delay}s and will retry"
|
104
|
-
end
|
105
|
-
sleep delay
|
106
|
-
retry
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def delay
|
111
|
-
# delay factor based on number of stack instances
|
112
|
-
factor = self.class.delay_factor || 1
|
113
|
-
base = 4.5
|
114
|
-
delay = factor * base
|
115
|
-
delay = [delay, 30].min # limit the delay to a max
|
116
|
-
puts "Sleeping for #{delay}s..." if ENV['LONO_DEBUG_THROTTLE']
|
117
|
-
sleep delay
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# Refer to Lono::Sets::Status::Instance::Base for more detailed docs.
|
2
|
-
class Lono::Sets::Status::Instance
|
3
|
-
class Completed < Base
|
4
|
-
def tail
|
5
|
-
display_one
|
6
|
-
Thread.new do
|
7
|
-
loop!
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def loop!
|
12
|
-
# resp.stack_instance.status : one of CURRENT, OUTDATED, INOPERABLE
|
13
|
-
status = nil
|
14
|
-
until completed?(status)
|
15
|
-
resp = display_one
|
16
|
-
status = resp.stack_instance.status
|
17
|
-
delay unless completed?(status)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def display_one
|
22
|
-
resp = describe_stack_instance
|
23
|
-
stack_instance = resp.stack_instance
|
24
|
-
show_instance(stack_instance)
|
25
|
-
@shown << stack_instance
|
26
|
-
resp
|
27
|
-
end
|
28
|
-
|
29
|
-
# status: one of CURRENT, OUTDATED, INOPERABLE
|
30
|
-
def completed?(status)
|
31
|
-
completed_statuses = %w[CURRENT INOPERABLE]
|
32
|
-
completed_statuses.include?(status)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# Refer to Lono::Sets::Status::Instance::Base for more detailed docs.
|
2
|
-
class Lono::Sets::Status::Instance
|
3
|
-
class Deleted < Base
|
4
|
-
def tail
|
5
|
-
display_one
|
6
|
-
Thread.new do
|
7
|
-
loop!
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def loop!
|
12
|
-
# resp.stack_instance.status : one of CURRENT, OUTDATED, INOPERABLE
|
13
|
-
while true
|
14
|
-
begin
|
15
|
-
display_one
|
16
|
-
rescue Aws::CloudFormation::Errors::StackInstanceNotFoundException
|
17
|
-
say status_line(@stack_instance.account, @stack_instance.region, "DELETED")
|
18
|
-
break
|
19
|
-
end
|
20
|
-
delay
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def display_one
|
25
|
-
resp = describe_stack_instance
|
26
|
-
stack_instance = resp.stack_instance
|
27
|
-
show_instance(stack_instance)
|
28
|
-
@shown << stack_instance
|
29
|
-
resp
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class Lono::Sets::Status
|
2
|
-
class Instance
|
3
|
-
def initialize(stack_instance)
|
4
|
-
@stack_instance = stack_instance
|
5
|
-
end
|
6
|
-
|
7
|
-
def tail(to="completed")
|
8
|
-
case to
|
9
|
-
when "completed"
|
10
|
-
Completed.new(@stack_instance).tail
|
11
|
-
when "deleted"
|
12
|
-
Deleted.new(@stack_instance).tail
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def show
|
17
|
-
Show.new(@stack_instance).run
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
class Lono::Sets::Status
|
2
|
-
class Instances
|
3
|
-
include Lono::AwsServices
|
4
|
-
include Lono::Sets::TimeSpent
|
5
|
-
|
6
|
-
def initialize(options={})
|
7
|
-
@options = options
|
8
|
-
@stack, @operation_id = options[:stack], options[:operation_id]
|
9
|
-
@show_time_spent = options[:show_time_spent].nil? ? true : options[:show_time_spent]
|
10
|
-
end
|
11
|
-
|
12
|
-
def wait(to="completed")
|
13
|
-
puts "Stack Instance statuses... (takes a while)"
|
14
|
-
puts "You can check on the StackSetsole Operations Tab for the operation status."
|
15
|
-
wait_until_outdated if @options[:start_on_outdated]
|
16
|
-
|
17
|
-
threads = start_wait_for_instances_threads
|
18
|
-
wait_until_stack_set_operation_complete # start the the tailer here so the show_aws_cli_command shows up
|
19
|
-
threads.map(&:join)
|
20
|
-
end
|
21
|
-
|
22
|
-
def show
|
23
|
-
if stack_instances.empty?
|
24
|
-
# Note: no access to @blueprint here
|
25
|
-
puts <<~EOL
|
26
|
-
There are 0 stack instances associated with the #{@stack} stack set. Add files
|
27
|
-
Add accounts and regions configs use `lono sets instances sync` to add stack instances.
|
28
|
-
EOL
|
29
|
-
return
|
30
|
-
end
|
31
|
-
|
32
|
-
threads = start_wait_for_instances_threads
|
33
|
-
wait_until_stack_set_operation_complete
|
34
|
-
threads.map(&:join)
|
35
|
-
end
|
36
|
-
|
37
|
-
def start_wait_for_instances_threads
|
38
|
-
# Tricky: extra sleep so that the show_aws_cli_command in wait_until_stack_set_operation_complete
|
39
|
-
# shows up first. Quickest way to implement.
|
40
|
-
with_instances do |instance|
|
41
|
-
Thread.new { sleep 5; instance.show }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def with_instances
|
46
|
-
stack_instances.map do |stack_instance|
|
47
|
-
instance = Instance.new(stack_instance)
|
48
|
-
yield(instance)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def wait_until_stack_set_operation_complete
|
53
|
-
status, stack_set_operation = nil, nil
|
54
|
-
until completed?(status)
|
55
|
-
resp = cfn.describe_stack_set_operation(
|
56
|
-
stack_set_name: @stack,
|
57
|
-
operation_id: operation_id,
|
58
|
-
)
|
59
|
-
stack_set_operation = resp.stack_set_operation
|
60
|
-
status = stack_set_operation.status
|
61
|
-
show_aws_cli_command(stack_set_operation.operation_id)
|
62
|
-
# puts "DEBUG: wait_until_stack_set_operation_complete"
|
63
|
-
unless completed?(status)
|
64
|
-
sleep 5
|
65
|
-
end
|
66
|
-
end
|
67
|
-
if @show_time_spent # or else it double shows from `lono sets deploy`. Do want it to show for `lono sets instances sync` though
|
68
|
-
show_time_spent(stack_set_operation)
|
69
|
-
puts "Stack set operation completed."
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
@@aws_cli_command_shown = false
|
74
|
-
def show_aws_cli_command(operation_id)
|
75
|
-
return if @@aws_cli_command_shown
|
76
|
-
|
77
|
-
command = "aws cloudformation describe-stack-set-operation --stack-set-name #{@stack} --operation-id #{operation_id}"
|
78
|
-
puts <<~EOL
|
79
|
-
Here is also the cli command to check:
|
80
|
-
|
81
|
-
#{command}
|
82
|
-
|
83
|
-
EOL
|
84
|
-
@@aws_cli_command_shown = true
|
85
|
-
end
|
86
|
-
|
87
|
-
# describe_stack_set_operation stack_set_operation.status is
|
88
|
-
# one of RUNNING, SUCCEEDED, FAILED, STOPPING, STOPPED
|
89
|
-
def completed?(status)
|
90
|
-
completed_statuses = %w[SUCCEEDED FAILED STOPPED]
|
91
|
-
completed_statuses.include?(status)
|
92
|
-
end
|
93
|
-
|
94
|
-
# If we dont wait until OUTDATED, during a `lono sets deploy` it'll immediately think that the instance statuses are done
|
95
|
-
def wait_until_outdated
|
96
|
-
outdated = false
|
97
|
-
until outdated
|
98
|
-
outdated = stack_instances.detect { |stack_instance| stack_instance.status == "OUTDATED" }
|
99
|
-
sleep 5
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def instances
|
104
|
-
stack_instances.map { |stack_instance| Instance.new(stack_instance) }
|
105
|
-
end
|
106
|
-
|
107
|
-
def stack_instances
|
108
|
-
resp = cfn.list_stack_instances(stack_set_name: @stack)
|
109
|
-
summaries = resp.summaries
|
110
|
-
# filter is really only used internally. So it's fine to keep it as complex data structure since that's what we
|
111
|
-
# build it up as in Lono::Sets::Instances::Deploy
|
112
|
-
filter = @options[:filter] # [["112233445566", "us-west-1"],["112233445566", "us-west-2"]]
|
113
|
-
return summaries unless filter
|
114
|
-
|
115
|
-
summaries.reject do |s|
|
116
|
-
intersect = [[s.account, s.region]] & filter
|
117
|
-
intersect.empty?
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def operation_id
|
122
|
-
@operation_id ||= latest_operation_id
|
123
|
-
end
|
124
|
-
|
125
|
-
def latest_operation_id
|
126
|
-
resp = cfn.list_stack_set_operations(
|
127
|
-
stack_set_name: @stack,
|
128
|
-
max_results: 1,
|
129
|
-
)
|
130
|
-
resp.summaries.first.operation_id
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
data/lib/lono/sets/status.rb
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
class Status
|
3
|
-
extend Memoist
|
4
|
-
include Lono::AwsServices
|
5
|
-
include Summarize
|
6
|
-
include TimeSpent
|
7
|
-
|
8
|
-
attr_reader :operation_id
|
9
|
-
def initialize(options={})
|
10
|
-
@options = options
|
11
|
-
@stack, @operation_id = options[:stack], options[:operation_id]
|
12
|
-
@shown = []
|
13
|
-
@output = "" # for say method and specs
|
14
|
-
end
|
15
|
-
|
16
|
-
def wait
|
17
|
-
status = nil
|
18
|
-
until completed?(status)
|
19
|
-
resp = display_one
|
20
|
-
stack_set_operation = resp.stack_set_operation
|
21
|
-
status = stack_set_operation.status
|
22
|
-
# always sleep delay even if completed to provide start_instances_status_waiter some extra time to complete
|
23
|
-
sleep 5
|
24
|
-
if completed?(status)
|
25
|
-
show_time_spent(stack_set_operation)
|
26
|
-
else
|
27
|
-
start_instances_status_waiter
|
28
|
-
end
|
29
|
-
end
|
30
|
-
status == "SUCCEEDED"
|
31
|
-
end
|
32
|
-
|
33
|
-
def display_one
|
34
|
-
resp = cfn.describe_stack_set_operation(
|
35
|
-
stack_set_name: @stack,
|
36
|
-
operation_id: operation_id,
|
37
|
-
)
|
38
|
-
stack_set_operation = resp.stack_set_operation
|
39
|
-
show_stack_set_operation(stack_set_operation)
|
40
|
-
@shown << stack_set_operation
|
41
|
-
resp
|
42
|
-
end
|
43
|
-
|
44
|
-
def show
|
45
|
-
display_one
|
46
|
-
o = @options.merge(show_time_spent: false)
|
47
|
-
instances_status = Lono::Sets::Instances::Status.new(o)
|
48
|
-
instances_status.run
|
49
|
-
summarize(operation_id)
|
50
|
-
end
|
51
|
-
|
52
|
-
@@instances_status_waiter_started = false
|
53
|
-
def start_instances_status_waiter
|
54
|
-
return if @@instances_status_waiter_started
|
55
|
-
if stack_instances.empty?
|
56
|
-
@@instances_status_waiter_started = true
|
57
|
-
return
|
58
|
-
end
|
59
|
-
|
60
|
-
Thread.new do
|
61
|
-
# show_time_spent because we already show it in this status class. Dont want it to show twice.
|
62
|
-
o = @options.merge(start_on_outdated: true, show_time_spent: false)
|
63
|
-
instances_status = Lono::Sets::Instances::Status.new(o)
|
64
|
-
instances_status.run
|
65
|
-
end
|
66
|
-
@@instances_status_waiter_started = true
|
67
|
-
end
|
68
|
-
|
69
|
-
def show_stack_set_operation(stack_set_operation)
|
70
|
-
already_shown = @shown.detect do |o|
|
71
|
-
o[:status] == stack_set_operation[:status]
|
72
|
-
end
|
73
|
-
return if already_shown
|
74
|
-
|
75
|
-
say "Stack Set Operation Status: #{stack_set_operation.status}"
|
76
|
-
end
|
77
|
-
|
78
|
-
def say(text)
|
79
|
-
ENV["LONO_TEST"] ? @output << "#{text}\n" : puts(text)
|
80
|
-
end
|
81
|
-
|
82
|
-
# describe_stack_set_operation stack_set_operation.status is
|
83
|
-
# one of RUNNING, SUCCEEDED, FAILED, STOPPING, STOPPED
|
84
|
-
def completed?(status)
|
85
|
-
completed_statuses = %w[SUCCEEDED FAILED STOPPED]
|
86
|
-
completed_statuses.include?(status)
|
87
|
-
end
|
88
|
-
|
89
|
-
def stack_set_status
|
90
|
-
resp = cfn.describe_stack_set_operation(
|
91
|
-
stack_set_name: @stack,
|
92
|
-
operation_id: operation_id,
|
93
|
-
)
|
94
|
-
# describe_stack_set_operation stack_set_operation.status is
|
95
|
-
# status one of RUNNING, SUCCEEDED, FAILED, STOPPING, STOPPED
|
96
|
-
resp.stack_set_operation.status
|
97
|
-
end
|
98
|
-
|
99
|
-
def operation_id
|
100
|
-
@operation_id ||= latest_operation_id
|
101
|
-
end
|
102
|
-
|
103
|
-
def latest_operation_id
|
104
|
-
resp = cfn.list_stack_set_operations(
|
105
|
-
stack_set_name: @stack,
|
106
|
-
max_results: 1,
|
107
|
-
)
|
108
|
-
resp.summaries.first.operation_id
|
109
|
-
end
|
110
|
-
|
111
|
-
def stack_instances
|
112
|
-
Lono::Sets::Status::Instances.new(@options).stack_instances
|
113
|
-
end
|
114
|
-
memoize :stack_instances
|
115
|
-
end
|
116
|
-
end
|
data/lib/lono/sets/summarize.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
module Summarize
|
3
|
-
def summarize(operation_id)
|
4
|
-
puts "Stack Set Operation Summary:"
|
5
|
-
resp = cfn.list_stack_set_operation_results(stack_set_name: @stack, operation_id: operation_id)
|
6
|
-
resp.summaries.each do |s|
|
7
|
-
data = {
|
8
|
-
account: s.account,
|
9
|
-
region: s.region,
|
10
|
-
status: s.status,
|
11
|
-
}
|
12
|
-
data["status reason"] = s.status_reason if s.status_reason
|
13
|
-
message = data.inject("") do |text, (k,v)|
|
14
|
-
text += [k.to_s.color(:purple), v].join(" ") + " "
|
15
|
-
end
|
16
|
-
puts message
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/lono/sets/time_spent.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
class Lono::Sets
|
2
|
-
module TimeSpent
|
3
|
-
include Lono::Utils::PrettyTime
|
4
|
-
|
5
|
-
def show_time_spent(stack_set_operation)
|
6
|
-
seconds = stack_set_operation.end_timestamp - stack_set_operation.creation_timestamp
|
7
|
-
time_took = pretty_time(seconds).color(:green)
|
8
|
-
puts "Time took to complete stack set operation: #{time_took}"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|