bbc-cosmos-tools 0.6.0 → 0.6.1

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: 682aa789050e6b06223d07a9da105df6abdc966d
4
- data.tar.gz: 2256eaa0c3a4c060fb26fdaa8fa637796602723c
3
+ metadata.gz: 33f0ae16de67d0b0f168224dcd626d309b267f41
4
+ data.tar.gz: 4abd19d8284fe959724fefea4e595d5eb5bd0bb4
5
5
  SHA512:
6
- metadata.gz: 8cb7f2f87c0d45e710caa0fd6f85b887410927bd37570894cfbee4eb88d7bd8df4c2976a14bd2a5e05bb505b52e95a950ec5ea7192b55e9fdf81c22643264188
7
- data.tar.gz: 9b4b400d1c6cd2da4bb81c22518dfb5ee8e80217a9b7f3879bbec47cd50edbce62bf9a0478c87131e4f60b37b9318b68150f1170d101565815b45a78ffa021cc
6
+ metadata.gz: b87ca39df5f43f6dbfb3975ccf0e7158ccef62943658f14f4c6f26c9f7414e9e27d6000c75855788dc24c0f8a9366bcc7cd730fa1688dead1e3c9ace42806591
7
+ data.tar.gz: 70670e8e77bac0d593c2f42d4c3cce2a715ef3943b36c5e274727b24410cc675dd91d245043ddfdc6268103ded5dee268638a259f3d515d014075c9e4aa26102
data/README.md CHANGED
@@ -354,6 +354,12 @@ bbc-cosmos-tools stack generate {cosmos_component_name} \
354
354
 
355
355
  > Note: in case you're not a CLI wizard, instead of specifying the `--key-path` option you can set a `$DEV_CERT_PATH` environment variable that the tool uses by default if it detects it. Inside your shell's configuration file (either `~/.bashrc` or `~/.zshrc`) you'll want to add `export DEV_CERT_PATH=/custom/path/to/your/pem/certificate`
356
356
 
357
+ Deploy component to a specific environment:
358
+
359
+ ```sh
360
+ bbc-cosmos-tools release deploy <component> --project=<project> --from=X --env=Y
361
+ ```
362
+
357
363
  ### Using YAML or JSON
358
364
 
359
365
  Use the same commands as above but make sure to include a `--type={yaml|json}`. If it's not specified then `cfndsl` is assumed as the default (almost as if you had written `--type=cfndsl`, but it's clearer to just remove the flag in that instance).
@@ -29,8 +29,9 @@ module BBC
29
29
  print_table build_table(headers, rows)
30
30
  end
31
31
 
32
- desc "SSH <COMPONENT>", "Gain SSH"
32
+ desc "ssh <COMPONENT>", "Gain SSH"
33
33
  def ssh(component)
34
+ say banner(component) + "\n"
34
35
  meta = make_request("env/#{options[:env]}/component/#{component}/instances")
35
36
 
36
37
  meta.count == 1 ? single_instance(component, meta)
@@ -55,10 +56,23 @@ module BBC
55
56
  end
56
57
 
57
58
  def session(component, instance_id, ip_address)
58
- post_data(component, instance_id)
59
+ response = post_data(component, instance_id)
60
+ check_status(response)
59
61
  output_message(component, ip_address, instance_id)
60
62
  end
61
63
 
64
+ def check_status(login)
65
+ url = JSON.parse(login.body)['url']
66
+ status = "pending_creation"
67
+ say "\n"
68
+ until status == "current"
69
+ sleep 2
70
+ say "Creating Session", :yellow
71
+ status = make_request(url)["status"]
72
+ fail Exception, (say "SSH Failed"; :red) if status == "failed"
73
+ end
74
+ end
75
+
62
76
  def select_instance(meta)
63
77
  choose do |menu|
64
78
  say "Multiple instances detected, please select one", :green
@@ -74,7 +88,7 @@ module BBC
74
88
  end
75
89
 
76
90
  def output_message(component, ip, id)
77
- say "SSH setup for #{component} on #{options[:env]}, your IP for #{id} is #{ip}", :green
91
+ say "\nYour IP for #{id} is #{ip}", :green
78
92
  end
79
93
 
80
94
  def post_data(component, id)
@@ -125,7 +125,7 @@ module BBC
125
125
 
126
126
  if data["Parameters"]
127
127
  data["Parameters"] = deep_merge(
128
- stack_parameters(stack_meta["parameters"]),
128
+ stack_parameters(stack_meta["parameters"], data["Parameters"]),
129
129
  data["Parameters"]
130
130
  )
131
131
 
@@ -202,12 +202,10 @@ module BBC
202
202
 
203
203
  private
204
204
 
205
- def stack_parameters(stack_data)
205
+ def stack_parameters(stack_data, new_params)
206
206
  stack_data.reduce({}) do |accum, (key, value)|
207
207
  accum.tap do |a|
208
- a[key] = {
209
- "Default" => value["value"]
210
- }
208
+ a[key] = { "Default" => value["value"] } if new_params.has_key? key
211
209
  end
212
210
  end
213
211
  end
@@ -1,7 +1,7 @@
1
1
  module BBC
2
2
  module Cosmos
3
3
  module Tools
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
6
6
  end
7
7
  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.6.0
4
+ version: 0.6.1
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-03-17 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler