Modify HDInsight config cmdlets to use shared copy method to preserve parameters #179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following cmdlets currently operate on an input AzureHDInsightConfig object to modify or add to the configuration:
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:
The CopyFrom method now copies all of these parameters.