foreman_ansible
foreman_ansible copied to clipboard
Fixes #37417 - OverriddenAnsibleVariablePresenter GraphQL scheme incorrect for hidden_value and override
In the model AnsibleVariable, there is hidden_value, which returns "*****" and there is hidden_value**?**, which returns a boolean. For GraphQL, the method name must be the same as the value entered in the gql-query. By delegating hidden_value**?**, the original author effectively named the gql-field "hidden_value?", which is not allowed and was therefore not working. The same applies to override.
This is fixed by wrapping the value of hidden_value**?** in a new method hidden_value in the presenter.
Required by #717
@stejskalleos can you please review this?
I'm unclear on what exactly isn't working and what we're trying to fix with these changes. Additionally, I'm not sure where the new methods are being used.
In the AnsibleVariable model, hidden_value returns a series of asterisks, while hidden_value? returns a boolean. The author's intention was to delegate hidden_value?, but this led to an illegal field name "hidden_value?" in the GraphQL query. Similarly, override? faced the same issue. This has been rectified by wrapping hidden_value? in a new method named hidden_value within the presenter.
In the AnsibleVariable model, hidden_value returns a series of asterisks, while hidden_value? returns a boolean. The author's intention was to delegate hidden_value?, but this led to an illegal field name "hidden_value?" in the GraphQL query. Similarly, override? faced the same issue. This has been rectified by wrapping hidden_value? in a new method named hidden_value within the presenter.
The override
and hidden_value
fields are defined in the AnsibleVariable
type, while the OverridenAnsibleVariablePresenter
acts as a bridge between the raw Ansible variable data and the GraphQL API, ensuring that values are properly resolved and presented to the client. However, in the current version of the hostVariableOverrides
query, neither override
nor hidden_value
are included. The exclusion of override
seems intentional due to its straightforward nature, but the hidden_value
field could be incorporated into the query with the correct logic.
You're right, right now neither hidden_value
nor override
is queried. This PR is a prerequisite to #717, which needs the hidden_value
field via the gql-query.
I should have linked those bi-directionally...