Brigade: brig project create `--replace` flag does not work

Created on 17 Oct 2018  Â·  3Comments  Â·  Source: brigadecore/brigade

I noticed that brig project create is documented to have a --replace flag.

Usage:
  brig project create [flags]

Flags:
  -f, --config string         Path to JSON Kubernetes Secret.
  -D, --dry-run               Do not send the config to Kubernetes
  -p, --from-project string   Retrieve the given project from Kubernetes and use it to set the default values.
  -h, --help                  help for create
  -x, --no-prompts            Do not prompt the user for input. Use this with -f to skip prompts.
  -o, --out string            File where configuration should be saved. The configuration is stored as a JSON Kubernetes Secret
  -r, --replace               Replace an existing project with this revised one. Use this to modify existing projects.

However, I'm finding that it does not work as I expected. When I try to run this to replace an existing project, I get this error:

   -- command failed --
   status : 1
   output (20 lines):
     Project ID: brigade-6e35bd4c52f9e015cfe3308c2b19eba59990e1019beb499eadee67
     Error: secrets "brigade-6e35bd4c52f9e015cfe3308c2b19eba59990e1019beb499eadee67" already exists
     Usage:
       brig project create [flags]

I also wrote a test to reproduce this error. Side note: this testing strategy would be a great addition to provide automated tests to this project.

bug

All 3 comments

Your test is failing because ‘brig —replace’ will have Kube API Secrets.Create invoked, which fails because the Secret already exists (since the project exists). I think that this can easily be solved by calling API Secrets.Update called, when the —replace is used (and, of course, Secret exists).
Thoughts?

That sounds right to me!

closing as #720 has been merged

Was this page helpful?
0 / 5 - 0 ratings