parsejson truncating output (i think)

36 views
Skip to first unread message

Allen Myers

unread,
May 6, 2015, 3:47:10 PM5/6/15
to puppet...@googlegroups.com
Hi,

I've got the following statements in my manifest:

$myusers_json = generate ('/bin/sh', '-c', '/path/to/my/script.sh')
notice ($myusers_json)
$myusers = parsejson ($myusers_json)
notice ($myusers)

My script generates a list of users in JSON and I've verified that the output format from 'notice ($myusers_json)' is correct using jsonlint.com.
However, the output of 'notice ($myusers)' is always limited to 1985 bytes. It's just truncating the output. I know it's not just a short-coming
of the 'notice' function because when I call

create_resources(user, $myusers)

if fails with the error 

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: expected ',' or '}' in object at '"user1" : {  "'! at /etc/puppet/environments/mgmt/manifests/01-all-nodes.pp:24 on node pupper-server1

If I modify script.sh so that the result is less than a certain length (depends on the number of fields and how many ':' get converted to '=>'), it
works just fine. But the final output in puppet has format is being limited to 1985 bytes.

Any fix or work-around for this?

Thanks!

- Allen

Allen Myers

unread,
May 7, 2015, 2:33:57 PM5/7/15
to puppet...@googlegroups.com
No one has replied yet, but just to fill in the environment details:

server: Linux ip-X-X-X-X 3.14.35-28.38.amzn1.x86_64 #1 SMP Wed Mar 11 22:50:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
puppet:    puppet --version 3.7.4   (open source)

thanks!

- Allen

Allen Myers

unread,
May 7, 2015, 2:45:30 PM5/7/15
to puppet...@googlegroups.com
and one more piece of info: The puppet server is configured using Passenger+apache. When I run

puppet agent --test

on a client system, parsejson fails by truncating the hash output.

But if I just run 'puppet apply ...' on the puppet server, as in

puppet apply create-users.pp

which contains

$myusers = parsejson (generate ('/bin/sh', '-c', '/var/lib/puppet/lib/create-user-hash.sh'))
notice ($myusers)
 
it works perfectly.

- Allen 
 

On Wednesday, May 6, 2015 at 12:47:10 PM UTC-7, Allen Myers wrote:

Allen Myers

unread,
May 7, 2015, 6:07:31 PM5/7/15
to puppet...@googlegroups.com
well, nevermind. It's now today, and I've not changed the server, the client, the shell script, nor the manifest, yet it's
magically working today!

my blind trust in the reliability of computers and software has been shattered. I'll never
be the same again..... ;^)

- Allen
Reply all
Reply to author
Forward
0 new messages