Uploaded image for project: 'Razor'
  1. Razor
  2. RAZOR-748

Allow variable argument lists

    XMLWordPrintable

Details

    • Story
    • Status: Ready for Engineering
    • Normal
    • Resolution: Unresolved
    • RAZOR 1.1.0
    • None
    • Client, Server
    • None
    • Hide

      Be able to run the following command to reinstall three nodes using the same policy:
      razor reinstall-node --same-policy node1,node2,node3

      Or:

      razor reinstall-node --same-policy --nodes node1,node2,node3

      Show
      Be able to run the following command to reinstall three nodes using the same policy: razor reinstall-node --same-policy node1,node2,node3 Or: razor reinstall-node --same-policy --nodes node1,node2,node3

    Description

      Several commands would benefit from a shortened syntax that would merge several instances of the same command into one list-like command. For example:

      razor delete-node node1
      razor delete-node node2
      razor delete-node node3
      ...
      

      This should be possible in the same command, e.g. as:

      razor delete-node node1,node2,node3
      

      Steps

      • Server: Update the API to indicate that the argument can be an array of strings.
      • [Optional] Server: Update commands to accept an array where it makes sense (see command list below)
      • Client (ticket forthcoming when open question below is resolved): Allow the user to input a variable list of positional arguments, which will be converted into multiple command executions (see question below)

      In Scope

      • Server: Update the API to indicate which positional argument is the variable argument
      • [Optional] Server: Update commands to accept an array where it makes sense (see command list below)

      Open Questions

      • The main question here is around how the client should deal with the variable arguments for commands which currently only support a single argument. I see two options (I lean toward option #2 for the error messaging reason):
        1. Keep commands lightweight (potentially avoiding timeouts) and have the client issue multiple POST requests to the server. PRO: No server updates, requests should not timeout
        2. Facilitate bulk operations by updating the API to accept an array in several commands. All nodes being updated either succeed or fail atomically. PRO: Less work for the client, less bandwidth usage/network overhead, simpler error message handling

      The commands which should have variable arguments are:

      Command Positional Arguments Variable Argument
      add-policy-tag name, tag, rule (none)
      create-broker name, broker-type (none)
      create-hook name, hook-type (none)
      create-policy name (none)
      create-repo name (none)
      create-tag name, rule (none)
      create-task name (none)
      delete-broker name name
      delete-hook name name
      delete-node name name
      delete-policy name name
      delete-repo name name
      delete-tag name name
      disable-policy name name
      enable-policy name name
      modify-node-metadata node (none)
      modify-policy-max-count name, max_count (none)
      move-policy name (none)
      reboot-node name name
      register-node (none) (none)
      reinstall-node name name
      remove-node-metadata node, key key
      remove-policy-tag name, tag tag
      run-hook name (none)
      set-node-desired-power-state name, to (none)
      set-node-hw-info node (none)
      set-node-ipmi-credentials name (none)
      update-broker-configuration broker, key, value (none)
      update-hook-configuration node, key, value (none)
      update-node-metadata node, key, value (none)
      update-policy-task policy, task (none)
      update-repo-task repo, task (none)
      update-tag-rule name, rule (none)

      In cases where the name argument is the name of a node, two aliases should be added: node and nodes.

      This should allow flags to be passed in addition to the variable argument(s). These flags will apply to each variable argument. For example, to run `reinstall-node` on three nodes (node1, node2, node3) and have each reinstall use the `same-policy` flag, you could do any of these:

      razor reinstall-node --same-policy node1,node2,node3
      razor reinstall-node node1,node2,node3 --same-policy // same effect
      razor reinstall-node --nodes node1,node2,node3 --same-policy //same effect

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              scott.mcclellan Scott McClellan
              Sam Woods Sam Woods
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support