opsicle 2.11.3 → 2.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 295427c9908b48e688459e853bff54e60ec3b00e
4
- data.tar.gz: 4e007d5493977059139c416a8d693616135a1b70
3
+ metadata.gz: ea2a588c2e4f763a774f40d63bbbb7c929a8f8e4
4
+ data.tar.gz: e3daa455afa7f0c2e8e35daa91ab6f92358181b4
5
5
  SHA512:
6
- metadata.gz: ff75ee6a9affba502c440a5346542f010e903c960b6a25412f9870e20f493e18724bee7170dca94e4dd698d72eceff2fe4e96260dc94111220807aeafebcb31f
7
- data.tar.gz: 8eeb17bb28133dd5085369a3dfbbdf9cbac5a4cc91da4ac2b626c9e27446baeed46d51edd1833cbe8f315704c4082ef793d491be92c8cccc17958c2a9619ba28
6
+ metadata.gz: 5b1febacf955033ad6e38c3bcb7b768e22e8d034500588b3cf448eccc43c391f5837b95edf1582348e2f028f20ae16d3d55580d6aeb10bd769a481242fa8fe5a
7
+ data.tar.gz: 8f3fc3fd905f2ecb8fae152b389860a5da4195928218cb0985fa831ab85215de83cdb6a47c49e80978630eb83da1481b7df27908deef1bb01c8b361bc2a9e8fc
@@ -1,5 +1,6 @@
1
1
  require 'gli'
2
2
  require "opsicle/user_profile"
3
+ require "opsicle/opsworks_adapter"
3
4
  require "opsicle/manageable_layer"
4
5
  require "opsicle/manageable_instance"
5
6
  require "opsicle/manageable_stack"
@@ -9,10 +10,9 @@ module Opsicle
9
10
 
10
11
  def initialize(environment)
11
12
  @client = Client.new(environment)
12
- @opsworks = @client.opsworks
13
- @ec2 = @client.ec2
13
+ @opsworks_adapter = OpsworksAdapter.new(@client)
14
14
  stack_id = @client.config.opsworks_config[:stack_id]
15
- @stack = ManageableStack.new(@client.config.opsworks_config[:stack_id], @opsworks)
15
+ @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
16
16
  @cli = HighLine.new
17
17
  end
18
18
 
@@ -30,11 +30,11 @@ module Opsicle
30
30
 
31
31
  def select_layer
32
32
  puts "\nLayers:\n"
33
- ops_layers = @opsworks.describe_layers({ :stack_id => @stack.id }).layers
33
+ ops_layers = @opsworks_adapter.get_layers(@stack.id)
34
34
 
35
35
  layers = []
36
36
  ops_layers.each do |layer|
37
- layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks, @ec2, @cli)
37
+ layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client.ec2, @cli)
38
38
  end
39
39
 
40
40
  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
@@ -10,9 +10,9 @@ module Opsicle
10
10
 
11
11
  def initialize(environment)
12
12
  @client = Client.new(environment)
13
- @opsworks_adapater = OpsworksAdapter.new(@client)
13
+ @opsworks_adapter = OpsworksAdapter.new(@client)
14
14
  stack_id = @client.config.opsworks_config[:stack_id]
15
- @stack = ManageableStack.new(stack_id, @opsworks_adapater.client)
15
+ @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
16
16
  @cli = HighLine.new
17
17
  end
18
18
 
@@ -36,11 +36,11 @@ module Opsicle
36
36
 
37
37
  def select_layer
38
38
  puts "\nLayers:\n"
39
- ops_layers = @opsworks_adapater.get_layers(@stack.id)
39
+ ops_layers = @opsworks_adapter.get_layers(@stack.id)
40
40
 
41
41
  layers = []
42
42
  ops_layers.each do |layer|
43
- layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapater.client, @client.ec2, @cli)
43
+ layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client.ec2, @cli)
44
44
  end
45
45
 
46
46
  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
@@ -1,5 +1,6 @@
1
1
  require 'gli'
2
2
  require "opsicle/user_profile"
3
+ require "opsicle/opsworks_adapter"
3
4
  require "opsicle/manageable_layer"
4
5
  require "opsicle/manageable_stack"
5
6
  require "opsicle/creatable_instance"
@@ -9,10 +10,9 @@ module Opsicle
9
10
 
10
11
  def initialize(environment)
11
12
  @client = Client.new(environment)
