rel-eng/packages/spacecmd | 2 +-
spacecmd/spacecmd.spec | 6 +++++-
spacecmd/src/lib/utils.py | 9 ++++++---
3 files changed, 12 insertions(+), 5 deletions(-)
New commits:
commit e2d83a06c82924faa9b30d017556ec5c3c57dfb5
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Sat Apr 14 19:33:37 2012 -0400
Automatic commit of package [spacecmd] release [1.8.4-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index 308f552..f4b3713 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-1.8.3-1 spacecmd/
+1.8.4-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index dbdf696..3fc967b 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 1.8.3
+Version: 1.8.4
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -61,6 +61,10 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Sat Apr 14 2012 Aron Parsons <aronparsons(a)gmail.com> 1.8.4-1
+- spacecmd: pretty-print JSON output
+- spacecmd: cosmetics
+
* Thu Apr 05 2012 Stephen Herr <sherr(a)redhat.com> 1.8.3-1
- 809905 - add option to allow templating for spacecmd kickstarting
(sherr(a)redhat.com)
commit b75c6fa85f7fb417b4b8e60eeb2bb27da6f72840
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Sat Apr 14 19:25:47 2012 -0400
spacecmd: pretty-print JSON output
diff --git a/spacecmd/src/lib/utils.py b/spacecmd/src/lib/utils.py
index 93fc1b5..628d9f2 100644
--- a/spacecmd/src/lib/utils.py
+++ b/spacecmd/src/lib/utils.py
@@ -596,12 +596,12 @@ def parse_api_args(args, sep=','):
return ret
-def json_dump(obj, fp, indent=2, **kwargs):
+def json_dump(obj, fp, indent = 4, **kwargs):
json.dump(obj, fp, ensure_ascii=False, indent=indent, **kwargs)
-def json_dump_to_file(obj, filename, indent = 2):
- json_data = json.dumps(obj, indent)
+def json_dump_to_file(obj, filename):
+ json_data = json.dumps(obj, indent = 4, sort_keys = True)
if json_data == None:
logging.error("Could not generate json data object!" % k)
commit 996d5e797b424e2b2da4ea854abebdd4c9030cf4
Author: Aron Parsons <aronparsons(a)gmail.com>
Date: Sat Apr 14 19:19:34 2012 -0400
spacecmd: cosmetics
diff --git a/spacecmd/src/lib/utils.py b/spacecmd/src/lib/utils.py
index 66ec32c..93fc1b5 100644
--- a/spacecmd/src/lib/utils.py
+++ b/spacecmd/src/lib/utils.py
@@ -599,12 +599,14 @@ def parse_api_args(args, sep=','):
def json_dump(obj, fp, indent=2, **kwargs):
json.dump(obj, fp, ensure_ascii=False, indent=indent, **kwargs)
-def json_dump_to_file(obj, filename, indent = 2):
+def json_dump_to_file(obj, filename, indent = 2):
json_data = json.dumps(obj, indent)
+
if json_data == None:
logging.error("Could not generate json data object!" % k)
return False
+
try:
fd = open(filename, 'w')
fd.write(json_data)
@@ -617,6 +619,7 @@ def json_dump_to_file(obj, filename, indent = 2):
return True
+
def json_read_from_file(filename):
try:
data = open(filename).read()