Skip to content

HDInsight bug fixes #713

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 1 commit into from
Aug 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions setup/azurecmdfiles.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,9 @@
<Component Id="cmpF417A81D5F1E4FA1121F5CF7B9DC8439" Guid="*">
<File Id="fil43DE88B90B4EAEB16296A84082C1DCF1" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\HDInsight\Microsoft.Azure.Commands.HDInsight.dll" />
</Component>
<Component Id="cmp278E6AC149924003FD07F271A0D39B73" Guid="*">
<File Id="filB6023ABB5409C60A6392D145BB79604E" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\HDInsight\Microsoft.Azure.Commands.HDInsight.dll-help.psd1" />
</Component>
<Component Id="cmp0CEB7817889A2764028EDD1A3E0955C8" Guid="*">
<File Id="fil843773A2EA2CC25507CE5DFA567E6722" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\HDInsight\Microsoft.Azure.Common.Authentication.dll" />
</Component>
Expand Down Expand Up @@ -5106,6 +5109,7 @@
<ComponentRef Id="cmpAB177D1334F111EB52C17D3C8B63D74F" />
<ComponentRef Id="cmp1516DA5C976539D7953783DBE0C35FC0" />
<ComponentRef Id="cmpF417A81D5F1E4FA1121F5CF7B9DC8439" />
<ComponentRef Id="cmp278E6AC149924003FD07F271A0D39B73" />
<ComponentRef Id="cmp0CEB7817889A2764028EDD1A3E0955C8" />
<ComponentRef Id="cmp12254838A1AB62028019D3E828B5EDBC" />
<ComponentRef Id="cmpCEC1013D8449BCE69C91DCA01F609D2E" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
<Name>Commands.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Microsoft.Azure.Commands.HDInsight.dll-help.Help.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static class CommandNames
public const string AzureHDInsightJob = "AzureHDInsightJob";
public const string AzureHDInsightJobOutput = "AzureHDInsightJobOutput";
public const string AzureHDInsightDefaultStorage = "AzureHDInsightDefaultStorage";
public const string Hive = "Hive";
public const string AzureHDInsightHiveJob = "AzureHDInsightHiveJob";
}

public static class JobDefinitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace Microsoft.Azure.Commands.HDInsight
{
[Cmdlet(VerbsLifecycle.Invoke,
Constants.CommandNames.Hive),
Constants.CommandNames.AzureHDInsightHiveJob),
OutputType(typeof(string))]
public class InvokeHiveCommand : HDInsightCmdletBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections;
using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Azure.Commands.HDInsight.Commands;
Expand All @@ -27,7 +28,7 @@ namespace Microsoft.Azure.Commands.HDInsight
typeof(AzureHDInsightConfig))]
public class AddAzureHDInsightConfigValuesCommand : HDInsightCmdletBase
{
private Dictionary<string, Dictionary<string, string>> _configurations;
private Dictionary<string, Hashtable> _configurations;

#region Input Parameter Definitions

Expand All @@ -38,66 +39,66 @@ public class AddAzureHDInsightConfigValuesCommand : HDInsightCmdletBase
public AzureHDInsightConfig Config { get; set; }

[Parameter(HelpMessage = "Gets the Core Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> Core { get; set; }
public Hashtable Core { get; set; }

[Parameter(HelpMessage = "Gets the Hive Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> HiveSite { get; set; }
public Hashtable HiveSite { get; set; }

[Parameter(HelpMessage = "Gets the Hive Env configurations of this HDInsight cluster.")]
public Dictionary<string, string> HiveEnv { get; set; }
public Hashtable HiveEnv { get; set; }

[Parameter(HelpMessage = "Gets the Oozie Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> OozieSite { get; set; }
public Hashtable OozieSite { get; set; }

[Parameter(HelpMessage = "Gets the Oozie Env configurations of this HDInsight cluster.")]
public Dictionary<string, string> OozieEnv { get; set; }
public Hashtable OozieEnv { get; set; }

[Parameter(HelpMessage = "Gets the WebHCat Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> WebHCat { get; set; }
public Hashtable WebHCat { get; set; }

[Parameter(HelpMessage = "Gets the HBase Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> HBaseSite { get; set; }
public Hashtable HBaseSite { get; set; }

[Parameter(HelpMessage = "Gets the HBase Env configurations of this HDInsight cluster.")]
public Dictionary<string, string> HBaseEnv { get; set; }
public Hashtable HBaseEnv { get; set; }

[Parameter(HelpMessage = "Gets the Storm Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> Storm { get; set; }
public Hashtable Storm { get; set; }

[Parameter(HelpMessage = "Gets the Yarn Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> Yarn { get; set; }
public Hashtable Yarn { get; set; }

[Parameter(HelpMessage = "Gets the MapRed Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> MapRed { get; set; }
public Hashtable MapRed { get; set; }

[Parameter(HelpMessage = "Gets the Tez Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> Tez { get; set; }
public Hashtable Tez { get; set; }

[Parameter(HelpMessage = "Gets the Hdfs Site configurations of this HDInsight cluster.")]
public Dictionary<string, string> Hdfs { get; set; }
public Hashtable Hdfs { get; set; }

#endregion

public AddAzureHDInsightConfigValuesCommand()
{
Core = new Dictionary<string, string>();
HiveSite = new Dictionary<string, string>();
HiveEnv = new Dictionary<string, string>();
OozieSite = new Dictionary<string, string>();
OozieEnv = new Dictionary<string, string>();
WebHCat = new Dictionary<string, string>();
HBaseSite = new Dictionary<string, string>();
HBaseEnv = new Dictionary<string, string>();
Storm = new Dictionary<string, string>();
Yarn = new Dictionary<string, string>();
MapRed = new Dictionary<string, string>();
Tez = new Dictionary<string, string>();
Hdfs = new Dictionary<string, string>();
Core = new Hashtable();
HiveSite = new Hashtable();
HiveEnv = new Hashtable();
OozieSite = new Hashtable();
OozieEnv = new Hashtable();
WebHCat = new Hashtable();
HBaseSite = new Hashtable();
HBaseEnv = new Hashtable();
Storm = new Hashtable();
Yarn = new Hashtable();
MapRed = new Hashtable();
Tez = new Hashtable();
Hdfs = new Hashtable();
}

public override void ExecuteCmdlet()
{
_configurations = Config.Configurations ?? new Dictionary<string, Dictionary<string, string>>();
_configurations = Config.Configurations ?? new Dictionary<string, Hashtable>();

AddConfigToConfigurations(Core, ConfigurationKey.CoreSite);
AddConfigToConfigurations(HiveSite, ConfigurationKey.HiveSite);
Expand All @@ -116,15 +117,16 @@ public override void ExecuteCmdlet()
WriteObject(Config);
}

private void AddConfigToConfigurations(Dictionary<string, string> userConfigs, string configKey)
private void AddConfigToConfigurations(Hashtable userConfigs, string configKey)
{
//var userConfigs = HashtableToDictionary(configs);
//if no configs of this type provided, do nothing
if (userConfigs == null || userConfigs.Count == 0)
{
return;
}

Dictionary<string, string> config;
Hashtable config;

//if configs provided and key does not already exist, add the key with provided dictionary
if (!_configurations.TryGetValue(configKey, out config))
Expand All @@ -134,11 +136,18 @@ private void AddConfigToConfigurations(Dictionary<string, string> userConfigs, s
}

//if configs provided and key already exists, add the provided values to the dictionary for the key
foreach (var conf in userConfigs)
var updatedConfig = ConcatHashtables(config, userConfigs);

_configurations[configKey] = updatedConfig;
}

private static Hashtable ConcatHashtables(Hashtable first, Hashtable second)
{
foreach (DictionaryEntry item in second)
{
config.Add(conf.Key, conf.Value);
first[item.Key] = item.Value;
}
_configurations[configKey] = config;
return first;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
Expand Down Expand Up @@ -208,7 +209,7 @@ var storageAccount in
}
foreach (var val in parameters.Configurations.Where(val => !result.Configurations.ContainsKey(val.Key)))
{
result.Configurations.Add(val.Key, val.Value);
result.Configurations.Add(val.Key, DictionaryToHashtable(val.Value));
}
return result;
}
Expand All @@ -231,13 +232,14 @@ var storageAccount in
}
foreach (var val in value.Configurations.Where(val => !parameters.Configurations.ContainsKey(val.Key)))
{
parameters.Configurations.Add(val.Key, val.Value);
parameters.Configurations.Add(val.Key, HashtableToDictionary(val.Value));
}
}
}

#endregion


public NewAzureHDInsightClusterCommand()
{
parameters = new ClusterCreateParameters();
Expand All @@ -256,11 +258,20 @@ public override void ExecuteCmdlet()
parameters.RdpUsername = RdpCredential.UserName;
parameters.RdpPassword = RdpCredential.Password.ConvertToString();
}
if (SshCredential != null)

if (OSType == OSType.Linux)
{
parameters.SshUserName = SshCredential.UserName;
parameters.SshPassword = SshCredential.Password.ConvertToString();
if (!string.IsNullOrEmpty(SshCredential.Password.ConvertToString()))
{
parameters.SshPassword = SshCredential.Password.ConvertToString();
}
if (!string.IsNullOrEmpty(SshPublicKey))
{
parameters.SshPublicKey = SshPublicKey;
}
}

foreach (
var storageAccount in
AdditionalStorageAccounts.Where(
Expand Down Expand Up @@ -294,5 +305,17 @@ var storageAccount in
WriteObject(new AzureHDInsightCluster(cluster.Cluster));
}
}

private static Hashtable DictionaryToHashtable(Dictionary<string, string> dictionary)
{
return new Hashtable(dictionary);
}

private static Dictionary<string, string> HashtableToDictionary(Hashtable table)
{
return table
.Cast<DictionaryEntry>()
.ToDictionary(kvp => (string)kvp.Key, kvp => (string)kvp.Value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections;
using System.Collections.Generic;
using Microsoft.Azure.Management.HDInsight.Models;

Expand Down Expand Up @@ -67,7 +68,7 @@ public class AzureHDInsightConfig
/// <summary>
/// Gets the configurations of this HDInsight cluster.
/// </summary>
public Dictionary<string, Dictionary<string, string>> Configurations { get; private set; }
public Dictionary<string, Hashtable> Configurations { get; private set; }

/// <summary>
/// Gets config actions for the cluster.
Expand All @@ -78,7 +79,7 @@ public AzureHDInsightConfig()
{
ClusterType = HDInsightClusterType.Hadoop;
AdditionalStorageAccounts = new Dictionary<string, string>();
Configurations = new Dictionary<string, Dictionary<string, string>>();
Configurations = new Dictionary<string, Hashtable>();
ScriptActions = new Dictionary<ClusterNodeType, List<ScriptAction>>();
}
}
Expand Down