cap-ec2 1.1.1 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5de758bdde1c4ff1f1b7976e3e9c831b399ff31
4
- data.tar.gz: 17a252437d8183443a230c7ff64a0e83bdda0823
3
+ metadata.gz: ef4ca63866b4eff00801d44dda99ea21e280a804
4
+ data.tar.gz: d2674ee27e54da4e47ff65e42afd0ee8cbe82150
5
5
  SHA512:
6
- metadata.gz: d11cf987ba64b1eb66ca0cec01f70fe1141bbdc60ffcb836ec5774644cc30e2e72b06d24eb22fe1085253579ce0417f3bace43e59a64a14d96a2f1173405285c
7
- data.tar.gz: 7376b1916b7a6e1a7a912c9a5788b8d305d53b3a5d0a506cab550704c637043090378c6171131e7da21c6b8c1680e1eb0cf1e40dc3d5f6025d244637e542f0f2
6
+ metadata.gz: 6b0f97b3297038ce7175f323e9f5a320143b499ff142b6b115dce29a32743a34e768a4030702d01fe42e26d8246973465b3f26562574210f98b97c050ce6e888
7
+ data.tar.gz: 9bf1860538d00091cb419fae33d5eafe5b8894be95fd88591aedd0754014f6b9676bc707a6f3c157776acb0b0ee2cae7bfa772a3d6dab5ece24e343bb9476efd
@@ -1,5 +1,11 @@
1
1
  # Cap-EC2 changelog
2
2
 
