Skip to content

Commit af57b2e

Browse files
committed
Fixes for piping and display for ACLs
Update Microsoft.Azure.Commands.DataLakeStore.dll-help.xml (#3) Test updates and remove local packages Fix and re-run tests for ADLS More intentional with the not yet implemented APIs remove extraneous restore.config
1 parent 2444c9b commit af57b2e

21 files changed

+1977
-979
lines changed

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<Private>True</Private>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Management.DataLake.Store, Version=0.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.0.12.4-preview\lib\net45\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.0.12.5-preview\lib\net45\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
7171
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands/NewAzureRmDataLakeAnalyticsCatalogCredential.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020

2121
namespace Microsoft.Azure.Commands.DataLakeAnalytics
2222
{
23-
[Cmdlet(VerbsCommon.New, "AzureRmDataLakeAnalyticsCatalogCredential"), OutputType(typeof(USqlCredential))]
24-
[Alias("New-AdlCatalogCredential")]
23+
// TODO: Uncomment this in the next release when credential CRUD is supported.
24+
//[Cmdlet(VerbsCommon.New, "AzureRmDataLakeAnalyticsCatalogCredential"), OutputType(typeof(USqlCredential))]
25+
//[Alias("New-AdlCatalogCredential")]
2526
public class NewAzureDataLakeAnalyticsCatalogCredential : DataLakeAnalyticsCmdletBase
2627
{
2728
internal const string BaseParameterSetName = "Specify full URI";

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands/RemoveAzureRmDataLakeAnalyticsCatalogCredential.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818

1919
namespace Microsoft.Azure.Commands.DataLakeAnalytics
2020
{
21-
[Cmdlet(VerbsCommon.Remove, "AzureRmDataLakeAnalyticsCatalogCredential", SupportsShouldProcess = true), OutputType(typeof(bool))]
22-
[Alias("Remove-AdlCatalogCredential")]
21+
// TODO: Uncomment this in the next release when credential CRUD is supported.
22+
//[Cmdlet(VerbsCommon.Remove, "AzureRmDataLakeAnalyticsCatalogCredential", SupportsShouldProcess = true), OutputType(typeof(bool))]
23+
//[Alias("Remove-AdlCatalogCredential")]
2324
public class RemoveAzureDataLakeAnalyticsCredential : DataLakeAnalyticsCmdletBase
2425
{
2526
[Parameter(ValueFromPipelineByPropertyName = true, Position = 0, Mandatory = true,

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands/SetAzureRmDataLakeAnalyticsCatalogCredential.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121

2222
namespace Microsoft.Azure.Commands.DataLakeAnalytics
2323
{
24-
[Cmdlet(VerbsCommon.Set, "AzureRmDataLakeAnalyticsCatalogCredential"), OutputType(typeof(USqlCredential))]
25-
[Alias("Set-AdlCatalogCredential")]
24+
// TODO: Uncomment this in the next release when credential CRUD is supported.
25+
//[Cmdlet(VerbsCommon.Set, "AzureRmDataLakeAnalyticsCatalogCredential"), OutputType(typeof(USqlCredential))]
26+
//[Alias("Set-AdlCatalogCredential")]
2627
public class SetAzureDataLakeAnalyticsCatalogCredential : DataLakeAnalyticsCmdletBase
2728
{
2829
internal const string BaseParameterSetName = "Specify full URI";

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Models/DataLakeAnalyticsClient.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,18 +465,25 @@ public bool TestCatalogItem(string accountName, CatalogPathInstance path,
465465
public void CreateCredential(string accountName, string databaseName,
466466
string credentialName, string userId, string password, string hostUri)
467467
{
468+
/*
469+
* TODO: Uncomment this in the next release when credential CRUD is supported.
468470
_catalogClient.Catalog.CreateCredential(accountName, databaseName, credentialName,
469471
new DataLakeAnalyticsCatalogCredentialCreateParameters
470472
{
471473
Password = password,
472474
Uri = hostUri,
473475
UserId = userId
474476
});
477+
*/
478+
479+
throw new NotImplementedException();
475480
}
476481

477482
public void UpdateCredentialPassword(string accountName, string databaseName,
478483
string credentialName, string userId, string password, string newPassword, string hostUri)
479484
{
485+
/*
486+
* TODO: Uncomment this in the next release when credential CRUD is supported.
480487
_catalogClient.Catalog.UpdateCredential(accountName, databaseName, credentialName,
481488
new DataLakeAnalyticsCatalogCredentialUpdateParameters
482489
{
@@ -485,15 +492,22 @@ public void UpdateCredentialPassword(string accountName, string databaseName,
485492
Uri = hostUri,
486493
UserId = userId
487494
});
495+
*/
496+
throw new NotImplementedException();
488497
}
489498

490499
public void DeleteCredential(string accountName, string databaseName, string credentialName, string password = null)
491500
{
501+
/*
502+
* TODO: Uncomment this in the next release when credential CRUD is supported.
492503
_catalogClient.Catalog.DeleteCredential(accountName,
493504
databaseName,
494505
credentialName,
495506
string.IsNullOrEmpty(password) ? null : new DataLakeAnalyticsCatalogCredentialDeleteParameters(password));
507+
*/
508+
throw new NotImplementedException();
496509
}
510+
497511

498512
public IList<CatalogItem> GetCatalogItem(string accountName, CatalogPathInstance path,
499513
DataLakeAnalyticsEnums.CatalogItemType itemType)
@@ -554,9 +568,7 @@ public IList<CatalogItem> GetCatalogItem(string accountName, CatalogPathInstance
554568
case DataLakeAnalyticsEnums.CatalogItemType.Credential:
555569
if (isList)
556570
{
557-
throw new InvalidOperationException(Properties.Resources.InvalidUSqlSecretRequest);
558-
// TODO: re-enable when list credentials is supported.
559-
// toReturn.AddRange(GetCredentials(accountName, path.DatabaseName));
571+
toReturn.AddRange(GetCredentials(accountName, path.DatabaseName));
560572
}
561573
else
562574
{
@@ -745,8 +757,6 @@ private USqlCredential GetCredential(string accountName,
745757
credName);
746758
}
747759

748-
/*
749-
* TODO: re-enable support when list credentials is available.
750760
private IList<USqlCredential> GetCredentials(string accountName,
751761
string databaseName)
752762
{
@@ -761,7 +771,6 @@ private IList<USqlCredential> GetCredentials(string accountName,
761771

762772
return toReturn;
763773
}
764-
*/
765774

766775
private USqlSchema GetSchema(string accountName, string databaseName,
767776
string schemaName)

src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/ScenarioTests/AdlsAliasTests.ps1

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -318,40 +318,62 @@ function Test-DataLakeStoreFileSystemPermissions
318318
# Set and get all the permissions
319319
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
320320
Assert-NotNull $result "Did not get any result from ACL get"
321-
Assert-True {$result.UserAces.count -ge 0} "UserAces is negative or null"
322-
$currentCount = $result.UserAces.Count
323-
$result.UserAces.Add($aceUserId, "rwx")
321+
Assert-True {$result.Count -ge 0} "UserAces is negative or null"
322+
$currentCount = $result.Count
323+
$result.Add("user:$aceUserId`:rwx")
324+
$toRemove = $result[$result.Count -1]
325+
Assert-AreEqual $aceUserId $toRemove.Id
324326
Set-AdlStoreItemAcl -Account $accountName -path "/" -Acl $result
325327
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
326-
Assert-AreEqual $($currentCount+1) $result.UserACes.Count
327-
$result.UserAces.Remove($aceUserId)
328+
Assert-AreEqual $($currentCount+1) $result.Count
329+
$found = $false
330+
for($i = 0; $i -lt $result.Count; $i++)
331+
{
332+
if($result[$i].Id -like $aceUserId)
333+
{
334+
$found = $true
335+
$result.RemoveAt($i)
336+
break
337+
}
338+
}
339+
340+
Assert-True { $found } "Failed to remove the element: $($toRemove.Entry)"
328341
# remove the account
329342
Set-AdlStoreItemAcl -Account $accountName -path "/" -Acl $result
330343
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
331-
Assert-AreEqual $currentCount $result.UserAces.Count
344+
Assert-AreEqual $currentCount $result.Count
332345

333346
# Set and get a specific permission with friendly sets
334347
Set-AdlStoreItemAclEntry -Account $accountName -path "/" -AceType User -Id $aceUserId -Permissions All
335348
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
336-
Assert-AreEqual $($currentCount+1) $result.UserAces.Count
349+
Assert-AreEqual $($currentCount+1) $result.Count
337350
# remove a specific permission with friendly remove
338351
Remove-AdlStoreItemAclEntry -Account $accountName -path "/" -AceType User -Id $aceUserId
339352
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
340-
Assert-AreEqual $currentCount $result.UserAces.Count
353+
Assert-AreEqual $currentCount $result.Count
341354
# set and get a specific permission with the ACE string
342355
Set-AdlStoreItemAclEntry -Account $accountName -path "/" -Acl $([string]::Format("user:{0}:rwx", $aceUserId))
343356
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
344-
Assert-AreEqual $($currentCount+1) $result.UserAces.Count
357+
Assert-AreEqual $($currentCount+1) $result.Count
345358
# remove a specific permission with the ACE string
346359
Remove-AdlStoreItemAclEntry -Account $accountName -path "/" -Acl $([string]::Format("user:{0}:---", $aceUserId))
347360
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
348-
Assert-AreEqual $currentCount $result.UserAces.Count
361+
Assert-AreEqual $currentCount $result.Count
349362

350363
# verify that removal of full acl and default acl fail
351-
# NOTE: commenting these tests out as these cmdlets have been temporarily removed until
352-
# They are actually supported. This avoids confusion for our customers who might try to use them.
353-
# Assert-Throws {Remove-AdlStoreItemAcl -Account $accountName -Path "/" -Force }
354-
# Assert-Throws {Remove-AdlStoreItemAcl -Account $accountName -Path "/" -Force -Default }
364+
Remove-AdlStoreItemAcl -Account $accountName -Path "/" -Force -Default
365+
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
366+
Assert-AreEqual 4 $result.Count
367+
Remove-AdlStoreItemAcl -Account $accountName -Path "/" -Force
368+
$result = Get-AdlStoreItemAcl -Account $accountName -path "/"
369+
Assert-AreEqual 3 $result.Count
370+
371+
# validate permissions
372+
$permission = Get-AdlStoreItemPermission -Account $accountName -path "/"
373+
Assert-AreEqual 770 $permission
374+
Set-AdlStoreItemPermission -Account $accountName -path "/" -Permission 777 | Out-Null
375+
$permission = Get-AdlStoreItemPermission -Account $accountName -path "/"
376+
Assert-AreEqual 777 $permission
355377

356378
# Delete Data Lake account
357379
Assert-True {Remove-AdlStore -ResourceGroupName $resourceGroupName -Name $accountName -Force -PassThru} "Remove Account failed."

src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/ScenarioTests/AdlsTests.ps1

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -315,43 +315,64 @@ function Test-DataLakeStoreFileSystemPermissions
315315
# define the permissions to add/remove
316316
$aceUserId = "027c28d5-c91d-49f0-98c5-d10134b169b3"
317317

318-
# Set and get all the permissions
319318
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
320319
Assert-NotNull $result "Did not get any result from ACL get"
321320
Assert-True {$result.Count -ge 0} "UserAces is negative or null"
322321
$currentCount = $result.Count
323-
$result.Add($aceUserId, "rwx")
322+
$result.Add("user:$aceUserId`:rwx")
323+
$toRemove = $result[$result.Count -1]
324+
Assert-AreEqual $aceUserId $toRemove.Id
324325
Set-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/" -Acl $result
325326
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
326-
Assert-AreEqual $($currentCount+1) $result.Length
327-
$result.UserAces.Remove($aceUserId)
327+
Assert-AreEqual $($currentCount+1) $result.Count
328+
$found = $false
329+
for($i = 0; $i -lt $result.Count; $i++)
330+
{
331+
if($result[$i].Id -like $aceUserId)
332+
{
333+
$found = $true
334+
$result.RemoveAt($i)
335+
break
336+
}
337+
}
338+
339+
Assert-True { $found } "Failed to remove the element: $($toRemove.Entry)"
328340
# remove the account
329341
Set-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/" -Acl $result
330342
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
331-
Assert-AreEqual $currentCount $result.UserAces.Count
343+
Assert-AreEqual $currentCount $result.Count
332344

333345
# Set and get a specific permission with friendly sets
334-
Set-AzureRmDataLakeStoreItemAclEntry -Account $accountName -path "/" -AceType User -Id $aceUserId -Permissions All
346+
Set-AzureRMDataLakeStoreItemAclEntry -Account $accountName -path "/" -AceType User -Id $aceUserId -Permissions All
335347
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
336-
Assert-AreEqual $($currentCount+1) $result.UserAces.Count
348+
Assert-AreEqual $($currentCount+1) $result.Count
337349
# remove a specific permission with friendly remove
338-
Remove-AzureRmDataLakeStoreItemAclEntry -Account $accountName -path "/" -AceType User -Id $aceUserId
350+
Remove-AzureRMDataLakeStoreItemAclEntry -Account $accountName -path "/" -AceType User -Id $aceUserId
339351
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
340-
Assert-AreEqual $currentCount $result.UserAces.Count
352+
Assert-AreEqual $currentCount $result.Count
341353
# set and get a specific permission with the ACE string
342-
Set-AzureRmDataLakeStoreItemAclEntry -Account $accountName -path "/" -Acl $([string]::Format("user:{0}:rwx", $aceUserId))
354+
Set-AzureRMDataLakeStoreItemAclEntry -Account $accountName -path "/" -Acl $([string]::Format("user:{0}:rwx", $aceUserId))
343355
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
344-
Assert-AreEqual $($currentCount+1) $result.UserAces.Count
356+
Assert-AreEqual $($currentCount+1) $result.Count
345357
# remove a specific permission with the ACE string
346-
Remove-AzureRmDataLakeStoreItemAclEntry -Account $accountName -path "/" -Acl $([string]::Format("user:{0}:---", $aceUserId))
358+
Remove-AzureRMDataLakeStoreItemAclEntry -Account $accountName -path "/" -Acl $([string]::Format("user:{0}:---", $aceUserId))
347359
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
348-
Assert-AreEqual $currentCount $result.UserAces.Count
360+
Assert-AreEqual $currentCount $result.Count
349361

350362
# verify that removal of full acl and default acl fail
351-
# NOTE: commenting these tests out as these cmdlets have been temporarily removed until
352-
# They are actually supported. This avoids confusion for our customers who might try to use them.
353-
# Assert-Throws {Remove-AzureRmDataLakeStoreItemAcl -Account $accountName -Path "/" -Force }
354-
# Assert-Throws {Remove-AzureRmDataLakeStoreItemAcl -Account $accountName -Path "/" -Force -Default }
363+
Remove-AzureRMDataLakeStoreItemAcl -Account $accountName -Path "/" -Force -Default
364+
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
365+
Assert-AreEqual 4 $result.Count
366+
Remove-AzureRMDataLakeStoreItemAcl -Account $accountName -Path "/" -Force
367+
$result = Get-AzureRMDataLakeStoreItemAcl -Account $accountName -path "/"
368+
Assert-AreEqual 3 $result.Count
369+
370+
# validate permissions
371+
$permission = Get-AzureRMDataLakeStoreItemPermission -Account $accountName -path "/"
372+
Assert-AreEqual 770 $permission
373+
Set-AzureRMDataLakeStoreItemPermission -Account $accountName -path "/" -Permission 777 | Out-Null
374+
$permission = Get-AzureRMDataLakeStoreItemPermission -Account $accountName -path "/"
375+
Assert-AreEqual 777 $permission
355376

356377
# Delete Data Lake account
357378
Assert-True {Remove-AzureRmDataLakeStoreAccount -ResourceGroupName $resourceGroupName -Name $accountName -Force -PassThru} "Remove Account failed."

0 commit comments

Comments
 (0)