opsmgr 0.34.19 → 0.34.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f69c08a7b4935e82fbde3f4a3061bb405f6d2cb4
4
- data.tar.gz: b205fb594fba5f1435164ab6968888a08da2b93c
3
+ metadata.gz: 12db22e6ec81819b53b0fca4191574081a93c81a
4
+ data.tar.gz: 7c27dd87c7f452a125e40d8be7df58ff4dc0309c
5
5
  SHA512:
6
- metadata.gz: 68e00bfbbfa0254874c9ebd106303ea86d18fdb0615dc6d39b5f1dab8712d28981a59c5139aaf2c03e7784f3beb73493f43f5748bd865ede1ed2a86fe0f66164
7
- data.tar.gz: 568da5664657578a53d2a6ec0562d9bd6300d76a50f2cafcf704cbe204fe7d8be24129098edc2722904da565c5ee9a4c78a80f8c4377dd7077afd51bcbb26531
6
+ metadata.gz: 70135b0ac428b04cd61db23c5b62c034bc01d96bfd3a928a5cee2c0873cdf00983e8b161a11e8bc5ff5b0005eaf2b0ef26982bba49756e4f3e3a7edfdb3ba97c
7
+ data.tar.gz: 776d3cb415c2a535aa3933cbd950055f447ae4b0d16636c5b608044506e3f5b1daa52a2657e58f513a97af2293a84740866924a0eccb48cbcb5797cb8ba5d724
@@ -19,8 +19,31 @@ module Opsmgr
19
19
  )
20
20
  end
21
21
 
22
+ def run_with_deployment(command, deployment)
23
+ bosh_deployment = bosh_deployments[/#{deployment}-[0-9a-f]{8,}/]
24
+ fail 'Deployment not found' unless bosh_deployment
25
+
26
+ deployment_file = "#{ENV.fetch('TMPDIR', '/tmp')}/#{deployment}.yml"
27
+
28
+ begin
29
+ run(
30
+ "-n download manifest #{bosh_deployment} #{deployment_file}"
31
+ )
32
+ rescue RuntimeError
33
+ raise 'bosh download manifest failed'
34
+ end
35
+
36
+ run("-d #{deployment_file} #{command}")
37
+ end
38
+
22
39
  private
23
40
 
41
+ def bosh_deployments
42
+ run_and_capture_output('deployments')
43
+ rescue RuntimeError
44
+ raise 'bosh deployments failed'
45
+ end
46
+
24
47
  def system_or_fail(command, failure_message)
25
48
  clean_and_log(command)
26
49
  Bundler.clean_system(command) || fail(failure_message)
@@ -76,6 +76,23 @@ namespace :opsmgr do
76
76
  logger: logger
77
77
  ).run(args.command)
78
78
  end
79
+
80
+ desc 'run a bosh command with a deployment'
81
+ task :run_command_with_deployment, [:environment_name, :om_version, :command, :deployment] do |_, args|
82
+ require 'opsmgr/cmd/bosh_command'
83
+ require 'opsmgr/log'
84
+ require 'opsmgr/bosh_command_runner'
85
+
86
+ logger = Opsmgr.logger_for('Rake')
87
+ bosh_command = Opsmgr::Cmd::BoshCommand.new(
88
+ env_name: args.environment_name,
89
+ om_version: args.om_version
90
+ )
91
+ Opsmgr::BoshCommandRunner.new(
92
+ bosh_command: bosh_command,
93
+ logger: logger
94
+ ).run_with_deployment(args.command, args.deployment)
95
+ end
79
96
  end
80
97
  # Copyright (c) 2014-2015 Pivotal Software, Inc.
81
98
  # All rights reserved.
@@ -1,5 +1,5 @@
1
1
  module Opsmgr
2
- VERSION = '0.34.19'.freeze
2
+ VERSION = '0.34.20'.freeze
3
3
  end
4
4
  # Copyright (c) 2014-2015 Pivotal Software, Inc.
5
5
  # All rights reserved.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsmgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.19
4
+ version: 0.34.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Release Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake