Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-36183

'oc adm prune renderedmachineconfigs' dry-run wording

XMLWordPrintable

    • Moderate
    • None
    • False
    • Hide

      None

      Show
      None
    • N/A
    • Release Note Not Required
    • Done

      Description of problem:

      The new-in-4.16 oc adm prune renderedmachineconfigs is dry-run by default. But as of 4.16.0-rc.9, the wording can be a bit alarming:

      $ oc adm prune renderedmachineconfigs
      Dry run enabled - no modifications will be made. Add --confirm to remove rendered machine configs.
      Error deleting rendered MachineConfig rendered-master-3fff60688940de967f8aa44e5aa0e87e: deleting rendered MachineConfig rendered-master-3fff60688940de967f8aa44e5aa0e87e failed: machineconfigs.machineconfiguration.openshift.io "rendered-master-3fff60688940de967f8aa44e5aa0e87e" is forbidden: User "wking" cannot delete resource "machineconfigs" in API group "machineconfiguration.openshift.io" at the cluster scope 
      Error deleting rendered MachineConfig rendered-master-c4d5b90a040ed6026ccc5af8838f7031: deleting rendered MachineConfig rendered-master-c4d5b90a040ed6026ccc5af8838f7031 failed: machineconfigs.machineconfiguration.openshift.io "rendered-master-c4d5b90a040ed6026ccc5af8838f7031" is forbidden: User "wking" cannot delete resource "machineconfigs" in API group "machineconfiguration.openshift.io" at the cluster scope
      ...
      

      Those are actually dry-run requests, as you can see with --v=8:

      $ oc --v=8 adm prune renderedmachineconfigs
      ...
      I0625 10:49:36.291173    7200 request.go:1212] Request Body: {"kind":"DeleteOptions","apiVersion":"machineconfiguration.openshift.io/v1","dryRun":["All"]}
      I0625 10:49:36.291209    7200 round_trippers.go:463] DELETE https://api.build02.gcp.ci.openshift.org:6443/apis/machineconfiguration.openshift.io/v1/machineconfigs/rendered-master-3fff60688940de967f8aa44e5aa0e87e
      ...
      

      But Error deleting ... failed isn't explicit about it being a dry-run deletion that failed. Even with appropriate privileges:

      $ oc --as system:admin adm prune renderedmachineconfigs
      Dry run enabled - no modifications will be made. Add --confirm to remove rendered machine configs.
      DRY RUN: Deleted rendered MachineConfig rendered-master-3fff60688940de967f8aa44e5aa0e87e
      ...
      

      could be more clear that it was doing a dry-run deletion.

      Version-Release number of selected component

      4.16 and 4.17.

      How reproducible

      Every time.

      Steps to Reproduce

      1. Install a cluster.
      2. Get some outdated rendered MachineConfig by bumping something, unless your cluster has some by default.
      3. Run oc adm prune renderedmachineconfigs, both with and without permission to do the actual deletion.

      Actual results

      Wording like Error deleting ... failed and Deleted rendered... can spook folks who don't understand that it was an attempted dry-run deletion.

      Expected results

      Soothing wording that makes it very clear that the API request was a dry-run deletion.

            trking W. Trevor King
            trking W. Trevor King
            Sergio Regidor de la Rosa Sergio Regidor de la Rosa
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: