Open Cameronwyatt opened 5 years ago
This is unfortunately difficult to do, because of the many ways that subscription-manager can be used. The underlying ansible module for this task is redhat_subscription
, and I'm specifically nervous about adding assertions or checks to this role that are more strict than the underlying module itself is. If fields are going to be required, they should be required by the module, not this role, so this should probably be an issue filed against Ansible itself.
In this case, though, I think the problem is not with this role itself (it correctly does nothing when there's nothing to do based on the values of e.g. rhsm_unsubscribe
, rhsm_username
, and rhsm_org_id
), but with the implementation of it in this case. I believe that what's happened is an empty string was passed for rhsm_server_hostname
. I don't know if this is a valid invocation of subscription-manager that should be allowed by the redhat_subscription
module or not, so I don't feel comfortable at this point adding logic to prevent it, or errors like it, to either this role or the underlying module.
It might be worth at least contacting the upstream maintainer to ask them that question about empty-string hostname. I can't imagine that it should be supported.
I took a closer look at this today, and I think the role's already doing everything it can reasonably do here. I like the idea of asking the maintainer about the empty hostname being supported, and I think I'll just ask the question in the form of a pull request adding validation to prevent it.
If you run the RHSM role without passing in required fields, it will hang, seemingly waiting for user input