ops_worker 0.0.6 → 0.0.7
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.
- data/README.md +20 -4
- data/lib/ops_worker/cli.rb +3 -1
- data/lib/ops_worker/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -11,18 +11,22 @@ Quick command line tool for handling servers on OpsWorks.
|
|
11
11
|
ops_worker --app homepage_staging rollback
|
12
12
|
ops_worker --app homepage_staging update_cookbooks
|
13
13
|
ops_worker --app homepage_staging execute_recipe --recipe-name monit
|
14
|
+
ops_worker --app homepage_staging restart
|
14
15
|
|
15
16
|
## Ruby Example
|
16
17
|
```ruby
|
17
18
|
require 'ops_worker'
|
18
19
|
|
20
|
+
# Initialize using the default AWS.config. You can optionally initialize like
|
21
|
+
# client = OpsWorker::Client.new(:access_key_id => "foo", :secret_access_key => "bar")
|
19
22
|
client = OpsWorker::Client.new
|
20
|
-
# or, client = OpsWorker::Client.new(:access_key_id => "foo", :secret_access_key => "bar")
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
#<OpsWorker::Stack
|
24
|
+
# Get a list of all stacks; this will be cached until you call #reload
|
25
|
+
client.stacks
|
26
|
+
# => [#<OpsWorker::Stack f1735a57-51c3-4933-8440-4f7beb2cb2ff, homepage_staging, us-east-1>]
|
25
27
|
|
28
|
+
# Iterates through all your stacks to find the app named "homepage_staging"
|
29
|
+
# Alternatively, you can do client.stacks.each {|s| s.apps.each {|a| ... } }
|
26
30
|
app = client.find_app_by_name("homepage_staging")
|
27
31
|
app.instances.each do |instance|
|
28
32
|
puts("#{instance.name} is online: #{instance.online?}")
|
@@ -39,4 +43,16 @@ app.update_cookbooks()
|
|
39
43
|
app.execute_recipes(["monit"])
|
40
44
|
|
41
45
|
app.rollback()
|
46
|
+
|
47
|
+
app.restart()
|
48
|
+
|
49
|
+
client.reload()
|
50
|
+
|
51
|
+
client.stacks
|
52
|
+
# => [#<OpsWorker::Stack f1735a57-51c3-4933-8440-4f7beb2cb2ff, homepage_staging, us-east-1>,
|
53
|
+
#<OpsWorker::Stack 3bf98404-dafc-45c4-9fa2-a17485aba4ec, homepage_production, us-east-1>]
|
54
|
+
|
55
|
+
# Method missing is delegated to an AWS::OpsWork::Client, so you can use any method from
|
56
|
+
# http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/OpsWorks/Client.html
|
57
|
+
client.describe_deployments(:app_id => app.id)
|
42
58
|
```
|
data/lib/ops_worker/cli.rb
CHANGED
@@ -5,7 +5,7 @@ module OpsWorker
|
|
5
5
|
def self.start
|
6
6
|
client = OpsWorker::Client.new
|
7
7
|
|
8
|
-
sub_commands = ["deploy", "rollback", "update_cookbooks", "execute_recipe"]
|
8
|
+
sub_commands = ["deploy", "rollback", "update_cookbooks", "execute_recipe", "restart"]
|
9
9
|
opts = Trollop::options do
|
10
10
|
banner "ops_worker AWS OpsWorks helper"
|
11
11
|
opt :app, "Application", :type => :string, :short => :a, :required => true
|
@@ -31,6 +31,8 @@ module OpsWorker
|
|
31
31
|
opt :recipe_name, "Recipe name", :type => :string, :required => true
|
32
32
|
end
|
33
33
|
app.execute_recipes([command_opts[:recipe_name]])
|
34
|
+
when "restart"
|
35
|
+
app.restart()
|
34
36
|
else
|
35
37
|
Trollop::die("Unknown command #{command}")
|
36
38
|
end
|
data/lib/ops_worker/version.rb
CHANGED