Closed smt116 closed 7 years ago
@Joshua-Anderson, @bacongobbler and @ultimateboy are potential reviewers of this pull request based on my analysis of git blame
information. Thanks @smt116!
Thanks for the unit tests!
@@ master #255 diff @@
==========================================
Files 57 57
Lines 3904 3905 +1
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 2819 2823 +4
+ Misses 777 773 -4
- Partials 308 309 +1
Powered by Codecov. Last update a6cd7e6...1622cf6
Ported from V1: https://github.com/deis/deis/pull/5099.
Background
We have a private PaaS with multiple Deis clusters (staging + two productions at the moment). We have also a tool that allows us to manage all clusters from a single web panel. It also connects other APIs such as servers provider and DNS provider. As the result we can perform actions that touches many parts of the system (for example create DNS records for all Deis workers and make CNAME to use with
DEISCTL_TUNNEL
or create a database and assignDATABASE_URL
for a given application). We have also created plugins to extend Deis CLI. For example there is a support for database (+backups) management and easy SSH access for our developers.Problem
We have
deis backups:[create|show|restore|list]
commands and we want to show usage help if user triesdeis backups
. There is a problem in such case because Deis CLI invokesdeis-backups backups
. Without additional support on the plugin side, it will throw an invalid command error.Solution
We can solve it on the plugin side to handle unexpected arguments, but it feels not okay. Instead, Deis CLI should skip top level command (
backups
in this case) incmdArgv
. It already does that when used asdeis backups:list
or evendeis backups:
.Code snippets
The output contains output using the following patch:
After
@bacongobbler I have extracted code to the
prepareCmdArgs
function to make it testable. I can make it the same in V1 if approach is okay. There is one spec missing:I have got the following error:
Both objects are
[]string
type. Not sure where the issue is.