Knife node show json format squished


#1

Recently the node output I see went from a nice “fully-expanded” view of the
json to the json being not expanded, being “squished”… for lack of better
phrasing.

Does anyone happen to know what happened, or how to get the output back to
fully-expanded?

$ knife node show db01.stg.cherryporkleftovers.com -Fj -l
{
“name”: “db01.stg.cherryporkleftovers.com”,
“chef_environment”: “staging1”,
“run_list”: [“role[base]”,“role[database]”],
“normal”: {“repo”:{“epel”:{“key”:“RPM-GPG-KEY-EPEL-6”},“percona”:{“key”:“RPM-GPG-KEY-percona”},“centos”:{“key”:“RPM-GPG-KEY-CentOS-5”,…snip-the-squish
"default": {“s3cmd”:{“users”:[“root”],“userlist”:[“foo”,“baz”]},“boundary”:{“bprobe”:…snip-the-squish
snip

I’m not exactly sure what changed in my dev environment, and when it did.
FWIW I did try downgrading my chef 10.26.0 to 10.24.0 within my rvm, but that
changed nothing.

06/12 17:34[zahadum chefdev] which ruby /home/kallen/.rvm/rubies/ruby-1.9.3-p429/bin/ruby 06/12 18:33[zahadum chefdev] gem list chef

*** LOCAL GEMS ***

chef (10.26.0, 10.24.0)


#2

me too! I’ve noticed this recently too. I’m not really sure when it
started happening, so I can’t really offer any details that would be
helpful. I’d love to hear if you find a solution.

-bash-3.2# which ruby
/usr/local/bin/ruby
-bash-3.2# ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
-bash-3.2# gem list chef

*** LOCAL GEMS ***

chef (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-expander (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-server (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-server-api (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-server-webui (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4,
0.10.0)
chef-solr (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)

Yes, yes, I know. I should clean these old gems up. :slight_smile:

John

On Wed, Jun 12, 2013 at 8:35 PM, kallen@groknaut.net wrote:

Recently the node output I see went from a nice “fully-expanded” view of
the
json to the json being not expanded, being “squished”… for lack of better
phrasing.

Does anyone happen to know what happened, or how to get the output back to
fully-expanded?

$ knife node show db01.stg.cherryporkleftovers.com -Fj -l
{
“name”: “db01.stg.cherryporkleftovers.com”,
“chef_environment”: “staging1”,
“run_list”: [“role[base]”,“role[database]”],
“normal”:
{“repo”:{“epel”:{“key”:“RPM-GPG-KEY-EPEL-6”},“percona”:{“key”:“RPM-GPG-KEY-percona”},“centos”:{“key”:“RPM-GPG-KEY-CentOS-5”,…snip-the-squish
"default":
{“s3cmd”:{“users”:[“root”],“userlist”:[“foo”,“baz”]},“boundary”:{“bprobe”:…snip-the-squish
snip

I’m not exactly sure what changed in my dev environment, and when it did.
FWIW I did try downgrading my chef 10.26.0 to 10.24.0 within my rvm, but
that
changed nothing.

06/12 17:34[zahadum chefdev] which ruby /home/kallen/.rvm/rubies/ruby-1.9.3-p429/bin/ruby 06/12 18:33[zahadum chefdev] gem list chef

*** LOCAL GEMS ***

chef (10.26.0, 10.24.0)


John Alberts


#3

On Wednesday, June 12, 2013 at 8:28 PM, John Alberts wrote:

me too! I’ve noticed this recently too. I’m not really sure when it started happening, so I can’t really offer any details that would be helpful. I’d love to hear if you find a solution.

-bash-3.2# which ruby
/usr/local/bin/ruby
-bash-3.2# ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
-bash-3.2# gem list chef

*** LOCAL GEMS ***

chef (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-expander (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-server (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-server-api (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-server-webui (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)
chef-solr (10.26.0, 10.24.4, 10.18.0, 10.16.2, 0.10.8, 0.10.4, 0.10.0)

Yes, yes, I know. I should clean these old gems up. :slight_smile:

John

On Wed, Jun 12, 2013 at 8:35 PM, <kallen@groknaut.net (mailto:kallen@groknaut.net)> wrote:

Recently the node output I see went from a nice “fully-expanded” view of the
json to the json being not expanded, being “squished”… for lack of better
phrasing.

Does anyone happen to know what happened, or how to get the output back to
fully-expanded?

I can’t think of any changes to the relevant code in Chef recently that would cause this. The code path is:

Knife uses a presenter object to convert your data to a string: https://github.com/opscode/chef/blob/master/lib/chef/knife/core/generic_presenter.rb#L81

Chef adds some options for nesting levels, then calls JSON.pretty_generate https://github.com/opscode/chef/blob/master/lib/chef/json_compat.rb#L105

I have 11.4.2 installed locally and it’s correctly “pretty printing” the json, so there must be something different in your setup.


Daniel DeLeo


#4

On 6/12/13 8:28 PM, John Alberts wrote:

me too! I’ve noticed this recently too. I’m not really sure when it
started happening, so I can’t really offer any details that would be
helpful. I’d love to hear if you find a solution.

One possibility is that you are using a plugin that loads a gem which is
monkey-patching some core class, thus affecting the pretty-printing.

Are you using any custom/non-opscode plugin?

Sincerely,

Steven


Steven Danna
Systems Engineer, Opscode, Inc
GPG Key: http://stevendanna.github.com/downloads/code/public.key


#5

On Thu, 13 Jun 2013, Steven Danna wrote:

On 6/12/13 8:28 PM, John Alberts wrote:

me too! I’ve noticed this recently too. I’m not really sure when it
started happening, so I can’t really offer any details that would be
helpful. I’d love to hear if you find a solution.

One possibility is that you are using a plugin that loads a gem which is
monkey-patching some core class, thus affecting the pretty-printing.

Are you using any custom/non-opscode plugin?

Sincerely,

Steven

For the most part, I had been using rvm ruby 1.9.2. Recently I installed
ruby 1.9.3 via rvm. I just tested this in my 1.9.2, and the json pretty
print is as I like it, unsquished:

$ which ruby
~/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

$ gem list chef

*** LOCAL GEMS ***

chef (10.24.0, 10.16.2)

Wrt custom/non-opscode knife plugins, for good measure, I moved aside my
~/.chef/plugins dir, reran ruby 1.9.3 test, and still got squished json.

kallen


#6

We are seeing this at my work also with the omnibus install.

On Thu, Jun 13, 2013 at 11:19 AM, null kallen@groknaut.net wrote:

On Thu, 13 Jun 2013, Steven Danna wrote:

On 6/12/13 8:28 PM, John Alberts wrote:

me too! I’ve noticed this recently too. I’m not really sure when it
started happening, so I can’t really offer any details that would be
helpful. I’d love to hear if you find a solution.

One possibility is that you are using a plugin that loads a gem which is
monkey-patching some core class, thus affecting the pretty-printing.

Are you using any custom/non-opscode plugin?

Sincerely,

Steven
For the most part, I had been using rvm ruby 1.9.2. Recently I installed
ruby 1.9.3 via rvm. I just tested this in my 1.9.2, and the json pretty
print is as I like it, unsquished:
which ruby ~/.rvm/rubies/ruby-1.9.2-p290/bin/ruby gem list chef
*** LOCAL GEMS ***
chef (10.24.0, 10.16.2)
Wrt custom/non-opscode knife plugins, for good measure, I moved aside my
~/.chef/plugins dir, reran ruby 1.9.3 test, and still got squished json.
kallen


#7

Squish is due to this problem with knife-spork:

If I remove the knife-spork gem/plugin, my json output is pretty again.

kallen

On Thu, 13 Jun 2013, Joshua Miller wrote:

We are seeing this at my work also with the omnibus install.
???

On Thu, Jun 13, 2013 at 11:19 AM, null kallen@groknaut.net wrote:

On Thu, 13 Jun 2013, Steven Danna wrote:

On 6/12/13 8:28 PM, John Alberts wrote:

me too! I’ve noticed this recently too. I’m not really sure when it
started happening, so I can’t really offer any details that would be
helpful. I’d love to hear if you find a solution.

One possibility is that you are using a plugin that loads a gem which is
monkey-patching some core class, thus affecting the pretty-printing.

Are you using any custom/non-opscode plugin?

Sincerely,

Steven
For the most part, I had been using rvm ruby 1.9.2. Recently I installed
ruby 1.9.3 via rvm. I just tested this in my 1.9.2, and the json pretty
print is as I like it, unsquished:
which ruby ~/.rvm/rubies/ruby-1.9.2-p290/bin/ruby gem list chef
*** LOCAL GEMS ***
chef (10.24.0, 10.16.2)
Wrt custom/non-opscode knife plugins, for good measure, I moved aside my
~/.chef/plugins dir, reran ruby 1.9.3 test, and still got squished json.
kallen


#8

I don’t have knife-spork installed but I also see this issue. Strange.

  • Julian

On Mon, Jul 8, 2013 at 8:38 PM, kallen@groknaut.net wrote:

Squish is due to this problem with knife-spork:
https://github.com/jonlives/knife-spork/issues/66

If I remove the knife-spork gem/plugin, my json output is pretty again.

kallen