Closed mattock closed 1 year ago
I think the userdata looks wonky because it is gzipped (see here). I can experiment with "gzip = false" and see if that makes things better. Even if it does, I think facter might handle gzipped content more gracefully by decrypting it on the fly. I fail to see how having a binary blob as a fact could be useful without further processing (e.g. passing it directly to a decompression function).
I think the userdata looks wonky because it is gzipped (see here). I can experiment with "gzip = false" and see if that makes things better. Even if it does, I think facter might handle gzipped content more gracefully by decrypting it on the fly. I fail to see how having a binary blob as a fact could be useful without further processing (e.g. passing it directly to a decompression function).
I tested disabling of gzipping of user-data and the problem went away. So the binary data is definitely to blame here.
This issue has not had activity for 60 days and will be marked as stale. If this issue continues to have no activity for 7 days, it will be closed.
Ping. I don't think this issue has just disappeared magically.
This issue has not had activity for 60 days and will be marked as stale. If this issue continues to have no activity for 7 days, it will be closed.
This issue is stale and has been closed. If you believe this is in error, or would like the Bolt team to reconsider it, please reopen the issue.
Describe the Bug
EC2 userdata as seen by facter can be in binary format. Facter itself seems to be ok with it, but Puppet Bolt - in particular the _tojson fact in _customfacts.rb - chokes on it with a very unhelpful error message. This makes it impossible to apply Puppet code on such nodes.
Here's a partial sample ec2_userdata fact. The userdata was created by terraform-aws_instance_wrapper:
I can fully understand why a JSON parser would fail on this garbage, but I'm sure that such userdata can be found elsewhere in the wild.
Expected Behavior
Having binary data in ec2_userdata fact should not break _customfacts.rb.
Steps to Reproduce
Create a simple manifest such as this:
Try to apply this on an EC2 instance whose ec2_userdata fact includes binary data:
This will fail:
The failure happens when facts are converted into json in _customfacts.rb:
The ec2_userdata fact is the culprit, because making it an empty string works around the problem:
With the workaround apply works as expected:
Environment