opsmgr 0.29.3 → 0.30.0

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: a9472f6f62c4e27a5efb5a3ad1cc4e5984e7e6b4
4
- data.tar.gz: da45372fca259760028a2b4e05dc1490b2454064
3
+ metadata.gz: 1b55c2ce7ed9ff454183870c230b6c835a21ba30
4
+ data.tar.gz: e8c6c0da0f0e9486d27de1b032ff578a7b911b39
5
5
  SHA512:
6
- metadata.gz: ae5627618254913687d34e8d191fe2d6152f192a7210aeacf8748ec1dcb022efaf5d2c31ea7b0cb11a8eadf3e85ecb11772dc943ef32b28629322494bce6e477
7
- data.tar.gz: 892149fd7dedb92b492d89cca10bd5d273261bd06088595a18433348f39a04f1ee4ea4296c27001e26fe1be4cee17905f9444d363c33fcc4195826871efdce44
6
+ metadata.gz: a005c9d7a43ed25a62926e9df79eb9d6a5b2db002384d860d00d37a4bc49c2ae8bba594c9f9a805c0d8dcdddb4d19f02ee96299d8ef3476ef068d250a3dcc5ee
7
+ data.tar.gz: faa6476ebc0c61279c10cbc6675d88d7c0521831f19ce8c8ab07dae12bd970fabf35a1f03dec33dd581c7ebe30b92182da03c782cf0b5dc89a6d471c9f03ba36
@@ -69,6 +69,11 @@ module Opsmgr
69
69
  end
70
70
  end
71
71
 
72
+ def import_installation(path, password)
73
+ response = http_client.import_installation(path, password)
74
+ basic_success_or_error("Error importing #{path}", response)
75
+ end
76
+
72
77
  private
73
78
 
74
79
  attr_reader :http_client
@@ -162,6 +162,23 @@ module Opsmgr
162
162
  endpoints.version
163
163
  end
164
164
 
165
+ def import_installation(installation_file, password)
166
+ req = Net::HTTP::Post::Multipart.new(
167
+ endpoints.import_installation_path,
168
+ 'installation[file]' =>
169
+ UploadIO.new(
170
+ installation_file,
171
+ 'application/octet-stream',
172
+ File.basename(installation_file)
173
+ ),
174
+ 'password' => password
175
+ )
176
+
177
+ req.basic_auth(web_auth_user, web_auth_password)
178
+
179
+ http.request(req)
180
+ end
181
+
165
182
  private
166
183
 
167
184
  def web_auth_user
@@ -84,6 +84,16 @@ module Opsmgr
84
84
  end
85
85
  end
86
86
 
87
+
88
+ def import_installation(client, path)
89
+ result = client.import_installation(path, environment.settings.ops_manager.password)
90
+ if result.success?
91
+ log.info 'Successfully imported installation'
92
+ else
93
+ fail result.message
94
+ end
95
+ end
96
+
87
97
  private
88
98
 
89
99
  attr_reader :environment
@@ -31,12 +31,14 @@ namespace :opsmgr do
31
31
 
32
32
  desc 'Import installation'
33
33
  task :import_installation, [:environment, :om_version, :import_file] do |_, args|
34
- require 'opsmgr/ui_helpers/ui_spec_runner'
34
+ require 'opsmgr/environments'
35
+ require 'opsmgr/cmd/ops_manager'
36
+ require 'opsmgr/api/client'
35
37
 
36
- UiSpecRunner.new(
37
- environment: args.environment,
38
- om_version: args.om_version
39
- ).import_installation(args.import_file)
38
+ environment_object = Opsmgr::Environments.for(args.environment)
39
+ client = Opsmgr::Api::Client.new(environment_object)
40
+ opsmgr_cmd = Opsmgr::Cmd::OpsManager.new(environment_object)
41
+ opsmgr_cmd.import_installation(client, args.import_file)
40
42
  end
41
43
 
42
44
  desc 'Delete installation'
@@ -1,5 +1,5 @@
1
1
  module Opsmgr
2
- VERSION = '0.29.3'
2
+ VERSION = '0.30.0'
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.29.3
4
+ version: 0.30.0
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-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake