nailgun
nailgun copied to clipboard
What to do about Hash's?
I am adding support for VirtWhoConfig in #540 and #541 and am wondering what the best way to handle the foreman_virt_who_configure_config
Hash that the Config API requires. Unfortunately there doesn't seem to be any public posting of the api docs, but if you have a satellite its at sat.example.com/apidoc/v2/configs/update.html
Right now in order to handle it I have to override create_payload
, update_payload
, and possible others.
I was wondering if there was a potential here to add something to nail gun that would better handle hashs (since a lot of other entities seem to use them). Dict
seams to be the closest, but I was thinking we would want it to be something that would have other Fields
as values and be able to handle those specially (ie create_missing, etc).
Do people see where I am going with this, I am working on an example and I will try to post it.
Adding @SatelliteQE/robottelo-automation in case I missed anyone in the assignees.
@pgagne
I'd say we'd want to update the create_raw
method to allow customization,
so instead of directly sending the result of create_payload()
method,
we should be able to pass a custom payload.
In your case it would be something like
"{{
'foreman_virt_who_configure_config': {0}
}}".format(create_payload())
as you need to nest the 'original' json payload as a value for virt_who_config
key