Commits

Miki Tebeka  committed 08f3c9c

chwon

  • Participants
  • Parent commits 7556b86

Comments (0)

Files changed (2)

 # print(conn.checksum(remote))
 # print('home')
 # print(conn.home())
-print('chmod')
-conn.chmod(0o777, remote)
+# print('chmod')
+# conn.chmod(0o777, remote)
 # print('chown')
 # conn.chown('cloudera', remote)
 # print('open')
 # print(conn.mkdir('/tmp/zolo'))
 # print('rename')
 # print(conn.rename(remote, '/tmp/8z'))
-print('delete')
-print(conn.delete('/tmp/8z'))
+# print('delete')
+# print(conn.delete('/tmp/8z'))

File webhdfs/__main__.py

 def chmod(args):
     fs.chmod(args.mode, args.path)
 
+def chown(args):
+    if not (args.user or args.group):
+        raise WebHDFSError('need either user or group')
+    fs.chown(args.path, args.user, args.group)
+
 def main(argv=None):
     global fs
     import sys
     chmod_parser.add_argument('path')
     chmod_parser.set_defaults(func=chmod)
 
+    chown_parser = subs.add_parser('chown')
+    chown_parser.add_argument('path')
+    chown_parser.add_argument('-u', '--user', help='user')
+    chown_parser.add_argument('-g', '--group', help='group')
+    chown_parser.set_defaults(func=chown)
+
 
     args = parser.parse_args(argv[1:])