opsicle 2.12.1 → 2.12.2
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/lib/opsicle/commands/add_tags.rb +3 -1
- data/lib/opsicle/commands/clone_instance.rb +3 -1
- data/lib/opsicle/commands/create_instance.rb +4 -2
- data/lib/opsicle/commands/delete_instance.rb +3 -1
- data/lib/opsicle/commands/stop_instance.rb +3 -1
- data/lib/opsicle/ec2_adapter.rb +15 -0
- data/lib/opsicle/version.rb +1 -1
- data/spec/opsicle/ec2_adapter_spec.rb +23 -0
- metadata +5 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6c6b93ef64ca7f88eab52c8ee74dcaf62118e685
         | 
| 4 | 
            +
              data.tar.gz: 9394c8f6bd05cf4488389d61c01009cdd21bd35e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0de83bd629358a9ab0a6855f0232e5b6cd246f02084ec75606218e28cb1737f97fde7477c067931a3df9c1d290b98c7d3ec23348398a070798a4e9c521011ece
         | 
| 7 | 
            +
              data.tar.gz: 1a3c871b0cb9564f62c000a474b16a5719d49b421510b3f69b884f22161700c8eb4e85894c4a06fdf54a97fd021e6ceb3acab0b6969c3e53c412ad65bea858cc
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            require 'gli'
         | 
| 2 2 | 
             
            require "opsicle/user_profile"
         | 
| 3 3 | 
             
            require "opsicle/opsworks_adapter"
         | 
| 4 | 
            +
            require "opsicle/ec2_adapter"
         | 
| 4 5 | 
             
            require "opsicle/manageable_layer"
         | 
| 5 6 | 
             
            require "opsicle/manageable_instance"
         | 
| 6 7 | 
             
            require "opsicle/manageable_stack"
         | 
| @@ -10,6 +11,7 @@ module Opsicle | |
| 10 11 |  | 
| 11 12 | 
             
                def initialize(environment)
         | 
| 12 13 | 
             
                  @client = Client.new(environment)
         | 
| 14 | 
            +
                  @ec2_adapter = Ec2Adapter.new(@client)
         | 
| 13 15 | 
             
                  @opsworks_adapter = OpsworksAdapter.new(@client)
         | 
| 14 16 | 
             
                  stack_id = @client.config.opsworks_config[:stack_id]
         | 
| 15 17 | 
             
                  @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
         | 
| @@ -34,7 +36,7 @@ module Opsicle | |
| 34 36 |  | 
| 35 37 | 
             
                  layers = []
         | 
| 36 38 | 
             
                  ops_layers.each do |layer|
         | 
| 37 | 
            -
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client | 
| 39 | 
            +
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @ec2_adapter.client, @cli)
         | 
| 38 40 | 
             
                  end
         | 
| 39 41 |  | 
| 40 42 | 
             
                  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            require 'gli'
         | 
| 2 2 | 
             
            require "opsicle/user_profile"
         | 
| 3 3 | 
             
            require "opsicle/opsworks_adapter"
         | 
| 4 | 
            +
            require "opsicle/ec2_adapter"
         | 
| 4 5 | 
             
            require "opsicle/manageable_layer"
         | 
| 5 6 | 
             
            require "opsicle/manageable_instance"
         | 
| 6 7 | 
             
            require "opsicle/manageable_stack"
         | 
| @@ -10,6 +11,7 @@ module Opsicle | |
| 10 11 |  | 
| 11 12 | 
             
                def initialize(environment)
         | 
| 12 13 | 
             
                  @client = Client.new(environment)
         | 
| 14 | 
            +
                  @ec2_adapter = Ec2Adapter.new(@client)
         | 
| 13 15 | 
             
                  @opsworks_adapter = OpsworksAdapter.new(@client)
         | 
| 14 16 | 
             
                  stack_id = @client.config.opsworks_config[:stack_id]
         | 
| 15 17 | 
             
                  @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
         | 
| @@ -40,7 +42,7 @@ module Opsicle | |
| 40 42 |  | 
| 41 43 | 
             
                  layers = []
         | 
| 42 44 | 
             
                  ops_layers.each do |layer|
         | 
| 43 | 
            -
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client | 
| 45 | 
            +
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @ec2_adapter.client, @cli)
         | 
| 44 46 | 
             
                  end
         | 
| 45 47 |  | 
| 46 48 | 
             
                  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            require 'gli'
         | 
| 2 2 | 
             
            require "opsicle/user_profile"
         | 
