adoroszlai opened a new pull request, #7618:
URL: https://github.com/apache/ozone/pull/7618

   ## What changes were proposed in this pull request?
   
   Reduce code duplication in decommission and maintenance subcommands.
   
   - Specify `arity` to require at least one parameter, instead of checking 
explicitly.
   - Extract duplicated "list of host names" parameter and logic.
   - Reuse "show errors" logic.
   
   https://issues.apache.org/jira/browse/HDDS-11990
   
   ## How was this patch tested?
   
   Tested in `ozone-topology` env:
   
   ```
   $ ozone admin datanode maintenance
   Missing required parameter: '<host name>'
   Usage: ozone admin datanode maintenance [-hV] [--force] [--end=<endInHours>]
                                           [-id=<scmServiceId>] [--scm=<scm>]
                                           <host name>...
   Put a datanode into Maintenance Mode
         <host name>...       One or more host names separated by spaces. To 
read
                                from stdin, specify '-' and supply the host 
names
                                separated by newlines.
         --end=<endInHours>   Automatically end maintenance after the given 
hours.
                                By default, maintenance must be ended manually.
         --force              Forcefully try to decommission the datanode(s)
     -h, --help               Show this help message and exit.
         -id, --service-id=<scmServiceId>
                              ServiceId of SCM HA Cluster
         --scm=<scm>          The destination scm (host:port)
     -V, --version            Print version information and exit.
   
   
   $ ozone admin datanode maintenance - <<EOF
   > 18f367dac6f6
   > 2f5e52c1f56b
   > EOF
   Entering maintenance mode on datanode(s):
   18f367dac6f6
   2f5e52c1f56b
   
   
   $ ozone admin datanode maintenance asdf
   Entering maintenance mode on datanode(s):
   asdf
   Error: asdf: asdf: Name or service not known
   Some nodes could not start the maintenance workflow
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to