heirloom 0.12.3 → 0.12.4
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 +7 -1
- data/README.md +7 -3
- data/lib/heirloom/archive/downloader.rb +1 -1
- data/lib/heirloom/archive/lister.rb +1 -1
- data/lib/heirloom/aws/simpledb.rb +15 -2
- data/lib/heirloom/cli/authorize.rb +3 -4
- data/lib/heirloom/cli/catalog.rb +18 -8
- data/lib/heirloom/cli/cleanup.rb +8 -16
- data/lib/heirloom/cli/destroy.rb +2 -3
- data/lib/heirloom/cli/download.rb +3 -3
- data/lib/heirloom/cli/list.rb +4 -9
- data/lib/heirloom/cli/rotate.rb +2 -1
- data/lib/heirloom/cli/setup.rb +5 -7
- data/lib/heirloom/cli/shared.rb +5 -0
- data/lib/heirloom/cli/show.rb +7 -12
- data/lib/heirloom/cli/tag.rb +3 -4
- data/lib/heirloom/cli/teardown.rb +3 -2
- data/lib/heirloom/cli/upload.rb +2 -3
- data/lib/heirloom/config.rb +4 -4
- data/lib/heirloom/version.rb +1 -1
- data/spec/cli/catalog_spec.rb +1 -0
- data/spec/cli/list_spec.rb +0 -14
- data/spec/cli/show_spec.rb +0 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 387329119518755b3986e46b25f5bf67213cbff2
|
4
|
+
data.tar.gz: ebfd043ec1a6bb70acbb49cf76532b4dbb2ca8e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37e92d8b09bef36e6cf1acf078383e62d6c2cd7812e5a18a3d3a9751a36b57d18076ce089dc08cb9271bcbc6b46e74f94c50e55c0fb14adae04929588dc2697
|
7
|
+
data.tar.gz: 0e2084f9ed3d225aae3989bac5bc6b181454a806a18a96fd68fa1d3d427070ad71cad3164cb5590c63cfe5a6e17551f691a8b9d507bfdf9e9f45d4e1fc663a4c
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
##
|
1
|
+
## 0.12.4: (04/02/2014):
|
2
|
+
|
3
|
+
* Bug fix in setup to properly read metadata region from config
|
4
|
+
* Update to CLI environment message
|
5
|
+
* Added SimpleDB debug query logging
|
6
|
+
* Bug fix in catalog to return proper errors when catalog not found
|
7
|
+
* Removed unused JSON output from CLI
|
2
8
|
|
3
9
|
## 0.12.3 (03/26/2014):
|
4
10
|
|
data/README.md
CHANGED
@@ -32,8 +32,8 @@ default:
|
|
32
32
|
secret_key: UPDATE_ME
|
33
33
|
metadata_region: us-west-1
|
34
34
|
|
35
|
-
# multiple environments can be defined and
|
36
|
-
#
|
35
|
+
# multiple environments can be defined in heirloom.yml and selected
|
36
|
+
# via the cli with the -e or --environment option
|
37
37
|
|
38
38
|
prod:
|
39
39
|
access_key: UPDATE_ME
|
@@ -46,7 +46,11 @@ preprod:
|
|
46
46
|
metadata_region: us-west-1
|
47
47
|
```
|
48
48
|
|
49
|
-
|
49
|
+
By default, heirloom will load **.heirloom.yml** from your home directory.
|
50
|
+
|
51
|
+
You can specify an alternate config file by setting the HEIRLOOM_CONFIG_FILE
|
52
|
+
environment variable
|
53
|
+
|
50
54
|
```
|
51
55
|
export HEIRLOOM_CONFIG_FILE="~/special_config.yml"
|
52
56
|
```
|
@@ -6,6 +6,7 @@ module Heirloom
|
|
6
6
|
|
7
7
|
def initialize(args)
|
8
8
|
@config = args[:config]
|
9
|
+
@logger = @config.logger
|
9
10
|
|
10
11
|
fog_args = { :region => @config.metadata_region }
|
11
12
|
|
@@ -44,26 +45,34 @@ module Heirloom
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def select(query, opts = {})
|
47
|
-
has_more
|
48
|
+
has_more = true
|
48
49
|
next_token = nil
|
49
|
-
results
|
50
|
+
results = {}
|
51
|
+
|
52
|
+
logger.debug "Executing simpledb query '#{query}'."
|
50
53
|
|
51
54
|
if opts[:offset] && opts[:offset] > 0
|
52
55
|
limit = @sdb.select("#{query} limit #{opts[:offset]}").body
|
53
56
|
if limit['NextToken']
|
57
|
+
logger.debug "Next token found. Retrieving results."
|
54
58
|
next_token = limit['NextToken']
|
55
59
|
else
|
60
|
+
logger.debug "No more results. Query complete."
|
56
61
|
has_more = false
|
57
62
|
end
|
58
63
|
end
|
64
|
+
|
59
65
|
while has_more
|
66
|
+
logger.debug "Retrieving results from next token '#{next_token}'." if next_token
|
60
67
|
more = @sdb.select(query, 'NextToken' => next_token).body
|
61
68
|
more['Items'].each do |k, v|
|
62
69
|
block_given? ? yield(k, v) : results[k] = v
|
63
70
|
end
|
64
71
|
if more['NextToken']
|
72
|
+
logger.debug "Next token found. Retrieving results."
|
65
73
|
next_token = more['NextToken']
|
66
74
|
else
|
75
|
+
logger.debug "No more results. Query complete."
|
67
76
|
has_more = false
|
68
77
|
end
|
69
78
|
end
|
@@ -84,6 +93,10 @@ module Heirloom
|
|
84
93
|
@sdb.select(query).body['Items']['Domain']['Count'].first.to_i
|
85
94
|
end
|
86
95
|
|
96
|
+
def logger
|
97
|
+
@logger
|
98
|
+
end
|
99
|
+
|
87
100
|
end
|
88
101
|
end
|
89
102
|
|
@@ -17,9 +17,8 @@ module Heirloom
|
|
17
17
|
ensure_valid_options :provided => @opts,
|
18
18
|
:required => [:accounts, :name, :id],
|
19
19
|
:config => @config
|
20
|
-
|
21
|
-
|
22
|
-
ensure_domain_exists :name => @opts[:name],
|
20
|
+
ensure_valid_metadata_region @config
|
21
|
+
ensure_domain_exists :name => @opts[:name],
|
23
22
|
:config => @config
|
24
23
|
@archive = Archive.new :name => @opts[:name],
|
25
24
|
:id => @opts[:id],
|
@@ -64,7 +63,7 @@ EOS
|
|
64
63
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
65
64
|
:short => :none
|
66
65
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
67
|
-
opt :environment, "Environment (defined in
|
66
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
data/lib/heirloom/cli/catalog.rb
CHANGED
@@ -20,13 +20,17 @@ module Heirloom
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def all
|
23
|
-
|
23
|
+
regions = detected_regions
|
24
|
+
@logger.info "Querying regions #{regions.join(', ')} for Heirloom catalogs."
|
25
|
+
regions.each do |region|
|
24
26
|
@config.metadata_region = region
|
25
27
|
|
26
|
-
|
27
|
-
:config => @config
|
28
|
+
ensure_valid_metadata_region @config
|
28
29
|
|
29
|
-
|
30
|
+
unless catalog_domain_exists?
|
31
|
+
@logger.info "No heirloom catalog in '#{region}'."
|
32
|
+
next
|
33
|
+
end
|
30
34
|
|
31
35
|
@catalog_list = Hash[@catalog.all]
|
32
36
|
|
@@ -37,15 +41,21 @@ module Heirloom
|
|
37
41
|
end
|
38
42
|
|
39
43
|
if heirloom_exists_in_catalog? @opts[:name]
|
40
|
-
@logger.
|
44
|
+
@logger.info "Heirloom \'#{@opts[:name]}\' found in catalog for #{region}."
|
41
45
|
heirloom_details region, @opts[:name]
|
42
46
|
@heirloom_found = true
|
43
47
|
else
|
44
|
-
@logger.
|
48
|
+
@logger.info "Heirloom \'#{@opts[:name]}\' not found in catalog for #{region}."
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
48
|
-
|
52
|
+
unless @heirloom_found
|
53
|
+
if @opts[:name]
|
54
|
+
@logger.info "Heirloom \'#{@opts[:name]}\' not found in any regions."
|
55
|
+
else
|
56
|
+
@logger.info "Heirloom catalog not found in any regions."
|
57
|
+
end
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
private
|
@@ -107,7 +117,7 @@ heirloom catalog
|
|
107
117
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
108
118
|
:short => :none
|
109
119
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
110
|
-
opt :environment, "Environment (defined in
|
120
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
111
121
|
end
|
112
122
|
end
|
113
123
|
|
data/lib/heirloom/cli/cleanup.rb
CHANGED
@@ -14,24 +14,16 @@ module Heirloom
|
|
14
14
|
|
15
15
|
Heirloom.log.level = @opts[:log_level]
|
16
16
|
|
17
|
-
ensure_valid_options
|
18
|
-
|
19
|
-
|
20
|
-
:config => @config
|
21
|
-
)
|
17
|
+
ensure_valid_options :provided => @opts,
|
18
|
+
:required => [:name],
|
19
|
+
:config => @config
|
22
20
|
|
23
|
-
|
24
|
-
:region => @opts[:metadata_region],
|
25
|
-
:config => @config
|
26
|
-
)
|
27
|
-
|
28
|
-
ensure_domain_exists(
|
29
|
-
:name => @opts[:name],
|
30
|
-
:config => @config
|
31
|
-
)
|
21
|
+
ensure_valid_metadata_region @config
|
32
22
|
|
23
|
+
ensure_domain_exists :name => @opts[:name],
|
24
|
+
:config => @config
|
33
25
|
end
|
34
|
-
|
26
|
+
|
35
27
|
def cleanup
|
36
28
|
cat = Heirloom::Catalog.new :name => @opts[:name], :config => @config
|
37
29
|
cat.cleanup :num_to_keep => @opts[:keep]
|
@@ -65,7 +57,7 @@ EOS
|
|
65
57
|
:short => :none
|
66
58
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
67
59
|
:short => :none
|
68
|
-
opt :environment, "Environment (defined in
|
60
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
69
61
|
end
|
70
62
|
end
|
71
63
|
end
|
data/lib/heirloom/cli/destroy.rb
CHANGED
@@ -17,8 +17,7 @@ module Heirloom
|
|
17
17
|
ensure_valid_options :provided => @opts,
|
18
18
|
:required => [:name, :id],
|
19
19
|
:config => @config
|
20
|
-
|
21
|
-
:config => @config
|
20
|
+
ensure_valid_metadata_region @config
|
22
21
|
ensure_domain_exists :name => @opts[:name], :config => @config
|
23
22
|
|
24
23
|
@name = @opts[:name]
|
@@ -59,7 +58,7 @@ EOS
|
|
59
58
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
60
59
|
:short => :none
|
61
60
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
62
|
-
opt :environment, "Environment (defined in
|
61
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
@@ -22,7 +22,7 @@ module Heirloom
|
|
22
22
|
:config => @config
|
23
23
|
|
24
24
|
# Can't use fetch as Trollop sets :id to nil
|
25
|
-
id = @opts[:id] ||( latest_id :name => @opts[:name],
|
25
|
+
id = @opts[:id] ||( latest_id :name => @opts[:name],
|
26
26
|
:config => @config)
|
27
27
|
|
28
28
|
@archive = Archive.new :name => @opts[:name],
|
@@ -39,7 +39,7 @@ module Heirloom
|
|
39
39
|
@region = @opts[:region] || @catalog.regions.first
|
40
40
|
@bucket_prefix = @opts[:bucket_prefix] || @catalog.bucket_prefix
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def download
|
44
44
|
ensure_path_is_directory :path => @opts[:output], :config => @config
|
45
45
|
ensure_directory_is_writable :path => @opts[:output], :config => @config
|
@@ -90,7 +90,7 @@ EOS
|
|
90
90
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
91
91
|
:short => :none
|
92
92
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
93
|
-
opt :environment, "Environment (defined in
|
93
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
data/lib/heirloom/cli/list.rb
CHANGED
@@ -17,22 +17,17 @@ module Heirloom
|
|
17
17
|
ensure_valid_options :provided => @opts,
|
18
18
|
:required => [:name],
|
19
19
|
:config => @config
|
20
|
-
|
21
|
-
:config => @config
|
20
|
+
ensure_valid_metadata_region @config
|
22
21
|
ensure_domain_exists :name => @opts[:name], :config => @config
|
23
22
|
|
24
23
|
@archive = Archive.new :name => @opts[:name],
|
25
24
|
:config => @config
|
26
25
|
end
|
27
|
-
|
26
|
+
|
28
27
|
def list(count = @opts[:count])
|
29
28
|
@logger.debug "#{@archive.count} IDs found."
|
30
29
|
list = @archive.list count
|
31
|
-
|
32
|
-
jj list
|
33
|
-
else
|
34
|
-
puts list.join "\n"
|
35
|
-
end
|
30
|
+
puts list.join "\n"
|
36
31
|
end
|
37
32
|
|
38
33
|
private
|
@@ -61,7 +56,7 @@ EOS
|
|
61
56
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
62
57
|
:short => :none
|
63
58
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
64
|
-
opt :environment, "Environment (defined in
|
59
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
65
60
|
end
|
66
61
|
end
|
67
62
|
|
data/lib/heirloom/cli/rotate.rb
CHANGED
@@ -35,7 +35,7 @@ module Heirloom
|
|
35
35
|
@opts[:region] ||= @catalog.regions.first
|
36
36
|
@opts[:bucket_prefix] ||= @catalog.bucket_prefix
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def rotate
|
40
40
|
@archive.rotate @opts
|
41
41
|
rescue Heirloom::Exceptions::RotateFailed => e
|
@@ -78,6 +78,7 @@ EOS
|
|
78
78
|
:short => :none
|
79
79
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
80
80
|
:short => :none
|
81
|
+
opt :environment, "Environment (defined in heirloom config)", :type => :string
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
data/lib/heirloom/cli/setup.rb
CHANGED
@@ -14,9 +14,8 @@ module Heirloom
|
|
14
14
|
@config = load_config :logger => @logger,
|
15
15
|
:opts => @opts
|
16
16
|
|
17
|
-
ensure_valid_options :provided => @opts,
|
18
|
-
:required => [:
|
19
|
-
:bucket_prefix,
|
17
|
+
ensure_valid_options :provided => @opts,
|
18
|
+
:required => [:bucket_prefix,
|
20
19
|
:region, :name],
|
21
20
|
:config => @config
|
22
21
|
|
@@ -27,13 +26,12 @@ module Heirloom
|
|
27
26
|
end
|
28
27
|
|
29
28
|
def setup
|
30
|
-
|
31
|
-
:config => @config
|
29
|
+
ensure_valid_metadata_region @config
|
32
30
|
|
33
31
|
ensure_valid_regions :regions => @opts[:region],
|
34
32
|
:config => @config
|
35
33
|
|
36
|
-
ensure_metadata_in_upload_region :config => @config,
|
34
|
+
ensure_metadata_in_upload_region :config => @config,
|
37
35
|
:regions => @opts[:region]
|
38
36
|
|
39
37
|
ensure_valid_name :config => @config,
|
@@ -92,7 +90,7 @@ Can be specified multiple times.", :type => :string,
|
|
92
90
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
93
91
|
:short => :none
|
94
92
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
95
|
-
opt :environment, "Environment (defined in
|
93
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
data/lib/heirloom/cli/shared.rb
CHANGED
@@ -76,6 +76,11 @@ module Heirloom
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
+
def ensure_valid_metadata_region(config)
|
80
|
+
ensure_valid_region :region => config.metadata_region,
|
81
|
+
:config => config
|
82
|
+
end
|
83
|
+
|
79
84
|
def ensure_metadata_in_upload_region(args)
|
80
85
|
config = args[:config]
|
81
86
|
regions = args[:regions]
|
data/lib/heirloom/cli/show.rb
CHANGED
@@ -17,9 +17,8 @@ module Heirloom
|
|
17
17
|
ensure_valid_options :provided => @opts,
|
18
18
|
:required => [:name],
|
19
19
|
:config => @config
|
20
|
-
|
21
|
-
|
22
|
-
ensure_domain_exists :name => @opts[:name],
|
20
|
+
ensure_valid_metadata_region @config
|
21
|
+
ensure_domain_exists :name => @opts[:name],
|
23
22
|
:config => @config
|
24
23
|
|
25
24
|
# Can't use fetch as Trollop sets :id to nil
|
@@ -32,16 +31,12 @@ module Heirloom
|
|
32
31
|
ensure_archive_exists :archive => @archive,
|
33
32
|
:config => @config
|
34
33
|
end
|
35
|
-
|
34
|
+
|
36
35
|
def show
|
37
36
|
data = @archive.show
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
formatter = Heirloom::CLI::Formatter::Show.new
|
42
|
-
puts formatter.format :attributes => data,
|
43
|
-
:all => @opts[:all]
|
44
|
-
end
|
37
|
+
formatter = Heirloom::CLI::Formatter::Show.new
|
38
|
+
puts formatter.format :attributes => data,
|
39
|
+
:all => @opts[:all]
|
45
40
|
end
|
46
41
|
|
47
42
|
private
|
@@ -72,7 +67,7 @@ EOS
|
|
72
67
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
73
68
|
:short => :none
|
74
69
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
75
|
-
opt :environment, "Environment (defined in
|
70
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
76
71
|
end
|
77
72
|
end
|
78
73
|
|
data/lib/heirloom/cli/tag.rb
CHANGED
@@ -17,8 +17,7 @@ module Heirloom
|
|
17
17
|
ensure_valid_options :provided => @opts,
|
18
18
|
:required => [:name, :id, :attribute, :value],
|
19
19
|
:config => @config
|
20
|
-
|
21
|
-
:config => @config
|
20
|
+
ensure_valid_metadata_region @config
|
22
21
|
ensure_domain_exists :name => @opts[:name], :config => @config
|
23
22
|
|
24
23
|
@archive = Archive.new :name => @opts[:name],
|
@@ -27,7 +26,7 @@ module Heirloom
|
|
27
26
|
ensure_archive_exists :archive => @archive,
|
28
27
|
:config => @config
|
29
28
|
end
|
30
|
-
|
29
|
+
|
31
30
|
def tag
|
32
31
|
unless @archive.exists?
|
33
32
|
@logger.error "Archive does not exist"
|
@@ -65,7 +64,7 @@ EOS
|
|
65
64
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
66
65
|
:short => :none
|
67
66
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
68
|
-
opt :environment, "Environment (defined in
|
67
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
69
68
|
end
|
70
69
|
end
|
71
70
|
end
|
@@ -14,7 +14,8 @@ module Heirloom
|
|
14
14
|
@config = load_config :logger => @logger,
|
15
15
|
:opts => @opts
|
16
16
|
|
17
|
-
|
17
|
+
ensure_valid_metadata_region @config
|
18
|
+
ensure_valid_options :provided => @opts,
|
18
19
|
:required => [:name],
|
19
20
|
:config => @config
|
20
21
|
|
@@ -82,7 +83,7 @@ EOS
|
|
82
83
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
83
84
|
:short => :none
|
84
85
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
85
|
-
opt :environment, "Environment (defined in
|
86
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
data/lib/heirloom/cli/upload.rb
CHANGED
@@ -33,8 +33,7 @@ module Heirloom
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def upload
|
36
|
-
|
37
|
-
:config => @config
|
36
|
+
ensure_valid_metadata_region @config
|
38
37
|
ensure_domain_exists :name => @opts[:name],
|
39
38
|
:config => @config
|
40
39
|
ensure_buckets_exist :bucket_prefix => @bucket_prefix,
|
@@ -104,7 +103,7 @@ Can be specified multiple times.", :type => :string, :multi => true, :short =>
|
|
104
103
|
opt :aws_secret_key, "AWS Secret Access Key", :type => :string,
|
105
104
|
:short => :none
|
106
105
|
opt :use_iam_profile, "Use IAM EC2 Profile", :short => :none
|
107
|
-
opt :environment, "Environment (defined in
|
106
|
+
opt :environment, "Environment (defined in heirloom config file)", :type => :string
|
108
107
|
end
|
109
108
|
end
|
110
109
|
|
data/lib/heirloom/config.rb
CHANGED
@@ -12,11 +12,11 @@ module Heirloom
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def load_config
|
15
|
-
@access_key = @opts.fetch :aws_access_key,
|
15
|
+
@access_key = @opts.fetch :aws_access_key,
|
16
16
|
@config['access_key']
|
17
|
-
@secret_key = @opts.fetch :aws_secret_key,
|
17
|
+
@secret_key = @opts.fetch :aws_secret_key,
|
18
18
|
@config['secret_key']
|
19
|
-
@metadata_region = @opts.fetch :metadata_region,
|
19
|
+
@metadata_region = @opts.fetch :metadata_region,
|
20
20
|
@config['metadata_region']
|
21
21
|
@use_iam_profile = @opts.fetch :use_iam_profile,
|
22
22
|
false
|
@@ -31,7 +31,7 @@ module Heirloom
|
|
31
31
|
def load_config_file
|
32
32
|
if File.exists? config_file
|
33
33
|
data = YAML::load File.open(config_file)
|
34
|
-
if data.has_key?
|
34
|
+
if data && data.has_key?(@environment)
|
35
35
|
return data[@environment]
|
36
36
|
else
|
37
37
|
@logger.warn "Environment '#{@environment}' not found in config file."
|
data/lib/heirloom/version.rb
CHANGED
data/spec/cli/catalog_spec.rb
CHANGED
@@ -11,6 +11,7 @@ describe Heirloom do
|
|
11
11
|
{ 'regions' => ['us-west-1'],
|
12
12
|
'bucket_prefix' => ['bp'] } }
|
13
13
|
@logger_double = double :debug => true
|
14
|
+
@logger_double.stub :info => true
|
14
15
|
@config_double = double_config :logger => @logger_double
|
15
16
|
@catalog_double = double 'catalog'
|
16
17
|
@catalog_double.stub :catalog_domain_exists? => true
|
data/spec/cli/list_spec.rb
CHANGED
@@ -29,20 +29,6 @@ describe Heirloom do
|
|
29
29
|
@archive_double.should_receive(:count)
|
30
30
|
end
|
31
31
|
|
32
|
-
context "as json" do
|
33
|
-
before do
|
34
|
-
@options[:json] = true
|
35
|
-
Trollop.stub :options => @options
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should list ids for given archive" do
|
39
|
-
@cli_list = Heirloom::CLI::List.new
|
40
|
-
@archive_double.should_receive(:list).with(100).and_return(['1','2'])
|
41
|
-
@cli_list.should_receive(:jj).with ['1','2']
|
42
|
-
@cli_list.list
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
32
|
context "as human readable" do
|
47
33
|
before do
|
48
34
|
@options[:json] = nil
|
data/spec/cli/show_spec.rb
CHANGED
@@ -36,20 +36,6 @@ describe Heirloom do
|
|
36
36
|
@attributes = { 'id' => '1.0.0' }
|
37
37
|
end
|
38
38
|
|
39
|
-
context "as json" do
|
40
|
-
before do
|
41
|
-
@options[:json] = true
|
42
|
-
Trollop.stub(:options).and_return @options
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should show a given id as json" do
|
46
|
-
@cli_show = Heirloom::CLI::Show.new
|
47
|
-
@archive_double.stub :show => @attributes
|
48
|
-
@cli_show.should_receive(:jj).with @attributes
|
49
|
-
@cli_show.show
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
39
|
context "as human readable" do
|
54
40
|
before do
|
55
41
|
@options[:json] = false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heirloom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Weaver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|