opsmgr 0.30.1 → 0.31.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: 1e761649dd4a640d2b16004ae9e3ea8a89e97601
4
- data.tar.gz: 54867adce426dceaeef08341765379869e7e921e
3
+ metadata.gz: f07cfd09461a801ab519037fee250ede9b351399
4
+ data.tar.gz: 99a5139c72f057861ff684a1c353871152408b9e
5
5
  SHA512:
6
- metadata.gz: 7bb7d757a5b2576320ffcb37855095c16ce9d8042d0282c4f3c03607a7f0359c4d47513ce6d2c3daf32afc4d431950bf773a700544b56ca769b074b6fe629a8c
7
- data.tar.gz: bed741d3047d35128d53a68e0128680d0e7a4fa2b7a691774d86102f3d8f6738bfe0bf6e19cb36393ffd4310f73a4ea1f4ba6e03954c520f1d16cf6e2f081116
6
+ metadata.gz: dff7da78085c9079c6b04663098d95c75060c3da92fbb69c67960628351cb39bc36258028dc59120d15a408862aeac6b22e58057eb9356c5840b4e2d0d8fa90c
7
+ data.tar.gz: d21f48dbf47ebcabc71caf6a99305ffccab4d09ce64185ee29dbb05545f30812615fe511bb1717935d8653a78cf4d06a1c6ca4f5579a13bca75657bc758902ad
@@ -74,6 +74,11 @@ module Opsmgr
74
74
  basic_success_or_error("Error importing #{path}", response)
75
75
  end
76
76
 
77
+ def import_stemcell(path)
78
+ response = http_client.import_stemcell(path)
79
+ basic_success_or_error("Error importing stemcell #{path}", response)
80
+ end
81
+
77
82
  private
78
83
 
79
84
  attr_reader :http_client
@@ -179,6 +179,22 @@ module Opsmgr
179
179
  http.request(req)
180
180
  end
181
181
 
182
+ def import_stemcell(stemcell_file)
183
+ req = Net::HTTP::Post::Multipart.new(
184
+ endpoints.import_stemcell_path,
185
+ 'stemcell[file]' =>
186
+ UploadIO.new(
187
+ stemcell_file,
188
+ 'application/octet-stream',
189
+ File.basename(stemcell_file)
190
+ )
191
+ )
192
+
193
+ req.basic_auth(web_auth_user, web_auth_password)
194
+
195
+ http.request(req)
196
+ end
197
+
182
198
  private
183
199
 
184
200
  def web_auth_user
@@ -79,6 +79,10 @@ module Opsmgr
79
79
  def mark_for_deletion_path(product_guid)
80
80
  "/api/installation_settings/products/#{product_guid}"
81
81
  end
82
+
83
+ def import_stemcell_path
84
+ '/api/stemcells'
85
+ end
82
86
  end
83
87
  end
84
88
  end
@@ -84,7 +84,6 @@ module Opsmgr
84
84
  end
85
85
  end
86
86
 
87
-
88
87
  def import_installation(client, path)
89
88
  result = client.import_installation(path, environment.settings.ops_manager.password)
90
89
  if result.success?
@@ -94,6 +93,15 @@ module Opsmgr
94
93
  end
95
94
  end
96
95
 
96
+ def import_stemcell(client, path)
97
+ result = client.import_stemcell(path)
98
+ if result.success?
99
+ log.info 'Successfully imported stemcell'
100
+ else
101
+ fail result.message
102
+ end
103
+ end
104
+
97
105
  private
98
106
 
99
107
  attr_reader :environment
@@ -50,6 +50,18 @@ namespace :opsmgr do
50
50
  ).delete_installation
51
51
  end
52
52
 
53
+ desc 'Import a stemcell'
54
+ task :import_stemcell, [:environment, :om_version, :stemcell_path] do |_, args|
55
+ require 'opsmgr/environments'
56
+ require 'opsmgr/cmd/ops_manager'
57
+ require 'opsmgr/api/client'
58
+
59
+ environment_object = Opsmgr::Environments.for(args.environment)
60
+ client = Opsmgr::Api::Client.new(environment_object)
61
+ opsmgr_cmd = Opsmgr::Cmd::OpsManager.new(environment_object)
62
+ opsmgr_cmd.import_stemcell(client, args.stemcell_path)
63
+ end
64
+
53
65
  desc 'Add first user'
54
66
  task :add_first_user, [:environment, :om_version] do |_, args|
55
67
  require 'opsmgr/ui_helpers/ui_spec_runner'
@@ -35,12 +35,14 @@ namespace :opsmgr do
35
35
 
36
36
  desc 'Import a stemcell for a Generic Pivotal Product'
37
37
  task :import_stemcell, [:environment, :om_version, :stemcell_path, :product_name] do |_, args|
38
- require 'opsmgr/ui_helpers/ui_spec_runner'
38
+ require 'opsmgr/environments'
39
+ require 'opsmgr/cmd/ops_manager'
40
+ require 'opsmgr/api/client'
39
41
 
40
- UiSpecRunner.new(
41
- environment: args.environment,
42
- om_version: args.om_version
43
- ).import_stemcell(args.stemcell_path, args.product_name)
42
+ environment_object = Opsmgr::Environments.for(args.environment)
43
+ client = Opsmgr::Api::Client.new(environment_object)
44
+ opsmgr_cmd = Opsmgr::Cmd::OpsManager.new(environment_object)
45
+ opsmgr_cmd.import_stemcell(client, args.stemcell_path)
44
46
  end
45
47
 
46
48
  desc 'Uncheck errands for a Generic Pivotal Product'
@@ -1,5 +1,5 @@
1
1
  module Opsmgr
2
- VERSION = '0.30.1'
2
+ VERSION = '0.31.0'
3
3
  end
4
4
  # Copyright (c) 2014-2015 Pivotal Software, Inc.
5
5
  # All rights reserved.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opsmgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.1
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Release Engineering