Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the verify_credentials action for /api/providers #682

Merged
merged 1 commit into from
Oct 4, 2019

Conversation

skateman
Copy link
Member

@skateman skateman commented Oct 2, 2019

Exposing the verify_credentials_task method as verify_credentials on /api/providers for the new provider forms. This action will return a task ID that can be polled for the credential verification of any provider. The request always requires a zone and the provider type, other provider-specific options are all optional.

Request:

# POST http://admin:smartvm@localhost:3000/api/providers
{
  "action": "verify_credentials",
  "resource": {
    "zone": {
      "id": 1
    },
    "type": "ManageIQ::Providers::Redhat::InfraManager"
  }
}

Response:

{
  "results": [
    {
      "success": true,
      "message": "Credentials sent for verification",
      "task_id": "366208",
      "task_href": "http://localhost:3000/api/tasks/366208"
    }
  ]
}

Related issue: ManageIQ/manageiq#18818

@miq-bot add_reviewer @abellotti
@miq-bot add_reviewer @lpichler
@miq-bot add_label ivanchuk/no, enhancement

cc @agrare @Fryguy @Hyperkid123

@miq-bot
Copy link
Member

miq-bot commented Oct 2, 2019

Checked commit skateman@5b61ddf with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 1 offense detected

app/controllers/api/providers_controller.rb

@Fryguy
Copy link
Member

Fryguy commented Oct 3, 2019

Would like @agrare's approval before merge.

@skateman
Copy link
Member Author

skateman commented Oct 3, 2019

@Fryguy I'd like to wait for an opinion from @Hyperkid123

@Hyperkid123
Copy link
Contributor

Hyperkid123 commented Oct 4, 2019

@skateman @Fryguy tried it in console and it works very well. I think we are very close to start doing some UI work too.

@lpichler lpichler added this to the Sprint 122 Ending Oct 14, 2019 milestone Oct 4, 2019
@lpichler lpichler merged commit 8e85a28 into ManageIQ:master Oct 4, 2019
@skateman skateman deleted the api-provider-validation branch October 6, 2019 08:28
@abellotti
Copy link
Member

@skateman can you add specs in a follow-up, thank you.

@skateman
Copy link
Member Author

@abellotti sure, if you tell me what exactly should I test... 😕

@abellotti
Copy link
Member

Maybe 3 specs, one with invalid role returning forbidden, one returning a successful "verify_credentials" action result and one returning a failed action (bad creds/ip/etc)
Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants