Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3A090200CF6 for ; Mon, 4 Sep 2017 06:26:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 389AB163E23; Mon, 4 Sep 2017 04:26:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7F428163E22 for ; Mon, 4 Sep 2017 06:26:12 +0200 (CEST) Received: (qmail 55775 invoked by uid 500); 4 Sep 2017 04:26:11 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 55752 invoked by uid 99); 4 Sep 2017 04:26:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Sep 2017 04:26:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A929A180C9D for ; Mon, 4 Sep 2017 04:26:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 5cSKuOV79VGR for ; Mon, 4 Sep 2017 04:26:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D328B5F242 for ; Mon, 4 Sep 2017 04:26:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 94FB7E00A9 for ; Mon, 4 Sep 2017 04:26:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 69F9723F0D for ; Mon, 4 Sep 2017 04:26:00 +0000 (UTC) Date: Mon, 4 Sep 2017 04:26:00 +0000 (UTC) From: "Weiwei Yang (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-12389) Ozone: oz commandline list calls should return valid JSON format output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 04 Sep 2017 04:26:13 -0000 [ https://issues.apache.org/jira/browse/HDFS-12389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16152110#comment-16152110 ] Weiwei Yang commented on HDFS-12389: ------------------------------------ Following code to parse output {code} with open('keys.json') as data_file: data = json.load(data_file) for key in data: for attribute, value in key.iteritems(): print attribute, value {code} it fails with error {noformat} Traceback (most recent call last): File "testkeys.py", line 4, in data = json.load(data_file) File "/usr/lib64/python2.7/json/__init__.py", line 290, in load **kw) File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/usr/lib64/python2.7/json/decoder.py", line 369, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 9 column 1 - line 17 column 1 (char 186 - 372) {noformat} > Ozone: oz commandline list calls should return valid JSON format output > ----------------------------------------------------------------------- > > Key: HDFS-12389 > URL: https://issues.apache.org/jira/browse/HDFS-12389 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: ozone > Affects Versions: HDFS-7240 > Reporter: Weiwei Yang > Assignee: Weiwei Yang > > At present the outputs of {{listVolume}}, {{listBucket}} and {{listKey}} are hard to parse, for example following call > {code} > ./bin/hdfs oz -listVolume http://localhost:9864 -user wwei > {code} > lists all volumes in my cluster and it returns > {noformat} > { > "version" : 0, > "md5hash" : null, > "createdOn" : "Mon, 04 Sep 2017 03:25:22 GMT", > "modifiedOn" : "Mon, 04 Sep 2017 03:25:22 GMT", > "size" : 10240, > "keyName" : "key-0-22381", > "dataFileName" : null > } > { > "version" : 0, > "md5hash" : null, > "createdOn" : "Mon, 04 Sep 2017 03:25:22 GMT", > "modifiedOn" : "Mon, 04 Sep 2017 03:25:22 GMT", > "size" : 10240, > "keyName" : "key-0-22381", > "dataFileName" : null > } > ... > {noformat} > this is not a valid JSON format output hence it is hard to parse in clients' script for further interactions. Propose to reformat them to valid JSON data. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org