opsmgr 0.35.1 → 0.35.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c761a9434f65e89f7f928b7ae7da104a2cb152e
4
- data.tar.gz: 9dedbf775cbd25cebbb3865364a50eefb25110fa
3
+ metadata.gz: 71f8e5c59049f4977f4e12b8bc1bf7f22753200e
4
+ data.tar.gz: 995e46d45ee220bf76e26bb010e991acbecc4c24
5
5
  SHA512:
6
- metadata.gz: f8fc4f9d195d7075c1c696b7916d049811c046fe4240e7b2020411383fcef14f6865fc5c2984f66a518cd9a778f5e0e8c29c4708bc492706e17f484450f1c171
7
- data.tar.gz: c728ebf2e7ede6affdbdc94badd2c37b7eacc2adbb8e7c4dcabacecd1717dd1321ac78a6dc2071372fe4c28e029ee07c84cadd209dac44cca23bcab077b6c813
6
+ metadata.gz: 2f210dfafc8fb3c3533cae6479756dae5872e5f53e680712d5a9c6fea3e83cb067b9ca293372774272afb1b9c155f43786c95b77a8b01fe9f5ab35ba711e517e
7
+ data.tar.gz: 97cc3182d119418cebda42073b5b2141368c2f74ffd1d099d86efdaedf62c8a116ec9b3e643dcfd0f36c1b310b1d6883212b11f12b0e17b80e39ac26da1996a0
@@ -50,6 +50,15 @@ module Opsmgr
50
50
  basic_success_or_error("Error upgrading '#{product_guid}' to '#{to_version}'", response)
51
51
  end
52
52
 
53
+ def download_staged_manifest(product_guid)
54
+ response = http_client.download_staged_manifest(product_guid)
55
+ if response.code == '200'
56
+ StagedManifestResult.new(response.body)
57
+ else
58
+ Error.new("Error downloading staged manifest for '#{product_guid}'", response)
59
+ end
60
+ end
61
+
53
62
  def list_products
54
63
  response = http_client.list_products
55
64
  if response.code == '200'
@@ -109,6 +109,13 @@ module Opsmgr
109
109
  http.request(req)
110
110
  end
111
111
 
112
+ def download_staged_manifest(product_guid)
113
+ req = Net::HTTP::Get.new(endpoints.download_staged_manifest(product_guid))
114
+ add_auth_header(req)
115
+
116
+ http.request(req)
117
+ end
118
+
112
119
  def trigger_install
113
120
  req = Net::HTTP::Post.new(endpoints.install_post_path)
114
121
  req.body = ''
@@ -240,6 +240,14 @@ module Opsmgr
240
240
  end
241
241
  end
242
242
 
243
+ class StagedManifestResult < Result
244
+ attr_reader :manifest
245
+
246
+ def initialize(manifest)
247
+ @manifest = manifest
248
+ end
249
+ end
250
+
243
251
  class Error < Result
244
252
  def initialize(message, response)
245
253
  @message = "#{message}:\n#{response.body}"
@@ -72,6 +72,10 @@ module Opsmgr
72
72
  "/api/manifests/#{product_guid}"
73
73
  end
74
74
 
75
+ def download_staged_manifest(product_guid)
76
+ "/api/v0/staged/products/#{product_guid}/manifest"
77
+ end
78
+
75
79
  def export_installation_path
76
80
  '/api/installation_asset_collection'
77
81
  end
@@ -105,6 +105,27 @@ module Opsmgr
105
105
  end
106
106
  end
107
107
 
108
+ def download_staged_manifest(client, guid, manifest_filepath)
109
+ result = client.download_staged_manifest(guid)
110
+ if result.success?
111
+ File.open(manifest_filepath, 'w') do |mf|
112
+ mf.write(result.manifest)
113
+ end
114
+ log.info 'Successfully downloaded staged manifest for product'
115
+ else
116
+ fail result.message
117
+ end
118
+ end
119
+
120
+ def revert_staged_changes(client)
121
+ result = client.revert_staged_changes
122
+ if result.success?
123
+ log.info 'Successfully reverted staged changes'
124
+ else
125
+ fail result.message
126
+ end
127
+ end
128
+
108
129
  private
109
130
 
110
131
  attr_reader :environment
@@ -180,6 +180,20 @@ namespace :opsmgr do
180
180
  download_logs: args.with_defaults(download_logs: false)
181
181
  ).run_errand
182
182
  end
