Closed xiangce closed 3 years ago
Hey @xiangce we can change the SerializedRawOutputProvider
in the deserializer to a SerializedOutputProvider
.
The raw providers exist in case we ever need to collect binary data instead of text. I defaulted datasource providers to raw binary since it was most general, but we really need datasource
functions to be able to return different objects for text and raw bytes.
Tested with mocked cloud_cfg
. Results before change:
$ insights cat insights.specs.Specs.cloud_cfg insights-devboxseven-20210323173222.tar.gz
SerializedRawOutputProvider("'/tmp/insights-9yjamkj8/insights-devboxseven-20210323173222/data/etc/cloud/cloud.cfg'")
After change:
$ insights cat insights.specs.Specs.cloud_cfg insights-devboxseven-20210323173222.tar.gz
SerializedOutputProvider("'/tmp/insights-g2h3aonk/insights-devboxseven-20210323173222/data/etc/cloud/cloud.cfg'")
{"version": 1, "config": [{"subnets": [{"type": "dhcp"}, {"type": "dhcp6"}], "type": "physical", "name": "eth0"}]}
$ insights inspect insights.specs.Specs.cloud_cfg insights-devboxseven-20210323173222.tar.gz
IPython Console Usage Info:
Enter 'cloud_cfg.' and tab to get a list of properties
Example:
In [1]: cloud_cfg.<property_name>
Out[1]: <property value>
To exit ipython enter 'exit' and hit enter or use 'CTL D'
Starting IPython Interpreter Now
In [1]: type(cloud_cfg)
Out[1]: insights.core.spec_factory.SerializedOutputProvider
In [2]: type(cloud_cfg.content)
Out[2]: list
In [3]: cloud_cfg.content
Out[3]: ['{"version": 1, "config": [{"subnets": [{"type": "dhcp"}, {"type": "dhcp6"}], "type": "physical", "name": "eth0"}]}']
Original Exception raised by the parser
Collected
meta_data
:The content:
I'm unsure if it's OK to modify the load method to read the file to a list directly:
@csams , @bfahr - would you please have a look?