Skip to content

Commit

Permalink
Merge branch 'onesdk-phase2' into onesdk-p2-sumanths
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumanth-SK committed Apr 9, 2015
2 parents 37067c1 + 03e323a commit ff05f4e
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using System.Management.Automation;
using Microsoft.WindowsAzure.Management.StorSimple.Models;

namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets.VirtualDevice
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
{
[Cmdlet(VerbsCommon.New, "AzureStorSimpleVirtualDevice"), OutputType(typeof(string))]
public class NewAzureStorSimpleVirtualDeviceCommand : StorSimpleCmdletBase
Expand All @@ -41,6 +41,9 @@ public class NewAzureStorSimpleVirtualDeviceCommand : StorSimpleCmdletBase

[Parameter(Position = 3, Mandatory = true, HelpMessage = StorSimpleCmdletHelpMessage.CreateNewStorageAccount, ParameterSetName = StorSimpleCmdletParameterSet.CreateNewStorageAccount)]
public SwitchParameter CreateNewStorageAccount { get; set; }

[Parameter(DontShow = true, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.PersistAzureVMOnFailrue)]
public SwitchParameter PersistAzureVMOnFailrue { get; set; }

public override void ExecuteCmdlet()
{
Expand All @@ -57,6 +60,11 @@ public override void ExecuteCmdlet()
StorageAccountName = StorageAccountName
};

if (PersistAzureVMOnFailrue.IsPresent)
{
applianceProvisiongInfo.DeleteAzureCisVMOnFailure = false;
}

var deviceJobResponse = StorSimpleClient.CreateVirtualDevice(applianceProvisiongInfo);

HandleDeviceJobResponse(deviceJobResponse, "create");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@
<Reference Include="Microsoft.WindowsAzure.Management.Scheduler">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Scheduler.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Scheduler.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.StorSimple">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.1.0.0-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Management.StorSimple, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.1.0.1-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ a special character</value>
<data name="SetAzureStorSimpleDeviceNoSettingsProvided" xml:space="preserve">
<value>No settings were provided for updating device details.</value>
</data>
<data name="NotFoundWebExceptionMessage" xml:space="preserve">
<value>One or more inputs passed is wrong or the cmdlet that you are trying to use is not available.</value>
</data>
<data name="EncryptionKeyNotAcceptableMessage" xml:space="preserve">
<value>Please provide an encryption key consisting of printable ASCII characters</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,19 @@ internal virtual void HandleException(Exception exception)
var response = cloudEx.Response;
try
{
XDocument xDoc = XDocument.Parse(response.Content);
StripNamespaces(xDoc);
string cloudErrorCode = xDoc.Descendants("ErrorCode").FirstOrDefault().Value;
WriteVerbose(string.Format(Resources.CloudExceptionMessage, cloudErrorCode));
if (response.StatusCode == HttpStatusCode.NotFound)
{
var notAvailableException = new Exception(Resources.NotFoundWebExceptionMessage);
errorRecord = new ErrorRecord(notAvailableException, string.Empty, ErrorCategory.InvalidOperation, null);
break;
}
else
{
XDocument xDoc = XDocument.Parse(response.Content);
StripNamespaces(xDoc);
string cloudErrorCode = xDoc.Descendants("ErrorCode").FirstOrDefault().Value;
WriteVerbose(string.Format(Resources.CloudExceptionMessage, cloudErrorCode));
}
}
catch (Exception)
{
Expand Down Expand Up @@ -380,7 +389,7 @@ public bool IsDeviceConfigurationCompleteForDevice(DeviceDetails details)
}
return data0Configured;
}
/// <summary>
/// this method verifies that the devicename parameter specified is completely configured
/// most operations are not allowed on a non-configured device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@ internal static class StorSimpleCmdletHelpMessage
public const string DeviceJobType = "Type of job.";
public const string AdministratorPasswd = "Administrator password for the device.";
public const string SnapshotManagerPasswd = "Password for snapshot manager";
public const string PersistAzureVMOnFailrue =
"The switch parameter to debug any Provisioning Failrues by skipping deletion of the VM on failrue";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Scheduler" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.StorSimple" version="1.0.0-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.StorSimple" version="1.0.1-preview" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
</packages>

0 comments on commit ff05f4e

Please sign in to comment.