3
+ ## 1.1.2
4
+
5
+ * Allow using aws-sdk v3 [@magnusvk](https://github.com/magnusvk)
6
+ * Fix NoMethodError undefined method call for Hash [@ur5us](https://github.com/ur5us)
7
+ * Allow tag value delimiter to be configurable [@erez-rabih](https://github.com/erez-rabih)
8
+
3
9
  ## 1.1.1
4
10
 
5
11
  Require aws-sdk v2 instead of v1
data/README.md CHANGED
@@ -47,7 +47,9 @@ set :ec2_config, 'config/ec2.yml'
47
47
  set :ec2_project_tag, 'Project'
48
48
  set :ec2_roles_tag, 'Roles'
49
49
  set :ec2_stages_tag, 'Stages'
50
+ set :ec2_tag_delimiter, ","
50
51
 
52
+ set :ec2_profile, 'myservice' # use ~/.aws/credentials with profile_name
51
53
  set :ec2_access_key_id, nil
52
54
  set :ec2_secret_access_key, nil
53
55
  set :ec2_region, %w{} # REQUIRED
@@ -59,7 +61,7 @@ set :ec2_filter_by_status_ok?, nil
59
61
  #### Order of inheritance
60
62
 
61
63
  `cap-ec2` supports multiple methods of configuration. The order of inheritance is:
62
- YAML File > User Capistrano Config > Default Capistrano Config > ENV variables.
64
+ YAML File > ~/.aws/credentials > User Capistrano Config > Default Capistrano Config > ENV variables.
63
65
 
64
66
  #### Regions
65
67
 
@@ -92,6 +94,12 @@ credentials) will be honored.
92
94
  Cap-EC2 will look for a tag with this name to determine which instances belong to
93
95
  a given role. The tag name defaults to "Roles".
94
96
 
97
+ * tag_delimiter
98
+
99
+ When Cap-EC2 reads a tag value, this will be the default delimiter.
100
+ For example, for a Roles tag with web,db and tag_delimiter set to ,(comma)
101
+ the server will have the web and db roles.
102
+
95
103
  * filter_by_status_ok?
96
104
 
97
105
  If this is set to `true`, then Cap-EC2 will not return instances which do not have both EC2 status
@@ -6,8 +6,8 @@ require 'cap-ec2/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "cap-ec2"
8
8
  spec.version = CapEC2::VERSION
9
- spec.authors = ["Andy Sykes", "Robert Coleman"]
10
- spec.email = ["github@tinycat.co.uk", "github@robert.net.nz"]
9
+ spec.authors = ["Andy Sykes", "Robert Coleman", "Forward3D Developers"]
10
+ spec.email = ["github@tinycat.co.uk", "github@robert.net.nz", "developers@forward3d.com"]
11
11
  spec.description = %q{Cap-EC2 is used to generate Capistrano namespaces and tasks from Amazon EC2 instance tags, dynamically building the list of servers to be deployed to.}
12
12
  spec.summary = %q{Cap-EC2 is used to generate Capistrano namespaces and tasks from Amazon EC2 instance tags, dynamically building the list of servers to be deployed to.}
13
13
  spec.homepage = "https://github.com/forward3d/cap-ec2"
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_dependency "aws-sdk", "~> 2.0"
24
+ spec.add_dependency "aws-sdk", ">= 2.0"
25
25
  spec.add_dependency "capistrano", ">= 3.0"
26
26
  spec.add_dependency "terminal-table"
27
27
  spec.add_dependency "colorize"
@@ -90,7 +90,7 @@ module CapEC2
90
90
  private
91
91
 
92
92
  def instance_has_tag?(instance, key, value)
93
- (tag_value(instance, key) || '').split(',').map(&:strip).include?(value.to_s)
93
+ (tag_value(instance, key) || '').split(tag_delimiter).map(&:strip).include?(value.to_s)
94
94
  end
95
95
 
96
96
  def instance_status_ok?(instance)
@@ -26,6 +26,7 @@ namespace :load do
26
26
  set :ec2_project_tag, 'Project'
27
27
  set :ec2_roles_tag, 'Roles'
28
28
  set :ec2_stages_tag, 'Stages'
29
+ set :ec2_tag_delimiter, ","
29
30
 
30
31
  set :ec2_access_key_id, nil
31
32
  set :ec2_secret_access_key, nil
@@ -1,3 +1,5 @@
1
+ require 'aws-sdk'
2
+
1
3
  module CapEC2
2
4
  module Utils
3
5
 
@@ -20,8 +22,12 @@ module CapEC2
20
22
  fetch(:ec2_stages_tag)
21
23
  end
22
24
 
25
+ def tag_delimiter
26
+ fetch(:ec2_tag_delimiter)
27
+ end
28
+
23
29
  def tag_value(instance, key)
24
- instance.tags.find({}) { |t| t[:key] == key.to_s }[:value]
30
+ instance.tags.find(-> { {} }) { |t| t[:key] == key.to_s }[:value]
25
31
  end
26
32
 
27
33
  def self.contact_point_mapping
@@ -40,13 +46,22 @@ module CapEC2
40
46
  end
41
47
 
42
48
  def load_config
49
+ if fetch(:ec2_profile)
50
+ credentials = Aws::SharedCredentials.new(profile_name: fetch(:ec2_profile)).credentials
51
+ if credentials
52
+ set :ec2_access_key_id, credentials.access_key_id
53
+ set :ec2_secret_access_key, credentials.secret_access_key
54
+ end
55
+ end
56
+
43
57
  config_location = File.expand_path(fetch(:ec2_config), Dir.pwd) if fetch(:ec2_config)
44
58
  if config_location && File.exists?(config_location)
45
- config = YAML.load_file fetch(:ec2_config)
59
+ config = YAML.load(ERB.new(File.read(fetch(:ec2_config))))
46
60
  if config
47
61
  set :ec2_project_tag, config['project_tag'] if config['project_tag']
48
62
  set :ec2_roles_tag, config['roles_tag'] if config['roles_tag']
49
63
  set :ec2_stages_tag, config['stages_tag'] if config['stages_tag']
64
+ set :ec2_tag_delimiter, config['tag_delimiter'] if config['tag_delimiter']
50
65
 
51
66
  set :ec2_access_key_id, config['access_key_id'] if config['access_key_id']
52
67
  set :ec2_secret_access_key, config['secret_access_key'] if config['secret_access_key']
@@ -1,3 +1,3 @@
1
1
  module CapEC2
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Sykes
8
8
  - Robert Coleman
9
+ - Forward3D Developers
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -43,14 +44,14 @@ dependencies:
43
44
  name: aws-sdk
44
45
  requirement: !ruby/object:Gem::Requirement
45
46
  requirements:
46
- - - "~>"
47
+ - - ">="
47
48
  - !ruby/object:Gem::Version
48
49
  version: '2.0'
49
50
  type: :runtime
50
51
  prerelease: false
51
52
  version_requirements: !ruby/object:Gem::Requirement
52
53
  requirements:
53
- - - "~>"
54
+ - - ">="
54
55
  - !ruby/object:Gem::Version
55
56
  version: '2.0'
56
57
  - !ruby/object:Gem::Dependency
@@ -100,6 +101,7 @@ description: Cap-EC2 is used to generate Capistrano namespaces and tasks from Am
100
101
  email:
101
102
  - github@tinycat.co.uk
102
103
  - github@robert.net.nz
104
+ - developers@forward3d.com
103
105
  executables: []
104
106
  extensions: []
105
107
  extra_rdoc_files: []