183
+
184
+ desc 'Revert staged changes'
185
+ task :revert_staged_changes, [:environment, :om_version] do |_, args|
186
+ require 'opsmgr/ui_helpers/ui_spec_runner'
187
+
188
+ unless args.om_version
189
+ raise "Please provide an Ops Manager version (for example, 1.7)"
190
+ end
191
+
192
+ UiSpecRunner.new(
193
+ environment: args.environment,
194
+ om_version: args.om_version
195
+ ).revert_staged_changes
196
+ end
183
197
  end
184
198
  # Copyright (c) 2014-2015 Pivotal Software, Inc.
185
199
  # All rights reserved.
@@ -55,6 +55,21 @@ namespace :opsmgr do
55
55
  om_version: args.om_version
56
56
  ).uncheck_errands(args.product_name, args.extras)
57
57
  end
58
+
59
+ desc 'Download staged manifest for a Generic Pivotal Product'
60
+ task :download_staged_manifest, [:environment, :om_version, :product_name, :manifest_filepath] do |_, args|
61
+ require 'opsmgr/environments'
62
+ require 'opsmgr/cmd/ops_manager'
63
+ require 'opsmgr/api/client'
64
+
65
+ environment_object = Opsmgr::Environments.for(args.environment)
66
+ client = Opsmgr::Api::Client.new(environment_object, args.om_version)
67
+ opsmgr_cmd = Opsmgr::Cmd::OpsManager.new(environment_object)
68
+
69
+ installed_products = opsmgr_cmd.installed_products(client)
70
+ product_guid = installed_products.guid_for(args.product_name)
71
+ opsmgr_cmd.download_staged_manifest(client, product_guid, args.manifest_filepath)
72
+ end
58
73
  end
59
74
  end
60
75
  # Copyright (c) 2014-2015 Pivotal Software, Inc.
@@ -0,0 +1,39 @@
1
+ require_relative 'config_helper'
2
+
3
+ RSpec.describe 'Reverting staged changes', order: :defined do
4
+ let!(:current_ops_manager) { ops_manager_driver }
5
+ let!(:env_settings) { fetch_environment_settings }
6
+
7
+ it 'creates the admin user and logs in' do
8
+ # if the ops manager is not up, fail earlier than other cases and
9
+ # let the caller handle the error
10
+ poll_up_to_mins(1) do
11
+ current_ops_manager.setup_page.setup_or_login(
12
+ user: env_settings['ops_manager']['username'],
13
+ password: env_settings['ops_manager']['password'],
14
+ )
15
+
16
+ expect(page).to have_content('Installation Dashboard')
17
+ end
18
+ end
19
+
20
+ it 'reverts staged changes' do
21
+ if current_ops_manager.product_dashboard.revert_available?
22
+ current_ops_manager.product_dashboard.revert_pending_changes
23
+
24
+ poll_up_to_mins(1) do
25
+ expect(current_ops_manager.product_dashboard.revert_available?).to eq false
26
+ end
27
+ else
28
+ puts 'no staged changes to revert'
29
+ end
30
+ end
31
+ end
32
+ # Copyright (c) 2014-2015 Pivotal Software, Inc.
33
+ # All rights reserved.
34
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
35
+ # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36
+ # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
37
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
38
+ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
39
+ # USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -88,6 +88,10 @@ class UiSpecRunner
88
88
  run_spec([spec_path + '/uncheck_errands_spec.rb'])
89
89
  end
90
90
 
91
+ def revert_staged_changes
92
+ run_spec([spec_path + '/revert_staged_changes_spec.rb'])
93
+ end
94
+
91
95
  private
92
96
 
93
97
  def spec_path
@@ -1,5 +1,5 @@
1
1
  module Opsmgr
2
- VERSION = '0.35.1'.freeze
2
+ VERSION = '0.35.3'.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.35.1
4
+ version: 0.35.3
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-05-11 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -358,6 +358,7 @@ files:
358
358
  - lib/opsmgr/ui_helpers/import_stemcell_spec.rb
359
359
  - lib/opsmgr/ui_helpers/microbosh/configure_microbosh_spec.rb
360
360
  - lib/opsmgr/ui_helpers/post_import_configuration_spec.rb
361
+ - lib/opsmgr/ui_helpers/revert_staged_changes_spec.rb
361
362
  - lib/opsmgr/ui_helpers/settings_helper.rb
362
363
  - lib/opsmgr/ui_helpers/trigger_install_spec.rb
363
364
  - lib/opsmgr/ui_helpers/ui_spec_runner.rb