vmware-archive / cfops

This is simply an automation that is based on the supported way to back up Pivotal Cloud Foundry
http://www.cfops.io
Apache License 2.0
35 stars 24 forks source link

cfops error messages when restoring ops-manager tile #105

Closed mayrstefan closed 7 years ago

mayrstefan commented 7 years ago

Restoring ops-manager tile with the cfops tool is very irritating. Our ops-manager was upgraded from 1.6->1.7->1.8 and is currently running version 1.8.11. We use cfops v2.2.29; for this ticket I also used the current version v3.0.5 (??? downloaded release 3.0.2). In the threee described scenarios I always started with a fresh snapshot of an empty ops-manager imported from an OVA

Trying to restore the tile directly with v2.2.29 has almost the same result as #84 and did not work

2016/12/12 15:29:44 I1212 15:29:44.523787 32500 opsmanager.go:133] falling back to basic auth for legacy system ...502 Bad Gateway ... 2016/12/12 15:29:44 E1212 15:29:44.539186 32500 opsmanager.go:147] error in save http request {"errors":{"base":["The application has not yet been set up. Please visit the UI or use the API setup endpoint to provide initial parameters."]}}

Using v3.0.5 the message is slightly different but surprisingly the restore workend: 2016/12/12 15:00:26 I1212 15:00:26.546077 31818 opsmanager.go:147] falling back to basic auth for legacy system 2016/12/12 15:00:26 E1212 15:00:26.794691 31818 opsmanager.go:162] error in save http request {"errors":{"base":["The application has not yet been set up. Please visit the UI or use the API setup endpoint to provide initial parameters."]}} 2016/12/12 15:00:26 I1212 15:00:26.794763 31818 opsmanager.go:219] Starting restore for Opsman

Irritated by the error message I tried to use /api/v0/setup before running the restore (setup returned with 200 OK): 2016/12/12 14:24:36 I1212 14:24:36.403149 30925 opsmanager.go:219] Starting restore for Opsman 2016/12/12 14:33:01 E1212 14:33:01.804326 30925 opsmanager.go:265] error uploading installation: %s Request for https://ops-manager/api/installation_asset_collection failed with status: 422 Unprocessable Entity 2016/12/12 14:33:01 E1212 14:33:01.824565 30925 createCliCommand.go:52] there was an error: Request for https://ops-manager/api/installation_asset_collection failed with status: 422 Unprocessable Entity running restore on ops-manager tile:tile

Then we follow https://discuss.pivotal.io/hc/en-us/articles/226235947-CFOPS-Troubleshooting-422-Unprocessable-Entity-on-restore- to check the production.log: Started POST "/api/v0/setup" for 127.0.0.1 at 2016-12-12 13:21:50 +0000 Processing by Api::V0::SetupController#create as */* Parameters: {"setup"=>{}} Completed 422 Unprocessable Entity in 63ms (Views: 0.3ms | ActiveRecord: 16.5ms) Started POST "/api/v0/setup" for 127.0.0.1 at 2016-12-12 13:22:45 +0000 Processing by Api::V0::SetupController#create as */* Parameters: {"setup"=>{"decryption_passphrase"=>"[FILTERED]", "decryption_passphrase_confirmation"=>"[FILTERED]", "eula_accepted"=>"true", "identity_provider"=>"internal", "admin_user_name"=>"admin", "admin_password"=>"[FILTERED]", "admin_password_confirmation"=>"[FILTERED]"}} Spawned: 1349 for UAA Completed 200 OK in 1006ms (Views: 0.2ms | ActiveRecord: 72.7ms) Started GET "/api/installation_settings" for 127.0.0.1 at 2016-12-12 13:24:36 +0000 Processing by Api::InstallationSettingsController#show as HTML Valid UAA token Completed 200 OK in 303ms (Views: 1.4ms | ActiveRecord: 13.9ms) Started GET "/" for 127.0.0.1 at 2016-12-12 13:25:03 +0000 Processing by MainController#show as HTML Redirected to https://ops-manager/login/ensure_availability Filter chain halted as :require_valid_uaa_token! rendered or redirected Completed 302 Found in 10ms (ActiveRecord: 2.4ms) Started GET "/login/ensure_availability" for 127.0.0.1 at 2016-12-12 13:25:03 +0000 Processing by LoginController#ensure_availability as HTML Checking whether UAA is available at http://127.0.0.1:8080/uaa/healthz ... Got a response from UAA: #<Net::HTTPOK 200 OK readbody=true> Redirected to https://ops-manager/auth/cloudfoundry Completed 302 Found in 28ms (ActiveRecord: 4.2ms) Started GET "/auth/cloudfoundry" for 127.0.0.1 at 2016-12-12 13:25:03 +0000 (cloudfoundry) Setup endpoint detected, running now. (cloudfoundry) Request phase initiated. (cloudfoundry) Client: opsman auth_server: https://ops-manager:443/uaa token_server: http://127.0.0.1:8080/uaa (cloudfoundry) Redirect URI https://ops-manager:443/uaa/oauth/authorize?client_id=opsman&response_type=code&redirect_uri=https%3A%2F%2Fops-manager%2Fauth%2Fcloudfoundry%2Fcallback&state=xxxxx&nonce=yyyyy Started POST "/api/installation_asset_collection" for 127.0.0.1 at 2016-12-12 13:33:01 +0000 Processing by Api::V0::InstallationAssetCollectionController#create as HTML Parameters: {"passphrase"=>"[FILTERED]", "password"=>"[FILTERED]", "installation"=>{"file"=>#<ActionDispatch::Http::UploadedFile:0x0055fddc5752f8 @tempfile=#<Tempfile:/tmp/RackMultipart20161212-1149-9o7qwn.zip>, @original_filename="installation.zip", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"installation[file]\"; filename=\"/srv/backup/pcf/opsmanager/installation.zip\"\r\nContent-Type: application/octet-stream\r\n">}} Filter chain halted as :ensure_application_isnt_configured rendered or redirected Completed 422 Unprocessable Entity in 43ms (Views: 28.6ms | ActiveRecord: 10.7ms)

Does this mean we should not have called the setup endpoint? Why does the other error message make us believe we should?

I don't understand what's going wrong here. Is the ops-manager API broken or are these false error messages from the cfops tool? Anything I should report to Pivotal support?

JinpaLhawang commented 7 years ago

This error was encountered today as well, using PCF 1.9. @mayrstefan, we also got the restore to work by NOT calling the setup endpoint, even though the console error message said that we should:

error in save http request {"errors":{"base":["The application has not yet been set up. Please visit the UI or use the API setup endpoint to provide initial parameters."]}}

We restored without setting up auth because cfops.io site says for Restore:

For versions of PCF newer than 1.7+ you will need to run the CF OPS restore BEFORE setting up the authentication, or else the restore will fail with a 422 Unprocessable Entity error.

So, confusion! Website says one thing, console error message says something entirely different... and we are to follow the website in this case.