lono 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +3 -1
- data/exe/lono +1 -1
- data/lib/lono.rb +17 -15
- data/lib/lono/cfn.rb +54 -24
- data/lib/lono/cfn/base.rb +95 -17
- data/lib/lono/cfn/create.rb +5 -29
- data/lib/lono/cfn/current.rb +95 -0
- data/lib/lono/cfn/delete.rb +15 -1
- data/lib/lono/cfn/preview.rb +5 -3
- data/lib/lono/cfn/status.rb +212 -0
- data/lib/lono/cfn/update.rb +6 -12
- data/lib/lono/cfn/util.rb +2 -2
- data/lib/lono/cli.rb +4 -6
- data/lib/lono/core.rb +23 -5
- data/lib/lono/default/settings.yml +1 -1
- data/lib/lono/file_uploader.rb +119 -0
- data/lib/lono/help/cfn/current.md +18 -0
- data/lib/lono/help/cfn/status.md +19 -0
- data/lib/lono/script/build.rb +2 -1
- data/lib/lono/script/upload.rb +1 -1
- data/lib/lono/template/helper.rb +8 -0
- data/lib/lono/template/upload.rb +13 -1
- data/lib/lono/upgrade.rb +16 -0
- data/lib/lono/{upgrade4.rb → upgrade/upgrade4.rb} +1 -1
- data/lib/lono/upgrade/upgrade42.rb +36 -0
- data/lib/lono/version.rb +1 -1
- data/lib/starter_projects/autoscaling/.gitignore +1 -0
- data/lib/starter_projects/autoscaling/README.md +1 -1
- data/lib/starter_projects/autoscaling/config/settings.yml +1 -1
- data/lib/starter_projects/ec2/.gitignore +1 -0
- data/lib/starter_projects/ec2/config/settings.yml +1 -1
- data/lib/starter_projects/skeleton/.gitignore +1 -0
- data/lib/starter_projects/skeleton/config/settings.yml +1 -1
- data/lono.gemspec +1 -0
- data/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/spec/fixtures/lono_project/config/settings.yml +1 -1
- data/spec/lib/lono/cfn/status_spec.rb +77 -0
- metadata +33 -4
| @@ -13,7 +13,7 @@ base: | |
| 13 13 | 
             
              #   default: mybucket/folder
         | 
| 14 14 | 
             
              #   aws_profile1: mybucket/folder
         | 
| 15 15 | 
             
              #   aws_profile2: another-bucket/storage/folder
         | 
| 16 | 
            -
              #  | 
| 16 | 
            +
              # stack_name_suffix: random # tack on a 3 char random string at the end of the stack name
         | 
| 17 17 | 
             
                # for lono cfn create
         | 
| 18 18 |  | 
| 19 19 | 
             
            development:
         | 
| @@ -0,0 +1,77 @@ | |
| 1 | 
            +
            describe Lono::Cfn::Status do
         | 
| 2 | 
            +
              let(:status) do
         | 
| 3 | 
            +
                status = Lono::Cfn::Status.new("test-stack")
         | 
| 4 | 
            +
                allow(status).to receive(:cfn).and_return(cfn)
         | 
| 5 | 
            +
                status
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
              let(:cfn) do
         | 
| 8 | 
            +
                service = double("service").as_null_object
         | 
| 9 | 
            +
                allow(service).to receive(:describe_stacks).and_return(stack_status)
         | 
| 10 | 
            +
                allow(service).to receive(:describe_stack_events).and_return(stack_events)
         | 
| 11 | 
            +
                service
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              context "in progress" do
         | 
| 15 | 
            +
                let(:stack_status) { "UPDATE_IN_PROGRESS" }
         | 
| 16 | 
            +
                let(:stack_events) { JSON.load(IO.read("spec/fixtures/cfn/stack-events-in-progress.json")) }
         | 
| 17 | 
            +
                it "lists events since user initiated event" do
         | 
| 18 | 
            +
                  status.refresh_events
         | 
| 19 | 
            +
                  i = status.find_index(:start)
         | 
| 20 | 
            +
                  expect(i).to eq 15
         | 
| 21 | 
            +
                  # uncomment to view and debug
         | 
| 22 | 
            +
                  # status.show_events
         | 
| 23 | 
            +
                  # puts "****"
         | 
| 24 | 
            +
                  # status.show_events # show not show anything
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                it "lists events since last shown event" do
         | 
| 28 | 
            +
                  # first display
         | 
| 29 | 
            +
                  status.refresh_events
         | 
| 30 | 
            +
                  i = status.find_index(:start)
         | 
| 31 | 
            +
                  expect(i).to eq 15
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  # move the last event back in time 4 events, so should print 3 events
         | 
| 34 | 
            +
                  status.instance_variable_set(:@last_shown_event_id, "TargetGroup-ec634c43-b887-4bde-a525-7c69782865a6")
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  captured_events = []
         | 
| 37 | 
            +
                  allow(status).to receive(:print_event) do |e|
         | 
| 38 | 
            +
                    captured_events << "#{e["resource_type"]} #{e["resource_status"]}"
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
                  status.show_events
         | 
| 41 | 
            +
                  expect(captured_events).to eq([
         | 
| 42 | 
            +
                    "AWS::ElasticLoadBalancingV2::LoadBalancer DELETE_IN_PROGRESS",
         | 
| 43 | 
            +
                    "AWS::ElasticLoadBalancingV2::LoadBalancer DELETE_COMPLETE",
         | 
| 44 | 
            +
                    "AWS::EC2::SecurityGroup DELETE_IN_PROGRESS",
         | 
| 45 | 
            +
                  ])
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              context "complete" do
         | 
| 50 | 
            +
                let(:stack_status) { "UPDATE_COMPLETE" }
         | 
| 51 | 
            +
                let(:stack_events) { JSON.load(IO.read("spec/fixtures/cfn/stack-events-complete.json")) }
         | 
| 52 | 
            +
                it "lists events all the way to completion" do
         | 
| 53 | 
            +
                  status.refresh_events
         | 
| 54 | 
            +
                  i = status.find_index(:start)
         | 
| 55 | 
            +
                  expect(i).to eq 17
         | 
| 56 | 
            +
                  # uncomment to view and debug
         | 
| 57 | 
            +
                  # status.show_events
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
              context "update_rollback" do
         | 
| 62 | 
            +
                let(:stack_status) { "UPDATE_ROLLBACK_COMPLETE" }
         | 
| 63 | 
            +
                let(:stack_events) { JSON.load(IO.read("spec/fixtures/cfn/stack-events-update-rollback-complete.json")) }
         | 
| 64 | 
            +
                it "lists events all the way to update rollback complete" do
         | 
| 65 | 
            +
                  status.refresh_events
         | 
| 66 | 
            +
                  expect(status.success?).to be false
         | 
| 67 | 
            +
                  expect(status.update_rollback?).to be true
         | 
| 68 | 
            +
                  expect(status.rollback_error_message).to include("STATIC_NAME")
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  # i = status.find_index(:start)
         | 
| 71 | 
            +
                  # expect(i).to eq 17
         | 
| 72 | 
            +
                  # uncomment to view and debug
         | 
| 73 | 
            +
                  # status.show_events
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
              end
         | 
| 76 | 
            +
            end
         | 
| 77 | 
            +
             | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: lono
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tung Nguyen
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-07-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -206,6 +206,20 @@ dependencies: | |
| 206 206 | 
             
                - - ">="
         | 
| 207 207 | 
             
                  - !ruby/object:Gem::Version
         | 
| 208 208 | 
             
                    version: '0'
         | 
| 209 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 210 | 
            +
              name: memoist
         | 
| 211 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 212 | 
            +
                requirements:
         | 
| 213 | 
            +
                - - ">="
         | 
| 214 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 215 | 
            +
                    version: '0'
         | 
| 216 | 
            +
              type: :runtime
         | 
| 217 | 
            +
              prerelease: false
         | 
| 218 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 219 | 
            +
                requirements:
         | 
| 220 | 
            +
                - - ">="
         | 
| 221 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 222 | 
            +
                    version: '0'
         | 
| 209 223 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 210 224 | 
             
              name: byebug
         | 
| 211 225 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -316,10 +330,12 @@ files: | |
| 316 330 | 
             
            - lib/lono/cfn/aws_service.rb
         | 
| 317 331 | 
             
            - lib/lono/cfn/base.rb
         | 
| 318 332 | 
             
            - lib/lono/cfn/create.rb
         | 
| 333 | 
            +
            - lib/lono/cfn/current.rb
         | 
| 319 334 | 
             
            - lib/lono/cfn/delete.rb
         | 
| 320 335 | 
             
            - lib/lono/cfn/diff.rb
         | 
| 321 336 | 
             
            - lib/lono/cfn/download.rb
         | 
| 322 337 | 
             
            - lib/lono/cfn/preview.rb
         | 
| 338 | 
            +
            - lib/lono/cfn/status.rb
         | 
| 323 339 | 
             
            - lib/lono/cfn/update.rb
         | 
| 324 340 | 
             
            - lib/lono/cfn/util.rb
         | 
| 325 341 | 
             
            - lib/lono/clean.rb
         | 
| @@ -332,13 +348,16 @@ files: | |
| 332 348 | 
             
            - lib/lono/core.rb
         | 
| 333 349 | 
             
            - lib/lono/core/config.rb
         | 
| 334 350 | 
             
            - lib/lono/default/settings.yml
         | 
| 351 | 
            +
            - lib/lono/file_uploader.rb
         | 
| 335 352 | 
             
            - lib/lono/help.rb
         | 
| 336 353 | 
             
            - lib/lono/help/cfn.md
         | 
| 337 354 | 
             
            - lib/lono/help/cfn/create.md
         | 
| 355 | 
            +
            - lib/lono/help/cfn/current.md
         | 
| 338 356 | 
             
            - lib/lono/help/cfn/delete.md
         | 
| 339 357 | 
             
            - lib/lono/help/cfn/diff.md
         | 
