Skip to content

Commit

Permalink
HDDS-1900. Remove UpdateBucket handler which supports add/remove Acl. (
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatviswa504 committed Aug 8, 2019
1 parent ab6a5c9 commit 70b4617
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 167 deletions.
18 changes: 0 additions & 18 deletions hadoop-hdds/docs/content/shell/BucketCommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Ozone shell supports the following bucket commands.
* [delete](#delete)
* [info](#info)
* [list](#list)
* [update](#update)

### Create

Expand Down Expand Up @@ -98,23 +97,6 @@ This command will list all buckets on the volume _hive_.



### Update

The bucket update command allows changing access permissions on bucket.

***Params:***

| Arguments | Comment |
|--------------------------------|-----------------------------------------|
| --addAcl | Optional, Comma separated ACLs that will added to bucket.
| --removeAcl | Optional, Comma separated list of acl to remove.
| Uri | The name of the bucket.

{{< highlight bash >}}
ozone sh bucket update --addAcl=user:bilbo:rw /hive/jan
{{< /highlight >}}

The above command gives user bilbo read/write permission to the bucket.

### path
The bucket command to provide ozone mapping for s3 bucket (Created via aws cli)
Expand Down
4 changes: 0 additions & 4 deletions hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ Test ozone shell
Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1
${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .storageType'
Should Be Equal ${result} DISK
${result} = Execute ozone sh bucket update ${protocol}${server}/${volume}/bb1 --addAcl user:frodo:rw,group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="samwise") | .type'
Should Be Equal ${result} GROUP
${result} = Execute ozone sh bucket update ${protocol}${server}/${volume}/bb1 --removeAcl group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="frodo") | .type'
Should Be Equal ${result} USER
${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.bucketName=="bb1") | .volumeName'
Should Be Equal ${result} ${volume}
Run Keyword Test key handling ${protocol} ${server} ${volume}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.apache.hadoop.hdds.tracing.StringCodec;
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.hadoop.ozone.OzoneAcl;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.client.OzoneBucket;
import org.apache.hadoop.ozone.client.OzoneKey;
Expand All @@ -57,8 +56,6 @@
import org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes;
import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServicePort;
import org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLIdentityType;
import org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLType;
import org.apache.hadoop.ozone.web.ozShell.OzoneShell;
import org.apache.hadoop.ozone.web.ozShell.Shell;
import org.apache.hadoop.ozone.web.request.OzoneQuota;
Expand Down Expand Up @@ -723,51 +720,6 @@ public void testInfoBucket() throws Exception {
ResultCodes.BUCKET_NOT_FOUND);
}

@Test
public void testUpdateBucket() throws Exception {
LOG.info("Running testUpdateBucket");
OzoneVolume vol = creatVolume();
String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
vol.createBucket(bucketName);
OzoneBucket bucket = vol.getBucket(bucketName);
int aclSize = bucket.getAcls().size();

String[] args = new String[] {"bucket", "update",
url + "/" + vol.getName() + "/" + bucketName, "--addAcl",
"user:frodo:rw,group:samwise:r"};
execute(shell, args);
String output = out.toString();
assertTrue(output.contains("createdOn")
&& output.contains(OzoneConsts.OZONE_TIME_ZONE));

bucket = vol.getBucket(bucketName);
assertEquals(2 + aclSize, bucket.getAcls().size());

OzoneAcl acl = bucket.getAcls().get(aclSize);
assertTrue(acl.getName().equals("frodo")
&& acl.getType() == ACLIdentityType.USER
&& acl.getAclBitSet().get(ACLType.READ.ordinal())
&& acl.getAclBitSet().get(ACLType.WRITE.ordinal()));

args = new String[] {"bucket", "update",
url + "/" + vol.getName() + "/" + bucketName, "--removeAcl",
"user:frodo:rw"};
execute(shell, args);

bucket = vol.getBucket(bucketName);
acl = bucket.getAcls().get(aclSize);
assertEquals(1 + aclSize, bucket.getAcls().size());
assertTrue(acl.getName().equals("samwise")
&& acl.getType() == ACLIdentityType.GROUP
&& acl.getAclBitSet().get(ACLType.READ.ordinal()));

// test update bucket for a non-exist bucket
args = new String[] {"bucket", "update",
url + "/" + vol.getName() + "/invalid-bucket", "--addAcl",
"user:frodo:rw"};
executeWithError(shell, args, BUCKET_NOT_FOUND);
}

@Test
public void testListBucket() throws Exception {
LOG.info("Running testListBucket");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
InfoBucketHandler.class,
ListBucketHandler.class,
CreateBucketHandler.class,
UpdateBucketHandler.class,
DeleteBucketHandler.class,
AddAclBucketHandler.class,
RemoveAclBucketHandler.class,
Expand Down

This file was deleted.

0 comments on commit 70b4617

Please sign in to comment.