Skip to content

Modify HDInsight config cmdlets to use shared copy method to preserve parameters #179

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

Merged
merged 3 commits into from
Feb 25, 2015
Merged

Modify HDInsight config cmdlets to use shared copy method to preserve parameters #179

merged 3 commits into from
Feb 25, 2015

Conversation

ghost
Copy link

@ghost ghost commented Feb 19, 2015

The following cmdlets currently operate on an input AzureHDInsightConfig object to modify or add to the configuration:

  • Add-AzureHDInsightConfig
  • Add-AzureHDInsightMetastore
  • Add-AzureHDInsightScriptAction
  • Add-AzureHDInsightStorage
  • Set-AzureHDInsightDefaultStorage

The existing implementations have duplicated code in their Config parameter and some options have been missed as new configuration options are added. Specifically, the Spark configuration is only maintained by Add-AzureHDInsightConfig but would be dropped by any of the others.

This Pull Request moves the duplicated code into a utility function (AzureHDInsightConfig.CopyFrom), and alters the implementation of each of these cmdlets to leverage the utility function.

I looked at moving the Config parameter into a superclass and deriving each of these cmdlets from that class, but the fact that the Config parameter is operating on the this.command object, which is a different class for each cmdlet, made that option significantly more difficult.

I also added a Unit Test CanCallAllConfigCmdlets_PreserveAll that exercises the cmdlets by setting all of the possible options and verifying that they are maintained through a pipeline including all of the referenced cmdlets. This unit test surfaced additional properties that were not being maintained properly in pipelined commands:

  • ZookeeperNodeVMSize
  • DataNodeVMSize
  • OozieConfiguration.AdditionalActionExecutorLibraries
  • OozieConfiguration.AdditionalSharedLibraries
  • HBaseConfiguration.AdditionalLibraries
  • HiveConfiguration.AdditionalLibraries

The CopyFrom method now copies all of these parameters.

… parameters. Add unit test for pipelined cmdlets.
@azurecla
Copy link

Hi @rickmsft, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.azure.com.

TTYL, AZPRBOT;

@1mahesh
Copy link

1mahesh commented Feb 20, 2015

Looks good. Can you verify the final cmdlet build to do a sanity validation?

@ghost
Copy link
Author

ghost commented Feb 20, 2015

Built the debug MSI and installed, ran some tests and created an HBase in a VNET with custom metastore and mapred config settings. Also ran some additional checks populating more of the config parameters offline without creating clusters & dumping the objects, and all look as expected. Feel free to ping me offline if you want to see the scripts or results.

…onfig.CopyFrom to avoid side effects on passed-in Config object
ogail added a commit that referenced this pull request Feb 25, 2015
Modify HDInsight config cmdlets to use shared copy method to preserve parameters
@ogail ogail merged commit b190035 into Azure:dev Feb 25, 2015
AzureRT referenced this pull request in AzureRT/azure-powershell Nov 11, 2015
markcowl pushed a commit that referenced this pull request Apr 28, 2016
Cmdlets, Convertors, Provider skeletons for Policy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants