ops_manager_cli 0.4.1 → 0.5.0

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: 726b5d7b7e15a4f5cf99ba65471cf32a91e79f61
4
- data.tar.gz: 534134302a6a63bf71492fa3ba1ef3c782ffd046
3
+ metadata.gz: e8af7fdbbb2293c2f7f6a1e609776f7bc0f66ec9
4
+ data.tar.gz: dd774257ac657f9602d02583d657896fe483cf29
5
5
  SHA512:
6
- metadata.gz: bccfac866feed2dcb40443e2eb86144792a5dc47e4b1f3b8f8cc60273f067e4579119528a370b0ef75b9f5d1fdab7d6d0975e2d50ba1042340992b5bfd0bc52a
7
- data.tar.gz: b108eb9ccd98112839f5b5d3a8add837efa852965f0d57f335c5e039bfd24a4217c3a341e9e498f1d156b34443677359ac3144cbfd93365eb4680b8807cbd550
6
+ metadata.gz: 1c598d8b6023fb4d2d6d8b95fc1c7d246be7d4c5bdd5f738c9664ce6f0d39184b8d72851c26e6f16b5e02b9669a36b7194d76b39135cdefe6151e1c8ce1a6faa
7
+ data.tar.gz: e1e533f82c2ac7e7b7dc0fc9114b5d0ef79ed7ff8f6131610d79230a4653526d941a7d50cf24ca6d7e163ce23d8cc90b61fadcc1811890ebab4d22a014f6cb7e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.4.1](https://github.com/compozed/ops_manager_cli/tree/v0.4.1) (2016-10-21)
4
+ [Full Changelog](https://github.com/compozed/ops_manager_cli/compare/v0.4.0...v0.4.1)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Director template generator does not delete UAA sensitive data [\#13](https://github.com/compozed/ops_manager_cli/issues/13)
9
+ - Product template generator does not delete stemcell metadata properties [\#12](https://github.com/compozed/ops_manager_cli/issues/12)
10
+
3
11
  ## [v0.4.0](https://github.com/compozed/ops_manager_cli/tree/v0.4.0) (2016-10-20)
4
12
  [Full Changelog](https://github.com/compozed/ops_manager_cli/compare/v0.3.0...v0.4.0)
5
13
 
@@ -37,4 +45,4 @@
37
45
  ## [v0.1.1](https://github.com/compozed/ops_manager_cli/tree/v0.1.1) (2016-05-06)
38
46
 
39
47
 
40
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
48
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  FROM ruby:2.3.0
2
2
 
3
3
  ENV GEM_NAME ops_manager_cli
4
- ENV GEM_VERSION 0.4.1
4
+ ENV GEM_VERSION 0.5.0
5
5
  ENV OVFTOOL_VERSION 4.1.0-2459827
6
6
  ENV OVFTOOL_INSTALLER VMware-ovftool-${OVFTOOL_VERSION}-lin.x86_64.bundle
7
7
  ARG DOWNLOAD_URL
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # OpsManagerCli [![Build Status](https://travis-ci.org/compozed/ops_manager_cli.png?branch=master)](https://travis-ci.org/compozed/ops_manager_cli) [![Code Climate](https://codeclimate.com/github/compozed/ops_manager_cli.png)](https://codeclimate.com/github/compozed/ops_manager_cli)
1
+ # OpsManagerCli [![Build Status](https://travis-ci.org/compozed/ops_manager_cli.png?branch=master)](https://travis-ci.org/compozed/ops_manager_cli) [![Code Climate](https://codeclimate.com/github/compozed/ops_manager_cli.png)](https://codeclimate.com/github/compozed/ops_manager_cli) [![Gem Version](https://badge.fury.io/rb/ops_manager_cli.svg)](https://badge.fury.io/rb/ops_manager_cli)
2
2
 
3
3
 
4
4
  Command line tool to interact with Pivotal Operations Manager through its API, because GUIs are evil.
@@ -75,6 +75,35 @@ All dependencies must be installed and available in user PATH
75
75
 
76
76
  ./ops_manager deploy-product product_deployment.yml
77
77
 
78
+ ### Regenerating SSL Certificates
79
+
80
+ Ops Manager generates certificates for BOSH director and UAA automatically before deploying director.
81
+ [Periodically you will want to regenerate this certificates.](https://discuss.pivotal.io/hc/en-us/articles/115000453368)
82
+ There is a workaround on how to do this with ops_manager_cli:
83
+
84
+ 1. Get director template:
85
+
86
+ $ ops_manager get-director-template > product_installation_settings.yml
87
+
88
+ 2. Set director's cert and private key to null:
89
+
90
+ # product_installation_settings.yml
91
+ # For director ssl certs
92
+ + director_ssl:
93
+ + private_key_pem:
94
+ + cert_pem:
95
+
96
+ # For director ssl certs
97
+ + uaa_ssl:
98
+ + private_key_pem:
99
+ + cert_pem:
100
+
101
+ 3. Perform director deployment:
102
+
103
+ $ ops_manager deploy-product product_deployment.yml
104
+
105
+ **Note:** remove this lines unless you want to regenerate certs on every single deployment :)
106
+
78
107
  ## Using with Docker
79
108
 
80
109
  The ops_manager_cli tool can be installed in a docker container typically in conjunction with [Concourse CI](http://concourse.ci/). This allows users to build concourse pipelines to deploy and manage their Pivotal Cloud Foundry deployments.
@@ -96,7 +125,7 @@ The ops_manager_cli tool can be installed in a docker container typically in con
96
125
 
97
126
  ## Contributing
98
127
 
99
- See our [CONTRUBUTING](CONTRIBUTING.md) section for more information.
128
+ See our [CONTRIBUTING](CONTRIBUTING.md) section for more information.
100
129
 
101
130
 
102
131
  ## License
@@ -62,7 +62,6 @@ class OpsManager
62
62
  end
63
63
  end
64
64
 
65
-
66
65
  body = opts[:body] || ''
67
66
  request.body= body
68
67
 
@@ -82,6 +81,7 @@ class OpsManager
82
81
  uri = uri_for(endpoint)
83
82
  http = http_for(uri)
84
83
  request = Net::HTTP::Put.new(uri.request_uri)
84
+
85
85
  request.set_form_data(opts)
86
86
 
87
87
  request.basic_auth(username, password) if self.respond_to?(:username)
@@ -91,7 +91,12 @@ class OpsManager
91
91
  request[k] = v
92
92
  end
93
93
  end
94
- # body = opts.fetch( :body )
94
+
95
+ request['Content-Type'] = 'application/json'
96
+
97
+ body = opts[:body] || ''
98
+ request.body= body
99
+
95
100
  http.request(request).tap do |res|
96
101
  logger.info("performing put to #{uri} with opts: #{opts.inspect} res.code: #{res.code}")
97
102
  logger.info("put response body #{res.body}")
@@ -130,7 +135,10 @@ class OpsManager
130
135
  request[k] = v
131
136
  end
132
137
  end
133
- http.request(request)
138
+ http.request(request).tap do |res|
139
+ logger.info("performing delete to #{uri} with opts: #{opts.inspect} res.code: #{res.code}")
140
+ logger.info("post response body #{res.body}")
141
+ end
134
142
  end
135
143
 
136
144
  def uri_for(endpoint)
@@ -124,7 +124,7 @@ class OpsManager
124
124
  def import_stemcell(filepath)
125
125
  return unless filepath
126
126
  tar = UploadIO.new(filepath, 'multipart/form-data')
127
- print_green "====> Uploading stemcell: #{tar} ..."
127
+ print_green "====> Uploading stemcell: #{filepath} ..."
128
128
  opts = { "stemcell[file]" => tar }
129
129
  res = nil
130
130
 
@@ -106,15 +106,20 @@ class OpsManager
106
106
  end
107
107
 
108
108
  class Curl < Clamp::Command
109
- option ['-X', '--http-method'], "HTTP_METHOD", "HTTP Method (GET,POST)", default: 'GET'
109
+ option ['-X', '--http-method'], "HTTP_METHOD", "HTTP Method (DELETE, GET, POST, PUT)", default: 'GET'
110
+ option ['-d', '--data'], "HTTP_POST_DATA", "HTTP Post Data(POST, PUT)", default: ''
110
111
  parameter "ENDPOINT", "OpsManager api endpoint. eg: /api/v0/installation_settings", required: true
111
112
 
112
113
  def execute
113
114
  puts case http_method.strip
114
115
  when 'GET'
115
116
  opsman.authenticated_get(@endpoint).body
117
+ when 'DELETE'
118
+ opsman.authenticated_delete(@endpoint).body
116
119
  when 'POST'
117
120
  opsman.authenticated_post(@endpoint).body
121
+ when 'PUT'
122
+ opsman.authenticated_put(@endpoint, body: strip(@data, "'")).body
118
123
  else
119
124
  "Unsupported method: #{http_method.strip}"
120
125
  end
@@ -124,6 +129,11 @@ class OpsManager
124
129
  def opsman
125
130
  OpsManager::Api::Opsman.new(silent: true)
126
131
  end
132
+
133
+ def strip(string, chars)
134
+ chars = Regexp.escape(chars)
135
+ string.strip.gsub(/\A[#{chars}]+|[#{chars}]+\z/, "")
136
+ end
127
137
  end
128
138
 
129
139
  class Version < Clamp::Command
@@ -18,7 +18,7 @@ class OpsManager
18
18
  end
19
19
 
20
20
  def stop_current_vm(name)
21
- print "====> Stopping vm #{name}...".green
21
+ print "====> Stopping vm #{name} ...".green
22
22
  dc = vim.serviceInstance.find_datacenter(config.opts['vcenter']['datacenter'])
23
23
  logger.info "finding vm: #{name}"
24
24
  vm = dc.find_vm(name) or fail "VM not found"
@@ -41,7 +41,7 @@ class OpsManager
41
41
  end
42
42
 
43
43
  def upload
44
- print "====> Uploading product...".green
44
+ print "====> Uploading product ...".green
45
45
  if ProductDeployment.exists?(config.name, config.desired_version)
46
46
  puts "product already exists".green
47
47
  elsif config.filepath
@@ -60,6 +60,7 @@ class OpsManager
60
60
  puts "====> Upgrading #{config.name} version from #{installation.current_version.to_s} to #{config.desired_version}...".green
61
61
  upload
62
62
  upgrade_product_installation(installation.guid, config.desired_version)
63
+ merge_product_installation_settings
63
64
  OpsManager::InstallationRunner.trigger!.wait_for_result
64
65
 
65
66
  puts "====> Finish!".green
@@ -75,14 +76,19 @@ class OpsManager
75
76
  puts "====> Deploying #{config.name} version #{config.desired_version}...".green
76
77
  upload
77
78
  add_to_installation
78
- get_installation_settings({write_to: '/tmp/is.yml'})
79
- puts `DEBUG=false spruce merge /tmp/is.yml #{config.installation_settings_file} > /tmp/new_is.yml`
80
- upload_installation_settings('/tmp/new_is.yml')
79
+ merge_product_installation_settings
81
80
  OpsManager::InstallationRunner.trigger!.wait_for_result
82
81
 
83
82
  puts "====> Finish!".green
84
83
  end
85
84
 
85
+
86
+ def merge_product_installation_settings
87
+ get_installation_settings({write_to: '/tmp/is.yml'})
88
+ puts `DEBUG=false spruce merge /tmp/is.yml #{config.installation_settings_file} > /tmp/new_is.yml`
89
+ upload_installation_settings('/tmp/new_is.yml')
90
+ end
91
+
86
92
  def self.exists?(name, version)
87
93
  res = JSON.parse(OpsManager::Api::Opsman.new.get_available_products.body)
88
94
  !!res.find{ |o| o['name'] == name && o['product_version'].include?(version) }
@@ -1,3 +1,3 @@
1
1
  class OpsManager
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_manager_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CompoZed
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-21 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler