When a qualified resource name is used in omc get, the <resourceType> variable is used to set a value in the vars.GetArgs object here. The code here uses the value of <resourceNamePlural>.<resourceGroup> to retrieve this value. A mismatch between the values of <resourceType> and <resourceNamePlural>.<resourceGroup> would cause the described bug in https://github.com/gmeghnag/omc/issues/154.
The resourceType variable is populated directly from the command line. Therefore, this mismatch will occur if the shortname or singular resource name is used as part of the qualified resource name.
For example with the MachineConfigPool resource,
Command
Result
omc get mcp.machineconfiguration.openshift.io master
❌
omc get machineconfigpool.machineconfiguration.openshift.io master
❌
omc get machineconfigpools.machineconfiguration.openshift.io master
✅
This PR fixes this bug by using <resourceNamePlural>.<resourceGroup> to populate the vars.GetArgs argument where a resource with a specific name needs to be retrieved. This is for both theomc get <resource>/<name> and omc get <resource> <name> forms of retrieving a resource.
When a qualified resource name is used in
omc get
, the<resourceType>
variable is used to set a value in thevars.GetArgs
object here. The code here uses the value of<resourceNamePlural>.<resourceGroup>
to retrieve this value. A mismatch between the values of<resourceType>
and<resourceNamePlural>.<resourceGroup>
would cause the described bug in https://github.com/gmeghnag/omc/issues/154.The resourceType variable is populated directly from the command line. Therefore, this mismatch will occur if the shortname or singular resource name is used as part of the qualified resource name.
This PR fixes this bug by using
<resourceNamePlural>.<resourceGroup>
to populate the vars.GetArgs argument where a resource with a specific name needs to be retrieved. This is for both theomc get <resource>/<name>
andomc get <resource> <name>
forms of retrieving a resource.