opsworks-cli 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opsworks/cli/agent.rb +2 -0
- data/lib/opsworks/cli/subcommands/upgrade_chef.rb +35 -0
- data/lib/opsworks/cli/version.rb +1 -1
- data/lib/opsworks/stack.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcc4c1284a99afeda1c929e55f80643e5a2aad36
|
4
|
+
data.tar.gz: 028437c8044bb146a5ecbfe8febbd125682cdc82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16b3ff5a4ceb89c025944ec12ad119e6303bdd763d8a3634ed9d1aca51ff259382f1e61aa062eeba70f01f82c5bec6dcfd2f819a144b1f57646ef9edc032db7f
|
7
|
+
data.tar.gz: cb5f4440c3428f3773747386fdbed8ca4049a38816e895ac0d78816542299f2ea711441f9f3f4fd798065d72eede476ffbb9045859bf573914fad1cb4f80b387
|
data/lib/opsworks/cli/agent.rb
CHANGED
@@ -10,6 +10,7 @@ require_relative 'subcommands/deploy'
|
|
10
10
|
require_relative 'subcommands/status'
|
11
11
|
require_relative 'subcommands/allow'
|
12
12
|
require_relative 'subcommands/lockdown'
|
13
|
+
require_relative 'subcommands/upgrade_chef'
|
13
14
|
|
14
15
|
module OpsWorks
|
15
16
|
module CLI
|
@@ -22,6 +23,7 @@ module OpsWorks
|
|
22
23
|
include Subcommands::Status
|
23
24
|
include Subcommands::Allow
|
24
25
|
include Subcommands::Lockdown
|
26
|
+
include Subcommands::UpgradeChef
|
25
27
|
|
26
28
|
desc 'version', 'Print OpsWorks CLI version'
|
27
29
|
def version
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'aws'
|
2
|
+
require 'opsworks/deployment'
|
3
|
+
|
4
|
+
module OpsWorks
|
5
|
+
module CLI
|
6
|
+
module Subcommands
|
7
|
+
module UpgradeChef
|
8
|
+
# rubocop:disable MethodLength
|
9
|
+
# rubocop:disable CyclomaticComplexity
|
10
|
+
def self.included(thor)
|
11
|
+
thor.class_eval do
|
12
|
+
include Helpers::Keychain
|
13
|
+
include Helpers::Options
|
14
|
+
|
15
|
+
desc 'upgrade-chef [--stack STACK]', 'Upgrade Chef version'
|
16
|
+
option :stack, type: :array
|
17
|
+
option :version
|
18
|
+
option :manage_berkshelf, type: :boolean, default: false
|
19
|
+
def upgrade_chef
|
20
|
+
fetch_keychain_credentials unless env_credentials?
|
21
|
+
stacks = parse_stacks(options.merge(active: true))
|
22
|
+
version = OpsWorks::Stack.latest_chef_version
|
23
|
+
stacks.each do |stack|
|
24
|
+
say "Upgrading #{stack.name} to #{version}..."
|
25
|
+
stack.upgrade_chef(version, options)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
# rubocop:enable CyclomaticComplexity
|
31
|
+
# rubocop:enable MethodLength
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/opsworks/cli/version.rb
CHANGED
data/lib/opsworks/stack.rb
CHANGED
@@ -7,6 +7,8 @@ module OpsWorks
|
|
7
7
|
class Stack < Resource
|
8
8
|
attr_accessor :id, :name
|
9
9
|
|
10
|
+
AVAILABLE_CHEF_VERSIONS = %w(0.9 11.4 11.10)
|
11
|
+
|
10
12
|
def self.all
|
11
13
|
client.describe_stacks.data[:stacks].map do |hash|
|
12
14
|
new(id: hash[:stack_id], name: hash[:name])
|
@@ -21,6 +23,10 @@ module OpsWorks
|
|
21
23
|
all.find { |stack| stack.name == name }
|
22
24
|
end
|
23
25
|
|
26
|
+
def self.latest_chef_version
|
27
|
+
AVAILABLE_CHEF_VERSIONS.last
|
28
|
+
end
|
29
|
+
|
24
30
|
def apps
|
25
31
|
@apps ||= initialize_apps
|
26
32
|
end
|
@@ -41,6 +47,14 @@ module OpsWorks
|
|
41
47
|
@instances ||= initialize_instances
|
42
48
|
end
|
43
49
|
|
50
|
+
def upgrade_chef(version, options = {})
|
51
|
+
self.class.client.update_stack(
|
52
|
+
stack_id: id,
|
53
|
+
configuration_manager: { name: 'Chef', version: version },
|
54
|
+
chef_configuration: { manage_berkshelf: options[:manage_berkshelf] }
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
44
58
|
def update_custom_cookbooks
|
45
59
|
create_deployment(command: { name: 'update_custom_cookbooks' })
|
46
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opsworks-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/opsworks/cli/subcommands/lockdown.rb
|
164
164
|
- lib/opsworks/cli/subcommands/status.rb
|
165
165
|
- lib/opsworks/cli/subcommands/update.rb
|
166
|
+
- lib/opsworks/cli/subcommands/upgrade_chef.rb
|
166
167
|
- lib/opsworks/cli/version.rb
|
167
168
|
- lib/opsworks/deployment.rb
|
168
169
|
- lib/opsworks/instance.rb
|