| 340 358 | 
             
            - lib/lono/help/cfn/download.md
         | 
| 341 359 | 
             
            - lib/lono/help/cfn/preview.md
         | 
| 360 | 
            +
            - lib/lono/help/cfn/status.md
         | 
| 342 361 | 
             
            - lib/lono/help/cfn/update.md
         | 
| 343 362 | 
             
            - lib/lono/help/completion.md
         | 
| 344 363 | 
             
            - lib/lono/help/completion_script.md
         | 
| @@ -381,7 +400,9 @@ files: | |
| 381 400 | 
             
            - lib/lono/template/helper.rb
         | 
| 382 401 | 
             
            - lib/lono/template/template.rb
         | 
| 383 402 | 
             
            - lib/lono/template/upload.rb
         | 
| 384 | 
            -
            - lib/lono/ | 
| 403 | 
            +
            - lib/lono/upgrade.rb
         | 
| 404 | 
            +
            - lib/lono/upgrade/upgrade4.rb
         | 
| 405 | 
            +
            - lib/lono/upgrade/upgrade42.rb
         | 
| 385 406 | 
             
            - lib/lono/user_data.rb
         | 
| 386 407 | 
             
            - lib/lono/version.rb
         | 
| 387 408 | 
             
            - lib/starter_projects/autoscaling/.gitignore
         | 
| @@ -419,6 +440,9 @@ files: | |
| 419 440 | 
             
            - lib/starter_projects/skeleton/welcome.txt
         | 
| 420 441 | 
             
            - lono.gemspec
         | 
| 421 442 | 
             
            - spec/fixtures/cfn.json
         | 
| 443 | 
            +
            - spec/fixtures/cfn/stack-events-complete.json
         | 
| 444 | 
            +
            - spec/fixtures/cfn/stack-events-in-progress.json
         | 
| 445 | 
            +
            - spec/fixtures/cfn/stack-events-update-rollback-complete.json
         | 
| 422 446 | 
             
            - spec/fixtures/lono_project/.gitignore
         | 
| 423 447 | 
             
            - spec/fixtures/lono_project/Gemfile
         | 
| 424 448 | 
             
            - spec/fixtures/lono_project/Guardfile
         | 
| @@ -442,6 +466,7 @@ files: | |
| 442 466 | 
             
            - spec/fixtures/params/overlay/params/base/network.txt
         | 
| 443 467 | 
             
            - spec/fixtures/params/overlay/params/development/network.txt
         | 
| 444 468 | 
             
            - spec/fixtures/raw_templates/aws-waf-security-automations.template
         | 
| 469 | 
            +
            - spec/lib/lono/cfn/status_spec.rb
         | 
| 445 470 | 
             
            - spec/lib/lono/cfn_spec.rb
         | 
| 446 471 | 
             
            - spec/lib/lono/cli_spec.rb
         | 
| 447 472 | 
             
            - spec/lib/lono/completion_spec.rb
         | 
| @@ -485,13 +510,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 485 510 | 
             
                  version: '0'
         | 
| 486 511 | 
             
            requirements: []
         | 
| 487 512 | 
             
            rubyforge_project: 
         | 
| 488 | 
            -
            rubygems_version: 2.7. | 
| 513 | 
            +
            rubygems_version: 2.7.6
         | 
| 489 514 | 
             
            signing_key: 
         | 
| 490 515 | 
             
            specification_version: 4
         | 
| 491 516 | 
             
            summary: Lono is a CloudFormation Template ruby generator.  Lono generates CloudFormation
         | 
| 492 517 | 
             
              templates based on ERB templates.
         | 
| 493 518 | 
             
            test_files:
         | 
| 494 519 | 
             
            - spec/fixtures/cfn.json
         | 
| 520 | 
            +
            - spec/fixtures/cfn/stack-events-complete.json
         | 
| 521 | 
            +
            - spec/fixtures/cfn/stack-events-in-progress.json
         | 
| 522 | 
            +
            - spec/fixtures/cfn/stack-events-update-rollback-complete.json
         | 
| 495 523 | 
             
            - spec/fixtures/lono_project/.gitignore
         | 
| 496 524 | 
             
            - spec/fixtures/lono_project/Gemfile
         | 
| 497 525 | 
             
            - spec/fixtures/lono_project/Guardfile
         | 
| @@ -515,6 +543,7 @@ test_files: | |
| 515 543 | 
             
            - spec/fixtures/params/overlay/params/base/network.txt
         | 
| 516 544 | 
             
            - spec/fixtures/params/overlay/params/development/network.txt
         | 
| 517 545 | 
             
            - spec/fixtures/raw_templates/aws-waf-security-automations.template
         | 
| 546 | 
            +
            - spec/lib/lono/cfn/status_spec.rb
         | 
| 518 547 | 
             
            - spec/lib/lono/cfn_spec.rb
         | 
| 519 548 | 
             
            - spec/lib/lono/cli_spec.rb
         | 
| 520 549 | 
             
            - spec/lib/lono/completion_spec.rb
         |