ec2-host 0.0.2 → 0.0.3
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +5 -3
- data/ec2-host.gemspec +1 -1
- data/lib/ec2/host.rb +0 -3
- data/lib/ec2/host/cli.rb +3 -3
- data/lib/ec2/host/config.rb +8 -0
- data/lib/ec2/host/host_data.rb +1 -1
- data/lib/ec2/host/role_data.rb +2 -2
- data/sample.conf +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1eb20245f5a476fec6d84ce21697235b24ad6d2
|
4
|
+
data.tar.gz: 5de04a845db6fe32b690f31fe0c82ab70d8f1d68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 745211b9aff4c00cd9c561f788b8eaa0c1764010ab161854750ef21aa1e822e8445c08bf47921bcd9ee198a6a60919ddfd371828b553960a78ca5432ffda5f2e
|
7
|
+
data.tar.gz: 2b8e7c3a2fb51bf199da07c710b9ccb1bf4ef43cf29ac7a0010723c6566e9cdb081f91d4330e188eb4ba8361fb08023ca9c4d2834cd8896abef207989e263ffe
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -24,11 +24,13 @@ ec2-host parameters:
|
|
24
24
|
|
25
25
|
* **HOSTNAME_TAG**: EC2 tag key used to express a hostname. The default is `Name`.
|
26
26
|
* **ROLES_TAG**: EC2 tag keys used to express roles. The default is `Roles`
|
27
|
-
* You can assign multiple roles seperated by `,`
|
28
|
-
* Also, you can express levels of roles delimited by
|
27
|
+
* You can assign multiple roles seperated by `ARRAY_TAG_DELIMITER` (default: `,`)
|
28
|
+
* Also, you can express levels of roles delimited by `ROLE_TAG_DELIMITER` (default `:`)
|
29
29
|
* Example: admin:ami, then `EC2::Host.new(role: 'admin:ami')` and also `EC2::Host.new(role1: 'admin')` returns this host
|
30
|
+
* **ROLE_TAG_DELIMITER**: A delimiter to express levels of roles. Default is `:`
|
30
31
|
* **OPTIONAL_STRING_TAGS**: You may add optional non-array tags. You can specify multiple tags like `Service,Status`.
|
31
|
-
* **OPTIONAL_ARRAY_TAGS**: You may add optional array tags. Array tags allows multiple values delimited by
|
32
|
+
* **OPTIONAL_ARRAY_TAGS**: You may add optional array tags. Array tags allows multiple values delimited by `ARRAY_TAG_DELIMITER` (default: `,`)
|
33
|
+
* **ARRAY_TAG_DELIMITER**: A delimiter to express array. Default is `,`
|
32
34
|
* **LOG_LEVEL**: Log level such as `info`, `debug`, `error`. The default is `info`.
|
33
35
|
|
34
36
|
See [sampel.conf](./sample.conf)
|
data/ec2-host.gemspec
CHANGED
data/lib/ec2/host.rb
CHANGED
data/lib/ec2/host/cli.rb
CHANGED
@@ -18,15 +18,15 @@ class EC2
|
|
18
18
|
option :role1,
|
19
19
|
:aliases => %w[--r1 --usage1 --u1], # hmm, -r1 is not suppored by thor
|
20
20
|
:type => :array,
|
21
|
-
:desc => "role1, the 1st part of role delimited by #{
|
21
|
+
:desc => "role1, the 1st part of role delimited by #{Config.role_tag_delimiter}"
|
22
22
|
option :role2,
|
23
23
|
:aliases => %w[--r2 --usage2 --u2],
|
24
24
|
:type => :array,
|
25
|
-
:desc => "role2, the 2nd part of role delimited by #{
|
25
|
+
:desc => "role2, the 2nd part of role delimited by #{Config.role_tag_delimiter}"
|
26
26
|
option :role3,
|
27
27
|
:aliases => %w[--r3 --usage3 --u3],
|
28
28
|
:type => :array,
|
29
|
-
:desc => "role3, the 3rd part of role delimited by #{
|
29
|
+
:desc => "role3, the 3rd part of role delimited by #{Config.role_tag_delimiter}"
|
30
30
|
Config.optional_options.each do |opt, tag|
|
31
31
|
option opt, :type => :array, :desc => opt
|
32
32
|
end
|
data/lib/ec2/host/config.rb
CHANGED
@@ -69,6 +69,14 @@ class EC2
|
|
69
69
|
@optional_string_tags ||= (ENV['OPTIONAL_STRING_TAGS'] || config.fetch('OPTIONAL_STRING_TAGS', '')).split(',')
|
70
70
|
end
|
71
71
|
|
72
|
+
def self.role_tag_delimiter
|
73
|
+
@role_tag_delimiter ||= ENV['ROLE_TAG_DELIMITER'] || config.fetch('ROLE_TAG_DELIMITER', ':')
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.array_tag_delimiter
|
77
|
+
@array_tag_delimiter ||= ENV['ARRAY_TAG_DELIMITER'] || config.fetch('ARRAY_TAG_DELIMITER', ',')
|
78
|
+
end
|
79
|
+
|
72
80
|
# private
|
73
81
|
|
74
82
|
def self.aws_credentials
|
data/lib/ec2/host/host_data.rb
CHANGED
data/lib/ec2/host/role_data.rb
CHANGED
@@ -7,13 +7,13 @@ class EC2
|
|
7
7
|
# Represents each role
|
8
8
|
class RoleData
|
9
9
|
def self.initialize(role)
|
10
|
-
role1, role2, role3 = role.split(
|
10
|
+
role1, role2, role3 = role.split(Config.role_tag_delimiter)
|
11
11
|
self.new(role1, role2, role3)
|
12
12
|
end
|
13
13
|
|
14
14
|
# @return [String] something like "admin:jenkins:slave"
|
15
15
|
def role
|
16
|
-
@role ||= [role1, role2, role3].compact.reject(&:empty?).join(
|
16
|
+
@role ||= [role1, role2, role3].compact.reject(&:empty?).join(Config.role_tag_delimiter)
|
17
17
|
end
|
18
18
|
alias :to_s :role
|
19
19
|
|
data/sample.conf
CHANGED