bbc-cosmos-tools 0.7.0 → 0.8.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 204d2769528dc7478f8989d2a95838703b341c1e
|
|
4
|
+
data.tar.gz: edc6e26631b88bb768c7fb9e1bb317e8c7995748
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fff3c9de80096d918b73051529ced1a1bf116712b1130a5262ebbf440d3fa862beb99f7ff7dbeb449205259a58989b785b12322133139e0a758bda6bd1319063
|
|
7
|
+
data.tar.gz: b1dc7fc87cc39170975caef9cae71ed5bff5c3864d6e7833e0ca5cc31a705676c8da7a213442bae6c4686296d16d63a3e30c816ac8918df750d661155a334fdb
|
|
@@ -4,6 +4,21 @@ require "bbc/cosmos/tools/commands/base"
|
|
|
4
4
|
require "bbc/cosmos/tools/cosmos_configuration"
|
|
5
5
|
require "bbc/cosmos/tools/api"
|
|
6
6
|
|
|
7
|
+
class IncorrectUrlException < StandardError
|
|
8
|
+
def initialize(msg)
|
|
9
|
+
super
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class NullResponse
|
|
14
|
+
def success?
|
|
15
|
+
false
|
|
16
|
+
end
|
|
17
|
+
def body
|
|
18
|
+
JSON.generate({})
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
7
22
|
module BBC
|
|
8
23
|
module Cosmos
|
|
9
24
|
module Tools
|
|
@@ -84,7 +99,13 @@ module BBC
|
|
|
84
99
|
end
|
|
85
100
|
end
|
|
86
101
|
|
|
87
|
-
response =
|
|
102
|
+
response = begin
|
|
103
|
+
check_config
|
|
104
|
+
api.post sprintf(endpoint, options[:env], id), JSON.generate(post_data)
|
|
105
|
+
rescue IncorrectUrlException => e
|
|
106
|
+
say "\nWarning: #{e.message}\n", :red
|
|
107
|
+
NullResponse.new
|
|
108
|
+
end
|
|
88
109
|
|
|
89
110
|
if response.success?
|
|
90
111
|
|
|
@@ -92,7 +113,7 @@ module BBC
|
|
|
92
113
|
say get_key_value("Version", post_data["snapshot_id"] ? post_data["snapshot_id"] : post_data["release_version"])
|
|
93
114
|
|
|
94
115
|
data = JSON.parse(response.body)
|
|
95
|
-
say "\nDeployment started successfully: #{config.app['
|
|
116
|
+
say "\nDeployment started successfully: #{config.app['admin']}/cosmos#{data['url']}\n", :green
|
|
96
117
|
|
|
97
118
|
else
|
|
98
119
|
api_error response
|
|
@@ -155,6 +176,10 @@ module BBC
|
|
|
155
176
|
|
|
156
177
|
private
|
|
157
178
|
|
|
179
|
+
def check_config
|
|
180
|
+
raise IncorrectUrlException.new("Your configs/app.yaml is missing -> admin: 'https://admin.live.bbc.co.uk'") unless config.app.has_key? "admin"
|
|
181
|
+
end
|
|
182
|
+
|
|
158
183
|
def start_redeploy(component, id)
|
|
159
184
|
post_data = { "deployment_id" => id }
|
|
160
185
|
endpoint = "/cosmos/env/#{options[:env]}/component/#{component}/redeploy"
|
|
@@ -15,7 +15,9 @@ module BBC
|
|
|
15
15
|
def generate_data(to_json = false)
|
|
16
16
|
if valid_component_and_stack
|
|
17
17
|
get_parameters.each do |key, value|
|
|
18
|
-
data
|
|
18
|
+
if data.has_key?("Parameters") && data["Parameters"][key]
|
|
19
|
+
data["Parameters"][key]["Default"] = value
|
|
20
|
+
end
|
|
19
21
|
end
|
|
20
22
|
to_json ? JSON.pretty_generate(data) : data
|
|
21
23
|
end
|
|
@@ -39,7 +41,7 @@ module BBC
|
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
def get_parameters
|
|
42
|
-
@config.resources["cloudformation"]["components"][@id][@options[:stack]]["variants"][@options[:variant]]
|
|
44
|
+
@config.resources["cloudformation"]["components"][@id][@options[:stack]]["variants"][@options[:variant]] || []
|
|
43
45
|
end
|
|
44
46
|
end
|
|
45
47
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bbc-cosmos-tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steven Jack
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-06-
|
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|