12
- @opsworks = @client.opsworks
13
- @ec2 = @client.ec2
13
+ @opsworks_adapter = OpsworksAdapter.new(@client)
14
14
  stack_id = @client.config.opsworks_config[:stack_id]
15
- @stack = ManageableStack.new(@client.config.opsworks_config[:stack_id], @opsworks)
15
+ @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
16
16
  @cli = HighLine.new
17
17
  end
18
18
 
@@ -26,16 +26,16 @@ module Opsicle
26
26
  end
27
27
 
28
28
  def create_instance(layer, options)
29
- CreatableInstance.new(layer, @stack, @opsworks, @ec2, @cli).create(options)
29
+ CreatableInstance.new(layer, @stack, @opsworks_adapter.client, @client.ec2, @cli).create(options)
30
30
  end
31
31
 
32
32
  def select_layer
33
33
  puts "\nLayers:\n"
34
- ops_layers = @opsworks.describe_layers({ :stack_id => @stack.id }).layers
34
+ ops_layers = @opsworks_adapter.get_layers(@stack.id)
35
35
 
36
36
  layers = []
37
37
  ops_layers.each do |layer|
38
- layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks, @ec2, @cli)
38
+ layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client.ec2, @cli)
39
39
  end
40
40
 
41
41
  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
@@ -1,5 +1,6 @@
1
1
  require 'gli'
2
2
  require "opsicle/user_profile"
3
+ require "opsicle/opsworks_adapter"
3
4
  require "opsicle/manageable_layer"
4
5
  require "opsicle/manageable_instance"
5
6
  require "opsicle/manageable_stack"
@@ -9,10 +10,9 @@ module Opsicle
9
10
 
10
11
  def initialize(environment)
11
12
  @client = Client.new(environment)
12
- @opsworks = @client.opsworks
13
- @ec2 = @client.ec2
13
+ @opsworks_adapter = OpsworksAdapter.new(@client)
14
14
  stack_id = @client.config.opsworks_config[:stack_id]
15
- @stack = ManageableStack.new(@client.config.opsworks_config[:stack_id], @opsworks)
15
+ @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
16
16
  @cli = HighLine.new
17
17
  end
18
18
 
@@ -22,7 +22,7 @@ module Opsicle
22
22
  instances_to_delete = select_instances(layer)
23
23
  instances_to_delete.each do |instance|
24
24
  begin
25
- @opsworks.delete_instance(instance_id: instance.instance_id)
25
+ @opsworks_adapter.delete_instance(instance.instance_id)
26
26
  puts "Successfully deleted #{instance.hostname}"
27
27
  rescue
28
28
  puts "Failed to delete #{instance.hostname}"
@@ -36,11 +36,11 @@ module Opsicle
36
36
 
37
37
  def select_layer
38
38
  puts "\nLayers:\n"
39
- ops_layers = @opsworks.describe_layers({ :stack_id => @stack.id }).layers
39
+ ops_layers = @opsworks_adapter.get_layers(@stack_id)
40
40
 
41
41
  layers = []
42
42
  ops_layers.each do |layer|
43
- layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks, @ec2, @cli)
43
+ layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client.ec2, @cli)
44
44
  end
45
45
 
46
46
  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
@@ -1,5 +1,6 @@
1
1
  require 'gli'
2
2
  require "opsicle/user_profile"
3
+ require "opsicle/opsworks_adapter"
3
4
  require "opsicle/manageable_layer"
4
5
  require "opsicle/manageable_instance"
5
6
  require "opsicle/manageable_stack"
@@ -9,11 +10,10 @@ module Opsicle
9
10
 
10
11
  def initialize(environment)
11
12
  @client = Client.new(environment)
12
- @opsworks = @client.opsworks
13
- @ec2 = @client.ec2
13
+ @opsworks_adpater = OpsworksAdapter.new(@client)
14
14
  stack_id = @client.config.opsworks_config[:stack_id]
15
15
  @cli = HighLine.new
16
- @stack = ManageableStack.new(@client.config.opsworks_config[:stack_id], @opsworks, @cli)
16
+ @stack = ManageableStack.new(stack_id, @opsworks_adpater.client, @cli)
17
17
  end
18
18
 
19
19
  def execute(options={})
@@ -1,5 +1,6 @@
1
1
  require 'gli'
2
2
  require "opsicle/user_profile"
3
+ require "opsicle/opsworks_adapter"
3
4
  require "opsicle/manageable_layer"
4
5
  require "opsicle/manageable_instance"
5
6
  require "opsicle/manageable_stack"
