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

Implement Powershell BootStrap Functions #373

Merged
merged 15 commits into from
Jul 15, 2019
Merged

Conversation

nshores
Copy link
Contributor

@nshores nshores commented Jul 12, 2019

Description

Created two new functions for the purpose of bootstrapping a blank Rubrik cluster. These functions are;

New-RubrikBootStrap
This function will take

- name (string)
- management_dns (array)**
- ntpserverconfigs $ntp (array)
- adminUserInfo $adminuserinfo (hashtable)
- nodeconfigs $node (hashtable)
- enableSoftwareEncryptionAtRest (bool)
- server (string) (MDNS name or IPv4 Local IP)

It will take this properly formatted parameters and pass them to the appropriate end point, and generate a bootstrap request. The Response should be HTTP 202.

Get-RubrikBootStrap

This function can be used to check the status of a bootstrap requests. It will default to request id #1.

Related Issue

#369

Motivation and Context

This functionality exists in Ansible and Python, but not powershell.

How Has This Been Tested?

This has been tested against rubrik-va-5.0.1-p2-1592.ova. It sends requests and checks status of these bootstrap requests without issue. You can use the gist here as a test input script --

https://gist.github.com/nshores/104f069570740ea645d67a8aeab19759

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ x] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [x ] I have read the CONTRIBUTION document.
  • I have updated the CHANGELOG file accordingly for the version that this merge modifies.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@jaapbrasser
Copy link
Contributor

I made some minor changes to your code. For example when authentication is not required, we won't have the $global:rubrikconnection variable available. @shamsway will review the code further.

@nshores
Copy link
Contributor Author

nshores commented Jul 12, 2019

I made some minor changes to your code. For example when authentication is not required, we won't have the $global:rubrikconnection variable available. @shamsway will review the code further.

Thanks, I reviewed what you updated and it all makes sense to me.

@shamsway
Copy link
Contributor

@nshores I'm working through this review and adding some functionality to bring it to parity with the Python SDK. There are a few different bootstrap scenarios to take into account and test against, so it will probably take me until this weekend or Monday to complete.

@nshores
Copy link
Contributor Author

nshores commented Jul 12, 2019

@nshores I'm working through this review and adding some functionality to bring it to parity with the Python SDK. There are a few different bootstrap scenarios to take into account and test against, so it will probably take me until this weekend or Monday to complete.

Thanks! If there is anything you would like to me work on, please let me know. I looked at the bootstrap function in python and tried to duplicate it best I could.

@shamsway
Copy link
Contributor

@nshores Please take a look at these changes and let me know if you have any questions. I have some additional testing to do so this is not quite ready to merge yet, but I'm making progress.

Copy link
Contributor Author

@nshores nshores left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

      ForEach($key in $nodeConfigs.Keys) {
        $resources.Body.nodeConfigs[$key] = $nodeConfigs[$key]
      }
    }

Thanks for solving this. I was going to put this logic in the API section, but it makes much more sense here - and adheres to standards for this project. The rest of the changes makes sense as well. I'm going to test these changes shortly and make sure it behaves as expected when passing data into the function.

Copy link
Contributor Author

@nshores nshores left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noted an issue when submitting multiple node configurations. The API will hang when submitting more than 1 node configuration. This seems to be an issue with the API, not the Powershell GET request. The following makes the API hang (and sometimes respond with a 406)

--

  "nodeConfigs": {
    "node1": {
      "managementIpConfig": {
        "gateway": "192.168.1.1",
        "address": "192.168.1.100",
        "netmask": "255.255.255.0"
      }
    },
    "node2": {
      "managementIpConfig": {
        "gateway": "192.168.1.1",
        "address": "192.168.1.101",
        "netmask": "255.255.255.0"
      }
    }
  },

Removing the the second node configuration allows the API to issue the correct response (202).

  "nodeConfigs": {
    "node1": {
      "managementIpConfig": {
        "gateway": "192.168.1.1",
        "address": "192.168.1.100",
        "netmask": "255.255.255.0"
      }
    }

Other than that, Everything else is working. I say we merge this when possible.

@shamsway
Copy link
Contributor

Thanks @nshores - I was just wrapping up testing and getting ready to merge this PR. I have seen similar behavior from the API in scenarios like this. For instance attempting to bootstrap a cloud cluster with configuration data for less than 4 nodes will silently fail. We will have to open an RFE to surface error messages for cases like this.

Copy link
Contributor

@shamsway shamsway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested against Edge and Cloud Cluster. Everything is working as expected. Thanks again for your contribution @nshores !

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.

4 participants