lono 7.5.2 → 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 +21 -4
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +5 -1
- data/LICENSE.txt +201 -1
- data/README.md +4 -4
- 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 -195
- 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 -109
- 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 -12
- 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 -44
- metadata +246 -269
- 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 -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/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.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/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,15 +0,0 @@
|
|
1
|
-
# Incentive to register. Not meant for security.
|
2
|
-
class Lono::Registration
|
3
|
-
class Check
|
4
|
-
extend Memoist
|
5
|
-
|
6
|
-
def initialize(options={})
|
7
|
-
@options = options
|
8
|
-
end
|
9
|
-
|
10
|
-
def check
|
11
|
-
return true if User.new(@options).check
|
12
|
-
Temp.new(@options).check
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Incentive to register. Not meant for security.
|
2
|
-
class Lono::Registration
|
3
|
-
class Temp < Base
|
4
|
-
def check
|
5
|
-
info = read_registration
|
6
|
-
if info
|
7
|
-
resp = request_verification(info)
|
8
|
-
puts "request_verification resp #{resp.inspect}" if ENV['LONO_DEBUG_REGISTRATION']
|
9
|
-
# resp nil means non-200 http response. Failsafe behavior is to continue.
|
10
|
-
return true if resp.nil?
|
11
|
-
end
|
12
|
-
|
13
|
-
prompt unless resp && resp[:valid]
|
14
|
-
true
|
15
|
-
end
|
16
|
-
|
17
|
-
def read_registration
|
18
|
-
YAML.load_file(temp_path) if File.exist?(temp_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
def prompt
|
22
|
-
return if ENV['LONO_TEST']
|
23
|
-
|
24
|
-
puts <<~EOL
|
25
|
-
|
26
|
-
Looks like lono is not registered. Lono registration is optional and free.
|
27
|
-
If you like lono though, please register to help support it. You can register at:
|
28
|
-
|
29
|
-
https://register.lono.cloud
|
30
|
-
|
31
|
-
This prompt appears every 24 hours when lono is not registered. Registration removes
|
32
|
-
this message. Registered users can also optionally receive updates and special offers,
|
33
|
-
including discounts to BoltOps Pro:
|
34
|
-
|
35
|
-
https://lono.cloud/docs/boltops-pro/
|
36
|
-
|
37
|
-
EOL
|
38
|
-
|
39
|
-
# resp nil means non-200 http response
|
40
|
-
resp = get_temp_key
|
41
|
-
save_temp_key(resp) unless resp.nil? # save temp key so prompt only happens periodically
|
42
|
-
end
|
43
|
-
|
44
|
-
def save_temp_key(info)
|
45
|
-
FileUtils.mkdir_p(File.dirname(temp_path))
|
46
|
-
IO.write(temp_path, YAML.dump(info.deep_stringify_keys))
|
47
|
-
end
|
48
|
-
|
49
|
-
def temp_path
|
50
|
-
"#{ENV['HOME']}/.lono/temp.yml"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
class Lono::Registration
|
2
|
-
class User < Base
|
3
|
-
include Lono::Template::Context::Helpers # for ssm helper
|
4
|
-
|
5
|
-
def check
|
6
|
-
info = read_registration
|
7
|
-
unless info
|
8
|
-
say "Lono is not registered."
|
9
|
-
say "The .lono/registration.yml and ~/.lono/registration.yml file does not exist."
|
10
|
-
return false
|
11
|
-
end
|
12
|
-
unless info[:content].is_a?(Hash)
|
13
|
-
say "Lono is not registered."
|
14
|
-
say "#{info[:path]} does not have the right structure"
|
15
|
-
return false
|
16
|
-
end
|
17
|
-
|
18
|
-
@resp = request_verification(info[:content])
|
19
|
-
# A non-200 response means there was a non-200 http response. Failsafe behavior is to continue.
|
20
|
-
# Unless called from the cli: lono registration check
|
21
|
-
if @resp.nil?
|
22
|
-
if @options[:cli]
|
23
|
-
puts "There was an error with the API. Unable to confirm lono registration."
|
24
|
-
return false
|
25
|
-
else
|
26
|
-
return true
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
if @resp[:valid]
|
31
|
-
say "Lono registration looks good!"
|
32
|
-
return true
|
33
|
-
end
|
34
|
-
|
35
|
-
if @resp[:message]
|
36
|
-
say "Lono is not correctly registered. Unable to confirm info in #{info[:path]}"
|
37
|
-
say @resp[:message]
|
38
|
-
end
|
39
|
-
false
|
40
|
-
end
|
41
|
-
|
42
|
-
def read_registration
|
43
|
-
folders = [Lono.root, ENV['HOME']]
|
44
|
-
files = folders.map { |f| "#{f}/.lono/registration.yml" }
|
45
|
-
found = files.find do |path|
|
46
|
-
File.exist?(path)
|
47
|
-
end
|
48
|
-
return unless found
|
49
|
-
|
50
|
-
content = RenderMePretty.result(found, context: self)
|
51
|
-
if @options[:debug]
|
52
|
-
puts "Debug mode enabled. Here's the lono registration info being used:"
|
53
|
-
puts "Using: #{found}"
|
54
|
-
puts content
|
55
|
-
puts
|
56
|
-
end
|
57
|
-
{path: found, content: YAML.load(content)}
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/lib/lono/seed.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
module Lono
|
2
|
-
class Seed < AbstractBase
|
3
|
-
def create
|
4
|
-
puts "Creating starter config files for #{@blueprint}"
|
5
|
-
configs_class = load_configs_class # ::Configs or Lono::Seed::Base
|
6
|
-
configs = configs_class.new(@options)
|
7
|
-
# The Configs class implements: variables
|
8
|
-
configs.run # setup the instance variables
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
def load_configs_class
|
13
|
-
blueprint_root = find_blueprint_root(@blueprint)
|
14
|
-
configs_path = "#{blueprint_root}/seed/configs.rb"
|
15
|
-
|
16
|
-
begin
|
17
|
-
loaded = load configs_path
|
18
|
-
rescue LoadError
|
19
|
-
loaded = false
|
20
|
-
end
|
21
|
-
|
22
|
-
if loaded
|
23
|
-
if defined?(Lono::Seed::Configs)
|
24
|
-
configs_class = Lono::Seed::Configs # blueprint specific Configs
|
25
|
-
else
|
26
|
-
puts <<~EOL
|
27
|
-
Lono::Seed::Configs class not found.
|
28
|
-
Are you sure #{configs_path} contains a Lono::Seed::Configs class?
|
29
|
-
EOL
|
30
|
-
exit 1
|
31
|
-
end
|
32
|
-
else
|
33
|
-
configs_class = Lono::Seed::Base # Generic handling
|
34
|
-
end
|
35
|
-
|
36
|
-
configs_class
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/lono/sequence.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'active_support/core_ext/string'
|
3
|
-
require 'thor'
|
4
|
-
require 'bundler'
|
5
|
-
|
6
|
-
class Lono::Sequence < Thor::Group
|
7
|
-
include Thor::Actions
|
8
|
-
|
9
|
-
def self.source_root
|
10
|
-
File.expand_path("../templates/skeleton", File.dirname(__FILE__))
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
def git_installed?
|
15
|
-
system("type git > /dev/null 2>&1")
|
16
|
-
end
|
17
|
-
|
18
|
-
def run_git?
|
19
|
-
options[:git] && git_installed?
|
20
|
-
end
|
21
|
-
|
22
|
-
def run_git_init
|
23
|
-
return unless run_git?
|
24
|
-
puts "=> Initialize git repo"
|
25
|
-
run("git init")
|
26
|
-
end
|
27
|
-
|
28
|
-
def run_git_commit
|
29
|
-
return unless run_git?
|
30
|
-
|
31
|
-
puts "=> Commit git repo"
|
32
|
-
run("git add .")
|
33
|
-
run("git commit -m 'first commit'")
|
34
|
-
end
|
35
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
class Lono::SetInstances
|
2
|
-
class Base < Lono::Sets::Base
|
3
|
-
# Simple structure to help with subtracting logic
|
4
|
-
# [["112233445566", "us-west-1"], ["112233445566", "us-west-1"]]
|
5
|
-
def requested
|
6
|
-
requested = []
|
7
|
-
accounts.each do |a|
|
8
|
-
regions.each do |r|
|
9
|
-
item = [a,r]
|
10
|
-
requested << item
|
11
|
-
end
|
12
|
-
end
|
13
|
-
requested.sort.uniq
|
14
|
-
end
|
15
|
-
memoize :requested
|
16
|
-
|
17
|
-
def accounts
|
18
|
-
@options[:accounts]
|
19
|
-
end
|
20
|
-
|
21
|
-
def regions
|
22
|
-
@options[:regions]
|
23
|
-
end
|
24
|
-
|
25
|
-
def stack_instances
|
26
|
-
resp = cfn.list_stack_instances(stack_set_name: @stack)
|
27
|
-
resp.summaries
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
class Lono::SetInstances
|
2
|
-
class Changeable < Base
|
3
|
-
include Lono::AwsServices
|
4
|
-
include Lono::Utils::Sure
|
5
|
-
|
6
|
-
def initialize(options={})
|
7
|
-
super # need conventions so config lookup will work
|
8
|
-
@regions, @accounts = [], []
|
9
|
-
end
|
10
|
-
|
11
|
-
def run
|
12
|
-
validate!
|
13
|
-
|
14
|
-
unless stack_set_exists?(@stack)
|
15
|
-
puts "ERROR: Cannot update a stack set because #{@stack} does not exists.".color(:red)
|
16
|
-
return
|
17
|
-
end
|
18
|
-
exit_unless_updatable!
|
19
|
-
|
20
|
-
options = {
|
21
|
-
stack_set_name: @stack,
|
22
|
-
accounts: accounts,
|
23
|
-
regions: regions,
|
24
|
-
}
|
25
|
-
begin
|
26
|
-
resp = perform(options)
|
27
|
-
rescue Aws::CloudFormation::Errors::ValidationError => e
|
28
|
-
# IE: Aws::CloudFormation::Errors::ValidationError: Region eu-north-1 is not supported
|
29
|
-
puts "#{e.class}: #{e.message}".color(:red)
|
30
|
-
exit 1
|
31
|
-
end
|
32
|
-
|
33
|
-
return true if @options[:noop]
|
34
|
-
Lono::Sets::Waiter.new(@options).run(resp[:operation_id])
|
35
|
-
end
|
36
|
-
|
37
|
-
def validate!
|
38
|
-
invalid = (regions.blank? || accounts.blank?) && !@options[:all]
|
39
|
-
if invalid
|
40
|
-
puts "ERROR: You must provide --accounts and --regions or --all.".color(:red)
|
41
|
-
exit 1
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def accounts
|
46
|
-
@options[:all] ? stack_instances.map(&:account).uniq : @options[:accounts]
|
47
|
-
end
|
48
|
-
|
49
|
-
def regions
|
50
|
-
@options[:all] ? stack_instances.map(&:region).uniq : @options[:regions]
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
class Lono::SetInstances
|
2
|
-
class Delete < Changeable
|
3
|
-
def initialize(options={})
|
4
|
-
super
|
5
|
-
@stack = options[:stack]
|
6
|
-
end
|
7
|
-
|
8
|
-
def run
|
9
|
-
validate!
|
10
|
-
|
11
|
-
sure?("Are you sure you want to delete the #{@stack} stack instances?", long_desc)
|
12
|
-
|
13
|
-
# delete_stack_instances resp has operation_id
|
14
|
-
# Could also use that to poll for status with the list_stack_set_operation_results
|
15
|
-
# api. Currently, Instance::Status class not using this info. If we need will add the logic.
|
16
|
-
retain_stacks = @options[:retain_stacks] ? @options[:retain_stacks] : false
|
17
|
-
resp = cfn.delete_stack_instances(
|
18
|
-
stack_set_name: @stack,
|
19
|
-
accounts: accounts,
|
20
|
-
regions: regions,
|
21
|
-
retain_stacks: retain_stacks,
|
22
|
-
)
|
23
|
-
operation_id = resp.operation_id
|
24
|
-
|
25
|
-
# Status tailing handled by caller
|
26
|
-
o = @options.merge(
|
27
|
-
filter: requested,
|
28
|
-
start_on_outdated: false,
|
29
|
-
operation_id: operation_id,
|
30
|
-
)
|
31
|
-
instances_status = Status.new(o)
|
32
|
-
instances_status.run(to: "deleted") unless @options[:noop] # returns success: true or false
|
33
|
-
end
|
34
|
-
|
35
|
-
def long_desc
|
36
|
-
total = accounts.size * regions.size
|
37
|
-
<<~EOL
|
38
|
-
These stack instances will be deleted:
|
39
|
-
|
40
|
-
accounts: #{accounts.join(',')}
|
41
|
-
regions: #{regions.join(',')}
|
42
|
-
|
43
|
-
Number of stack instances to be deleted: #{total}
|
44
|
-
EOL
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
class Lono::SetInstances
|
2
|
-
class Deploy < Changeable
|
3
|
-
def run
|
4
|
-
# computes whether create or update should be ran for stack instances within each account
|
5
|
-
updates, creates = Hash.new([]), Hash.new([])
|
6
|
-
accounts.each do |account|
|
7
|
-
regions.each do |region|
|
8
|
-
if stack_instance_exists?(account, region)
|
9
|
-
updates[account] += [region] # += [item] works, << item doesnt seem to work
|
10
|
-
else
|
11
|
-
creates[account] += [region] # += [item] works, << item doesnt seem to work
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
deploy(:create, creates)
|
17
|
-
deploy(:update, updates)
|
18
|
-
end
|
19
|
-
|
20
|
-
def deploy(type, changes)
|
21
|
-
changes.each do |account, regions|
|
22
|
-
run_action(type, account, regions)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def run_action(type, account, regions)
|
27
|
-
klass = "Lono::SetInstances::#{type.to_s.camelize}"
|
28
|
-
klass = klass.constantize
|
29
|
-
command = lono_command(klass)
|
30
|
-
puts "Running #{command.color(:green)} on account: #{account} regions: #{regions.join(',')}"
|
31
|
-
|
32
|
-
options = @options.dup
|
33
|
-
options[:accounts] = [account]
|
34
|
-
options[:regions] = regions
|
35
|
-
klass.new(options).run
|
36
|
-
end
|
37
|
-
|
38
|
-
def lono_command(klass)
|
39
|
-
klass = klass.to_s
|
40
|
-
klass.split('::').map(&:underscore).join(' ')
|
41
|
-
end
|
42
|
-
|
43
|
-
def stack_instance_exists?(account, region)
|
44
|
-
existing = stack_instances.map do |summary|
|
45
|
-
[summary.account, summary.region]
|
46
|
-
end
|
47
|
-
intersect = existing & [[account, region]]
|
48
|
-
!intersect.empty?
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
class Lono::SetInstances
|
2
|
-
class Opts < Lono::Sets::Opts
|
3
|
-
def update
|
4
|
-
delete
|
5
|
-
end
|
6
|
-
|
7
|
-
def create
|
8
|
-
delete
|
9
|
-
end
|
10
|
-
|
11
|
-
def delete
|
12
|
-
operation_preferences_options
|
13
|
-
accounts_options
|
14
|
-
with_cli_scope do
|
15
|
-
option :all, type: :boolean, desc: "Delete stack all instances. Overrides --accounts and --regions options"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def sync
|
20
|
-
operation_preferences_options
|
21
|
-
accounts_options
|
22
|
-
with_cli_scope do
|
23
|
-
option :delete, type: :boolean, default: true, desc: "Delete stack instances that are not provided"
|
24
|
-
option :blueprint, desc: "override convention and specify the template file to use"
|
25
|
-
option :source, desc: "url or path to file with template"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def accounts_options
|
30
|
-
with_cli_scope do
|
31
|
-
option :accounts, type: :array, desc: "List of accounts to apply stack set to. IE: 112233445566 223344556677"
|
32
|
-
option :regions, type: :array, desc: "List of regions to apply stack set to. IE: us-west-2 us-east-1"
|
33
|
-
option :sure, type: :boolean, desc: "Skip are you sure prompt"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,181 +0,0 @@
|
|
1
|
-
class Lono::SetInstances
|
2
|
-
class Sync < Base
|
3
|
-
include Lono::Sets::Summarize
|
4
|
-
include Lono::Utils::Sure
|
5
|
-
|
6
|
-
def initialize(options={})
|
7
|
-
super # need conventions so config lookup will work
|
8
|
-
@regions, @accounts = [], []
|
9
|
-
end
|
10
|
-
|
11
|
-
def run
|
12
|
-
puts "DEPRECATED: The sync command is deprecated, in favor of the deploy command.".color(:yellow)
|
13
|
-
puts "Found more success with an explicit approach. sync may be removed in future versions of lono."
|
14
|
-
|
15
|
-
unless stack_set_exists?(@stack)
|
16
|
-
puts "ERROR: Cannot update a stack set because #{@stack} does not exists.".color(:red)
|
17
|
-
return
|
18
|
-
end
|
19
|
-
exit_unless_updatable!
|
20
|
-
|
21
|
-
validate!
|
22
|
-
|
23
|
-
existing = stack_instances.map do |summary|
|
24
|
-
[summary.account, summary.region]
|
25
|
-
end
|
26
|
-
|
27
|
-
creates = requested - existing
|
28
|
-
deletes = existing - requested
|
29
|
-
|
30
|
-
if creates.empty? and deletes.empty?
|
31
|
-
puts <<~EOL
|
32
|
-
Nothing to be synced. IE: No stack instances need to be added or removed. If you want to update the
|
33
|
-
stack set and update all stack instances instead, use the `lono sets deploy` command.
|
34
|
-
EOL
|
35
|
-
return
|
36
|
-
end
|
37
|
-
sure?("Are you sure you want to sync stack instances?", long_desc(creates: creates, deletes: deletes))
|
38
|
-
|
39
|
-
# Note: Not calling update_stack_instances because after deleting stacks it instances in in a weird state
|
40
|
-
# where an update_stack_instances fails. Can reproduce this by deleting stacks and then trying an update_stack_instances
|
41
|
-
# with the AWS CLI. In theory, we never really should have to call update_stack_instances anyway because
|
42
|
-
# updating the stack set at the parent level kicks off an update_stack_instances automatically.
|
43
|
-
operation_id = execute(:create_stack_instances, creates)
|
44
|
-
summarize(operation_id) if operation_id
|
45
|
-
if @options[:delete]
|
46
|
-
operation_id = execute(:delete_stack_instances, deletes)
|
47
|
-
summarize(operation_id) if operation_id
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
# data:
|
54
|
-
# {creates: creates, deletes: deletes}
|
55
|
-
# where creates and deletes are instances_data structures:
|
56
|
-
# [["112233445566", "us-west-1"], ["112233445566", "us-west-1"]]
|
57
|
-
def long_desc(data={})
|
58
|
-
desc = "lono will run:\n"
|
59
|
-
verbs = [:creates, :deletes]
|
60
|
-
verbs.each do |verb|
|
61
|
-
accounts = accounts_list(data[verb])
|
62
|
-
regions = regions_list(data[verb])
|
63
|
-
unless data[verb].empty?
|
64
|
-
info = {
|
65
|
-
accounts: accounts.join(','),
|
66
|
-
regions: regions.join(','),
|
67
|
-
}
|
68
|
-
change_total = accounts.size * regions.size
|
69
|
-
singular_verb = verb.to_s.singularize
|
70
|
-
past_verb = verb.to_s.sub(/s$/,'d')
|
71
|
-
message = <<~EOL
|
72
|
-
#{singular_verb}_stack_instances for:
|
73
|
-
accounts: #{info[:accounts]}
|
74
|
-
regions: #{info[:regions]}
|
75
|
-
|
76
|
-
Number of stack instances to be #{past_verb}: #{change_total}
|
77
|
-
EOL
|
78
|
-
desc << message
|
79
|
-
end
|
80
|
-
end
|
81
|
-
desc
|
82
|
-
end
|
83
|
-
|
84
|
-
# meth:
|
85
|
-
# create_stack_set
|
86
|
-
# update_stack_set
|
87
|
-
# delete_stack_set
|
88
|
-
#
|
89
|
-
# instances_data:
|
90
|
-
# [["112233445566", "us-west-1"], ["112233445566", "us-west-1"]]
|
91
|
-
#
|
92
|
-
def execute(meth, instances_data)
|
93
|
-
accounts = accounts_list(instances_data)
|
94
|
-
regions = regions_list(instances_data)
|
95
|
-
if accounts.empty? or regions.empty?
|
96
|
-
# puts "Cannot have one empty. accounts: #{accounts.size} regions: #{regions.size}. No executing #{meth}." # uncomment to debug
|
97
|
-
return # no operation_id
|
98
|
-
end
|
99
|
-
|
100
|
-
options = {
|
101
|
-
stack_set_name: @stack,
|
102
|
-
accounts: accounts,
|
103
|
-
regions: regions,
|
104
|
-
}
|
105
|
-
options[:retain_stacks] = false if meth == :delete_stack_instances
|
106
|
-
puts <<~EOL
|
107
|
-
=> Running #{meth} on:
|
108
|
-
accounts: #{accounts.join(',')}
|
109
|
-
regions: #{regions.join(',')}
|
110
|
-
EOL
|
111
|
-
resp = cfn.send(meth, options) # resp has resp[:operation_id]
|
112
|
-
operation_id = resp.operation_id
|
113
|
-
|
114
|
-
# Status tailing
|
115
|
-
o = @options.merge(
|
116
|
-
filter: instances_data,
|
117
|
-
operation_id: operation_id,
|
118
|
-
start_on_outdated: meth != :delete_stack_instances,
|
119
|
-
)
|
120
|
-
instances_status = Status.new(o)
|
121
|
-
final_status = meth == :delete_stack_instances ? "deleted" : "completed"
|
122
|
-
instances_status.run(to: final_status) unless @options[:noop] # returns success: true or false
|
123
|
-
operation_id
|
124
|
-
end
|
125
|
-
|
126
|
-
def accounts_list(instances_data)
|
127
|
-
instances_data.map { |a| a[0] }.sort.uniq
|
128
|
-
end
|
129
|
-
|
130
|
-
def regions_list(instances_data)
|
131
|
-
instances_data.map { |a| a[1] }.sort.uniq
|
132
|
-
end
|
133
|
-
|
134
|
-
# Override accounts and regions
|
135
|
-
def accounts
|
136
|
-
@options[:accounts] || lookup(:accounts)
|
137
|
-
end
|
138
|
-
|
139
|
-
def regions
|
140
|
-
@options[:regions] || lookup(:regions)
|
141
|
-
end
|
142
|
-
|
143
|
-
def lookup(config_type)
|
144
|
-
config_type = config_type.to_s
|
145
|
-
|
146
|
-
items = []
|
147
|
-
layering = Lono::Layering.new(config_type, @options, Lono.env)
|
148
|
-
layering.locations.each do |path|
|
149
|
-
items += load_config(path)
|
150
|
-
end
|
151
|
-
items = items.sort.uniq
|
152
|
-
|
153
|
-
if config_type == "accounts"
|
154
|
-
@accounts = items
|
155
|
-
else
|
156
|
-
@regions = items
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
def load_config(path)
|
161
|
-
return [] unless path
|
162
|
-
|
163
|
-
items = []
|
164
|
-
lines = IO.readlines(path)
|
165
|
-
lines.map do |l|
|
166
|
-
l = l.strip
|
167
|
-
l = l.sub(/ #.*/, '') # trailing comment
|
168
|
-
items << l unless l.empty? || l.match(/^\s*#/) # dont include empty linnks or commented lines
|
169
|
-
end
|
170
|
-
items
|
171
|
-
end
|
172
|
-
|
173
|
-
def validate!
|
174
|
-
invalid = regions.blank? || accounts.blank?
|
175
|
-
if invalid
|
176
|
-
puts "ERROR: You must provide accounts and regions.".color(:red)
|
177
|
-
exit 1
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class Lono::SetInstances
|
2
|
-
class Update < Changeable
|
3
|
-
def perform(options)
|
4
|
-
cfn.update_stack_instances(options)
|
5
|
-
rescue Aws::CloudFormation::Errors::StackInstanceNotFoundException => e
|
6
|
-
puts "#{e.class}: #{e.message}".color(:red)
|
7
|
-
puts <<~EOL
|
8
|
-
One of the provided stack instance was not found. Unable to update the stack instances unless all stack instances
|
9
|
-
already exist. It may be helpful to check the StackSet console Instances Tab. You can also use the
|
10
|
-
`lono set_instances deploy` command instead.
|
11
|
-
EOL
|
12
|
-
exit 1
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|