@@ -9,10 +10,9 @@ module Opsicle
9
10
 
10
11
  def initialize(environment)
11
12
  @client = Client.new(environment)
12
- @opsworks = @client.opsworks
13
- @ec2 = @client.ec2
13
+ @opsworks_adapter = OpsworksAdapter.new(@client)
14
14
  stack_id = @client.config.opsworks_config[:stack_id]
15
- @stack = ManageableStack.new(@client.config.opsworks_config[:stack_id], @opsworks)
15
+ @stack = ManageableStack.new(stack_id, @opsworks_adapter.client)
16
16
  @cli = HighLine.new
17
17
  end
18
18
 
@@ -22,7 +22,7 @@ module Opsicle
22
22
  instances_to_stop = select_instances(layer)
23
23
  instances_to_stop.each do |instance|
24
24
  begin
25
- @opsworks.stop_instance(instance_id: instance.instance_id)
25
+ @opsworks_adapter.stop_instance(instance.instance_id)
26
26
  puts "Stopping instance #{instance.hostname}..."
27
27
  rescue
28
28
  puts "Failed to stop #{instance.hostname}"
@@ -36,11 +36,11 @@ module Opsicle
36
36
 
37
37
  def select_layer
38
38
  puts "\nLayers:\n"
39
- ops_layers = @opsworks.describe_layers({ :stack_id => @stack.id }).layers
39
+ ops_layers = @opsworks_adpater.get_layers(@stack.id)
40
40
 
41
41
  layers = []
42
42
  ops_layers.each do |layer|
43
- layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks, @ec2, @cli)
43
+ layers << ManageableLayer.new(layer.name, layer.layer_id, @stack, @opsworks_adapter.client, @client.ec2, @cli)
44
44
  end
45
45
 
46
46
  layers.each_with_index { |layer, index| puts "#{index.to_i + 1}) #{layer.name}" }
@@ -12,4 +12,12 @@ class Opsicle::OpsworksAdapter
12
12
  def start_instance(instance_id)
13
13
  client.start_instance(instance_id: instance_id)
14
14
  end
15
+
16
+ def stop_instance(instance_id)
17
+ client.stop_instance(instance_id: instance_id)
18
+ end
19
+
20
+ def delete_instance(instance_id)
21
+ client.delete_instance(instance_id: instance_id)
22
+ end
15
23
  end
@@ -1,3 +1,3 @@
1
1
  module Opsicle
2
- VERSION = "2.11.3"
2
+ VERSION = "2.12.0"
3
3
  end
@@ -1,9 +1,10 @@
1
1
  describe Opsicle::OpsworksAdapter do
2
2
  let(:aws_opsworks_client) do
3
- double(
4
- :aws_opsworks_client,
5
- describe_layers: double(:layers, layers: []),
6
- start_instance: true
3
+ double(:aws_opsworks_client,
4
+ describe_layers: double(:layers, layers: []),
5
+ start_instance: :started,
6
+ stop_instance: :stopped,
7
+ delete_instance: :deleted
7
8
  )
8
9
  end
9
10
  let(:client) { double(:client, opsworks: aws_opsworks_client) }
@@ -16,17 +17,23 @@ describe Opsicle::OpsworksAdapter do
16
17
  it "should gather an array of layers for this opsworks client" do
17
18
  expect(get_layers).to be_empty
18
19
  end
19
-
20
- it "should call describe_layers on the opsworks client" do
21
- expect(aws_opsworks_client).to receive(:describe_layers).with(stack_id: :stack_id)
22
- get_layers
23
- end
24
20
  end
25
21
 
26
22
  describe "#start_instance" do
27
23
  it "should call start_instance on the opsworks client" do
28
- expect(aws_opsworks_client).to receive(:start_instance).with(instance_id: :instance_id)
29
- subject.start_instance(:instance_id)
24
+ expect(subject.start_instance(:instance_id)).to eq(:started)
25
+ end
26
+ end
27
+
28
+ describe "#stop_instance" do
29
+ it "should call stop_instance on the opsworks client" do
30
+ expect(subject.stop_instance(:instance_id)).to eq(:stopped)
31
+ end
32
+ end
33
+
34
+ describe "#delete_instance" do
35
+ it "should call delete_instance on the opsworks client" do
36
+ expect(subject.delete_instance(:instance_id)).to eq(:deleted)
30
37
  end
31
38
  end
32
39
  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.11.3
4
+ version: 2.12.0
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-03-16 00:00:00.000000000 Z
12
+ date: 2018-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk