opsicle 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGZlNmRhOWYwZGQwYWNmYmUwZDc1NDUwMDkyNjBlNzYyZDk3NjU3OA==
4
+ YjgxNjkzMWVjMmJlYTllZWFjNjI0NTQzMjRlODFiNzYwMTM2Y2NlYQ==
5
5
  data.tar.gz: !binary |-
6
- NTA5Zjk5Y2E1OWU3OTc2YjQ0MDZmY2ZjODJhYmM0ZmYzMDE1NjY2Yw==
6
+ YzdlMDkyYzMxMzI1ZDg0ZjYyNDllZTk4YmZjZDdkZDc1NGQ1YWE4Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTNjYmVmYzg2NzIzMTE2ZTA2MmEwMGEwNGZjMGMwMmI4OTkxNzgyZWM0OWQy
10
- YWZlNzRhYmJjYjFhZWM0NjU0NDgxODk1ZmViM2E1YzEzYWRkNWQxYzU5MTlk
11
- ZTg0M2U4YTM3NWUzNzFhNWIwNmI3NmVjMjQzZWNjMjU2MzhjMzM=
9
+ NjUwYzNhMzVmMjMwY2I3NGEyY2VhYzZiMTRkYjc4ZTNhYjU5Nzg5N2I5ZTgx
10
+ ZDAyODY1Yjc2ODQ2ZmJkNWYwZGI0Y2ZjMDAwZGJiYWRmMDJiYTg1OTU5YjEy
11
+ MjhmNzcxMjVjZTU1OWZmZDFhZWFhYWJiNGEzNTljNjQzYzA4MTY=
12
12
  data.tar.gz: !binary |-
13
- YjAwMzVjZThkNDFiZTNhZGYxMTgwM2FiNDRjMjE0NTZhZGEyYmM0MjZmMDZi
14
- YmNjOTc3NzQzNGZlNzU5ZDJkMjk3NjI3ZjUzOTNlNzdkOGU2ZDc5ZDUxMmNj
15
- MzA2YmJlOTRkZDFjMTAyMmJhNGFiMTY3NzU0NGNjMDdkZTc5ZDc=
13
+ YTNiZTgzMTgxMDY2N2Q4ZjM3ZTMzMmY3NjEzMjExNTU3YTUyODBhNjA4OGZi
14
+ NzIxMjZhZGFlMjIyZDExZmYzZmViNzQxY2RkZDk2Y2M4ODkxMDQ2MzUxZDVm
15
+ YjhmOTgwODViZGVmZWQ3NTFkOWI5NzZhZDc2ZGFlZjg1MmU1N2Y=
data/bin/opsicle CHANGED
@@ -57,6 +57,8 @@ end
57
57
  desc "SSH access to instances in the given environment stack"
58
58
  arg_name '<environment>'
59
59
  command :ssh do |c|
60
+ c.flag [:o, :"ssh-opts"], :desc => "SSH command line options.", :must_match => '/"[^"]+"/'
61
+ c.flag [:c, :"ssh-cmd"], :desc => "Command to pass to SSH", :must_match => '/"[^"]+"/'
60
62
  c.action do |global_options, options, args|
61
63
  raise ArgumentError, "Environment is required" unless args.first
62
64
  Opsicle::SSH.new(args.first).execute global_options.merge(options)
@@ -118,11 +120,12 @@ end
118
120
  desc "Update the Stack Custom Chef Cookbooks"
119
121
  arg_name '<environment>'
120
122
  command 'chef-update' do |c|
123
+ c.switch [:m, :monitor], :desc => "Run the Stack Monitor on deploy", :default_value => true
121
124
  c.flag [:path],
122
125
  :desc => "Path to the directory of chef cookbooks to be uploaded to s3",
123
126
  :default_value => "cookbooks"
124
127
  c.flag [:"bucket-name"],
125
- :desc => "The S3 bucket name to upload the cookbooks to"
128
+ :desc => "The S3 bucket name to upload the cookbooks to (required for opsicle to perform an upload to S3)"
126
129
  c.action do |global_options, options, args|
127
130
  raise ArgumentError, "Environment is required" unless args.first
128
131
 
@@ -18,9 +18,11 @@ module Opsicle
18
18
  end
19
19
 
20
20
  def execute(options={ monitor: true })
21
- tar_cookbooks(options[:path])
22
- s3_upload(options[:"bucket-name"])
23
- cleanup_tar
21
+ if options[:"bucket-name"]
22
+ tar_cookbooks(options[:path])
23
+ s3_upload(options[:"bucket-name"])
24
+ cleanup_tar
25
+ end
24
26
  response = update_custom_cookbooks
25
27
  launch_stack_monitor(response, options)
26
28
  end
@@ -18,8 +18,11 @@ module Opsicle
18
18
  end