| 3 3 | 
             
            require "opsicle/opsworks_adapter"
         | 
| 4 | 
            +
            require "opsicle/ec2_adapter"
         | 
| 4 5 | 
             
            require "opsicle/manageable_layer"
         | 
| 5 6 | 
             
            require "opsicle/manageable_stack"
         | 
| 6 7 | 
             
            require "opsicle/creatable_instance"
         | 
| @@ -10,6 +11,7 @@ module Opsicle | |
| 10 11 |  | 
| 11 12 | 
             
                def initialize(environment)
         | 
| 12 13 | 
             
                  @client = Client.new(environment)
         | 
| 14 | 
            +
                  @ec2_adapter = Ec2Adapter.new(@client)
         | 
| 13 15 | 
             
                  @opsworks_adapter = OpsworksAdapter.new(@client)
         | 
| 14 16 | 
             
                  stack_id = @client.config.opsworks_config[:stack_id]
         | 
| 15 17 | 
             
                  @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
         | 
| @@ -26,7 +28,7 @@ module Opsicle | |
| 26 28 | 
             
                end
         | 
| 27 29 |  | 
| 28 30 | 
             
                def create_instance(layer, options)
         | 
| 29 | 
            -
                  CreatableInstance.new(layer, @stack, @opsworks_adapter.client, @client | 
| 31 | 
            +
                  CreatableInstance.new(layer, @stack, @opsworks_adapter.client, @ec2_adapter.client, @cli).create(options)
         | 
| 30 32 | 
             
                end
         | 
| 31 33 |  | 
| 32 34 | 
             
                def select_layer
         | 
| @@ -35,7 +37,7 @@ module Opsicle | |
| 35 37 |  | 
| 36 38 | 
             
                  layers = []
         | 
| 37 39 | 
             
                  ops_layers.each do |layer|
         | 
| 38 | 
            -
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client | 
| 40 | 
            +
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @ec2_adapter.client, @cli)
         | 
| 39 41 | 
             
                  end
         | 
| 40 42 |  | 
| 41 43 | 
             
                  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            require 'gli'
         | 
| 2 2 | 
             
            require "opsicle/user_profile"
         | 
| 3 3 | 
             
            require "opsicle/opsworks_adapter"
         | 
| 4 | 
            +
            require "opsicle/ec2_adapter"
         | 
| 4 5 | 
             
            require "opsicle/manageable_layer"
         | 
| 5 6 | 
             
            require "opsicle/manageable_instance"
         | 
| 6 7 | 
             
            require "opsicle/manageable_stack"
         | 
| @@ -10,6 +11,7 @@ module Opsicle | |
| 10 11 |  | 
| 11 12 | 
             
                def initialize(environment)
         | 
| 12 13 | 
             
                  @client = Client.new(environment)
         | 
| 14 | 
            +
                  @ec2_adapter = Ec2Adapter.new(@client)
         | 
| 13 15 | 
             
                  @opsworks_adapter = OpsworksAdapter.new(@client)
         | 
| 14 16 | 
             
                  stack_id = @client.config.opsworks_config[:stack_id]
         | 
| 15 17 | 
             
                  @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
         | 
| @@ -40,7 +42,7 @@ module Opsicle | |
| 40 42 |  | 
| 41 43 | 
             
                  layers = []
         | 
| 42 44 | 
             
                  ops_layers.each do |layer|
         | 
| 43 | 
            -
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client | 
| 45 | 
            +
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @ec2_adapter.client, @cli)
         | 
| 44 46 | 
             
                  end
         | 
| 45 47 |  | 
| 46 48 | 
             
                  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            require 'gli'
         | 
| 2 2 | 
             
            require "opsicle/user_profile"
         | 
| 3 3 | 
             
            require "opsicle/opsworks_adapter"
         | 
| 4 | 
            +
            require "opsicle/ec2_adapter"
         | 
| 4 5 | 
             
            require "opsicle/manageable_layer"
         | 
| 5 6 | 
             
            require "opsicle/manageable_instance"
         | 
| 6 7 | 
             
            require "opsicle/manageable_stack"
         | 
| @@ -10,6 +11,7 @@ module Opsicle | |
| 10 11 |  | 
| 11 12 | 
             
                def initialize(environment)
         | 
| 12 13 | 
             
                  @client = Client.new(environment)
         | 
| 14 | 
            +
                  @ec2_adapter = Ec2Adapter.new(@client)
         | 
| 13 15 | 
             
                  @opsworks_adapter = OpsworksAdapter.new(@client)
         | 
| 14 16 | 
             
                  stack_id = @client.config.opsworks_config[:stack_id]
         | 
| 15 17 | 
             
                  @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
         | 
| @@ -40,7 +42,7 @@ module Opsicle | |
| 40 42 |  | 
| 41 43 | 
             
                  layers = []
         | 
| 42 44 | 
             
                  ops_layers.each do |layer|
         | 
| 43 | 
            -
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client | 
| 45 | 
            +
                    layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @ec2_adapter.client, @cli)
         | 
| 44 46 | 
             
                  end
         | 
| 45 47 |  | 
| 46 48 | 
             
                  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            class Opsicle::Ec2Adapter
         | 
| 2 | 
            +
              attr_reader :client
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              def initialize(client)
         | 
| 5 | 
            +
                @client = client.ec2
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              def get_subnets
         | 
| 9 | 
            +
                client.describe_subnets.subnets
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def tag_instance(ec2_instance_id, tags)
         | 
| 13 | 
            +
                client.create_tags(resources: [ ec2_instance_id ], tags: tags)
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
            end
         | 
    
        data/lib/opsicle/version.rb
    CHANGED
    
    
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            describe Opsicle::Ec2Adapter do
         | 
| 2 | 
            +
              let(:aws_ec2_client) do
         | 
| 3 | 
            +
                double(:aws_ec2_client,
         | 
| 4 | 
            +
                 describe_subnets: double(:subnets, subnets: []),
         | 
| 5 | 
            +
                 create_tags: :tags_created
         | 
| 6 | 
            +
                )
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
              let(:client) { double(:client, ec2: aws_ec2_client) }
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              subject { described_class.new(client) }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              describe "#get_subnets" do
         | 
| 13 | 
            +
                it "should gather an array of subnets for this ec2 client" do
         | 
| 14 | 
            +
                  expect(subject.get_subnets).to be_empty
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              describe "#tag_instance" do
         | 
| 19 | 
            +
                it "should call to create a tag on an instance" do
         | 
| 20 | 
            +
                  expect(subject.tag_instance(:instance_id, [1, 2, 3])).to eq(:tags_created)
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: opsicle
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.12. | 
| 4 | 
            +
              version: 2.12.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Andy Fleener
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2018- | 
| 12 | 
            +
            date: 2018-08-02 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: aws-sdk
         | 
| @@ -216,6 +216,7 @@ files: | |
| 216 216 | 
             
            - lib/opsicle/deploy_helper.rb
         | 
| 217 217 | 
             
            - lib/opsicle/deployment.rb
         | 
| 218 218 | 
             
            - lib/opsicle/deployments.rb
         | 
| 219 | 
            +
            - lib/opsicle/ec2_adapter.rb
         | 
| 219 220 | 
             
            - lib/opsicle/errors.rb
         | 
| 220 221 | 
             
            - lib/opsicle/instances.rb
         | 
| 221 222 | 
             
            - lib/opsicle/layer.rb
         | 
| @@ -255,6 +256,7 @@ files: | |
| 255 256 | 
             
            - spec/opsicle/commands/update_spec.rb
         | 
| 256 257 | 
             
            - spec/opsicle/commands/user_profile_info_spec.rb
         | 
| 257 258 | 
             
            - spec/opsicle/config_spec.rb
         | 
| 259 | 
            +
            - spec/opsicle/ec2_adapter_spec.rb
         | 
| 258 260 | 
             
            - spec/opsicle/errors_spec.rb
         | 
| 259 261 | 
             
            - spec/opsicle/instances_spec.rb
         | 
| 260 262 | 
             
            - spec/opsicle/layer_spec.rb
         | 
| @@ -310,6 +312,7 @@ test_files: | |
| 310 312 | 
             
            - spec/opsicle/s3_bucket_spec.rb
         | 
| 311 313 | 
             
            - spec/opsicle/manageable_layer_spec.rb
         | 
| 312 314 | 
             
            - spec/opsicle/opsworks_adapter_spec.rb
         | 
| 315 | 
            +
            - spec/opsicle/ec2_adapter_spec.rb
         | 
| 313 316 | 
             
            - spec/opsicle/commands/deploy_spec.rb
         | 
| 314 317 | 
             
            - spec/opsicle/commands/clone_instance_spec.rb
         | 
| 315 318 | 
             
            - spec/opsicle/commands/chef_update_spec.rb
         |