Skip to content

Commit ab77a32

Browse files
committed
Merge pull request Azure#161 from nemanja88/vmsizes
HdInsight powershell backcompat fix
2 parents db5eaa7 + 1d74489 commit ab77a32

File tree

4 files changed

+49
-28
lines changed

4 files changed

+49
-28
lines changed

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AddAzureHDInsightMetastoreCmdlet.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,27 @@ public AzureHDInsightConfig Config
5858
{
5959
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
6060
}
61+
6162
this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
6263
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
6364
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
6465
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
65-
if (value.HiveMetastore.IsNotNull())
66-
{
67-
this.command.Config.HiveMetastore = value.HiveMetastore;
68-
}
69-
if (value.OozieMetastore.IsNotNull())
70-
{
71-
this.command.Config.OozieMetastore = value.OozieMetastore;
72-
}
66+
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
67+
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
68+
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
69+
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
70+
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
71+
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
72+
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
73+
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
74+
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
75+
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
76+
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
77+
this.command.Config.ClusterType = value.ClusterType;
78+
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
79+
this.command.Config.SubnetName = value.SubnetName;
80+
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
81+
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
7382
}
7483
}
7584

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/AddAzureHDInsightStorageCmdlet.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,27 @@ public AzureHDInsightConfig Config
5858
{
5959
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
6060
}
61+
6162
this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
6263
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
63-
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
64-
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
6564
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
6665
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
66+
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
67+
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
68+
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
69+
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
70+
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
71+
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
72+
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
73+
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
74+
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
75+
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
76+
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
77+
this.command.Config.ClusterType = value.ClusterType;
78+
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
79+
this.command.Config.SubnetName = value.SubnetName;
80+
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
81+
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
6782
}
6883
}
6984

src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/SetAzureHDInsightDefaultStorageCmdlet.cs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,26 @@ public AzureHDInsightConfig Config
5656
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
5757
}
5858

59-
if (value.CoreConfiguration != null)
60-
{
61-
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
62-
}
63-
64-
if (value.YarnConfiguration != null)
65-
{
66-
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
67-
}
6859
this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
60+
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
6961
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
7062
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
7163
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
7264
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
65+
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
66+
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
67+
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
68+
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
69+
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
70+
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
71+
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
72+
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
7373
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
7474
this.command.Config.ClusterType = value.ClusterType;
75-
if (!string.IsNullOrEmpty(value.VirtualNetworkId))
76-
{
77-
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
78-
}
79-
if (!string.IsNullOrEmpty(value.SubnetName))
80-
{
81-
this.command.Config.SubnetName = value.SubnetName;
82-
}
75+
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
76+
this.command.Config.SubnetName = value.SubnetName;
77+
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
78+
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
8379
}
8480
}
8581

src/ServiceManagement/HDInsight/Commands.HDInsight/Model/Commands/CommandImplementations/NewAzureHDInsightClusterCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Collections.Generic;
1617
using System.Linq;
1718
using System.Management.Automation;
@@ -184,7 +185,7 @@ internal ClusterCreateParametersV2 GetClusterCreateParameters()
184185
this.OozieMetastore.Credential.GetCleartextPassword());
185186
}
186187

187-
if (!string.IsNullOrEmpty(this.HeadNodeSize))
188+
if (!string.IsNullOrEmpty(this.HeadNodeSize) && !this.HeadNodeSize.Equals("Default", StringComparison.OrdinalIgnoreCase))
188189
{
189190
createClusterRequest.HeadNodeSize = this.HeadNodeSize;
190191
}

0 commit comments

Comments
 (0)