19
19
 
20
20
  instance_ip = instances[choice-1][:elastic_ip] || instances[choice-1][:public_ip]
21
+ ssh_command = " \"#{options[:"ssh-cmd"].gsub(/'/){ %q(\') }}\"" if options[:"ssh-cmd"] #escape single quotes
22
+ ssh_options = "#{options[:"ssh-opts"]} " if options[:"ssh-opts"]
23
+
24
+ command = "ssh #{ssh_options}#{ssh_username}@#{instance_ip}#{ssh_command}"
21
25
 
22
- command = "ssh #{ssh_username}@#{instance_ip}"
23
26
  Output.say_verbose "Executing shell command: #{command}"
24
27
  system(command)
25
28
  end
@@ -1,3 +1,3 @@
1
1
  module Opsicle
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -26,35 +26,37 @@ module Opsicle
26
26
  end
27
27
 
28
28
  context "#execute" do
29
-
30
- it "tars up the cookooks" do
31
- allow(subject).to receive(:s3_upload)
32
- allow(subject).to receive(:cleanup_tar)
33
- allow(subject).to receive(:update_custom_cookbooks)
34
- allow(subject).to receive(:launch_stack_monitor)
35
- expect(subject).to receive(:tar_cookbooks)
36
-
37
- subject.execute
38
- end
39
-
40
- it "uploads the cookbooks to s3" do
41
- allow(subject).to receive(:tar_cookbooks)
42
- allow(subject).to receive(:cleanup_tar)
43
- allow(subject).to receive(:update_custom_cookbooks)
44
- allow(subject).to receive(:launch_stack_monitor)
45
- expect(subject).to receive(:s3_upload)
46
-
47
- subject.execute
48
- end
49
-
50
- it "cleans up the tarball created to upload to s3" do
51
- allow(subject).to receive(:tar_cookbooks)
52
- allow(subject).to receive(:s3_upload)
53
- allow(subject).to receive(:update_custom_cookbooks)
54
- allow(subject).to receive(:launch_stack_monitor)
55
- expect(subject).to receive(:cleanup_tar)
56
-
57
- subject.execute
29
+ context "s3 upload" do
30
+
31
+ it "tars up the cookooks" do
32
+ allow(subject).to receive(:s3_upload)
33
+ allow(subject).to receive(:cleanup_tar)
34
+ allow(subject).to receive(:update_custom_cookbooks)
35
+ allow(subject).to receive(:launch_stack_monitor)
36
+ expect(subject).to receive(:tar_cookbooks)
37
+
38
+ subject.execute(:"bucket-name" => bucket_name)
39
+ end
40
+
41
+ it "uploads the cookbooks to s3" do
42
+ allow(subject).to receive(:tar_cookbooks)
43
+ allow(subject).to receive(:cleanup_tar)
44
+ allow(subject).to receive(:update_custom_cookbooks)
45
+ allow(subject).to receive(:launch_stack_monitor)
46
+ expect(subject).to receive(:s3_upload)
47
+
48
+ subject.execute(:"bucket-name" => bucket_name)
49
+ end
50
+
51
+ it "cleans up the tarball created to upload to s3" do
52
+ allow(subject).to receive(:tar_cookbooks)
53
+ allow(subject).to receive(:s3_upload)
54
+ allow(subject).to receive(:update_custom_cookbooks)
55
+ allow(subject).to receive(:launch_stack_monitor)
56
+ expect(subject).to receive(:cleanup_tar)
57
+
58
+ subject.execute(:"bucket-name" => bucket_name)
59
+ end
58
60
  end
59
61
 
60
62
  it "creates a new update_custom_cookbooks and opens stack monitor" do
@@ -57,6 +57,17 @@ module Opsicle
57
57
  expect(subject).not_to receive(:ask)
58
58
  subject.execute
59
59
  end
60
+
61
+ it "executes ssh with ssh options and command" do
62
+ allow(subject).to receive(:instances) {[
63
+ { hostname: "host1", elastic_ip: "123.123.123.123" },
64
+ { hostname: "host2", elastic_ip: "789.789.789.789" }
65
+ ]}
66
+
67
+ expect(subject).to receive(:system).with("ssh -p 234 mrderpyman2014@789.789.789.789 \"cd /srv/www\"")
68
+ subject.execute({ :"ssh-opts" => '-p 234', :"ssh-cmd" => 'cd /srv/www'})
69
+ end
70
+
60
71
  end
61
72
 
62
73
  context "#client" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsicle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Fleener
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  version: '0'
239
239
  requirements: []
240
240
  rubyforge_project:
241
- rubygems_version: 2.2.2
241
+ rubygems_version: 2.2.1
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: An opsworks specific abstraction on top of the aws sdk