Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
a charmdelete command #704
Conversation
|
Refer to this link for build results (access rights to CI server needed): |
|
@jrwren please add a caveat ... if it's promulgated, it can't be deleted. only non-promulgated can be. |
|
Refer to this link for build results (access rights to CI server needed): |
jamesbeedy
commented
Jan 27, 2017
|
|
|
test this please |
|
Refer to this link for build results (access rights to CI server needed): |
| + "gopkg.in/mgo.v2/bson" | ||
| +) | ||
| + | ||
| +var logger = loggo.GetLogger("essync") |
| +var ( | ||
| + index = flag.String("index", "cs", "Name of index to charmDelete.") | ||
| + loggingConfig = flag.String("logging-config", "", "specify log levels for modules e.g. <root>=TRACE") | ||
| + user = flag.String("user", "", "Delete all charms for a user. Do not mix with charmMatch.") |
| + } | ||
| + } | ||
| + if err := run(flag.Arg(0)); err != nil { | ||
| + logger.Errorf("cannot charmDelete elasticsearch: %v", err) |
| + return nil | ||
| +} | ||
| + | ||
| +func deleteE(entity *mongodoc.Entity, store *charmstore.Store) { |
|
Refer to this link for build results (access rights to CI server needed): |
hatched
approved these changes
Jan 30, 2017
Thanks @jrwren this will be nice to have. A few comments, take them as you will :)
| + query := bson.D{{"user", *user}} | ||
| + if *user == "" { | ||
| + fmt.Printf("using match _id $regex %s\n", *charmMatch) | ||
| + query = bson.D{{"_id", bson.D{{"$regex", *charmMatch}}}} |
hatched
Jan 30, 2017
Owner
Because this could match charms the admin doesn't intend it should probably print a list of ids that match and then a confirmation step. I see that there is a dryrun flag but it's not the default for this command, maybe it should be?
| + counter := 0 | ||
| + for iter.Next(&entity) { | ||
| + if entity.PromulgatedURL != nil && !*deletePromulgated { | ||
| + fmt.Printf("not deleting promulgated charm %s\n", entity.URL) |
hatched
Jan 30, 2017
Owner
Seeing this log I'd ask why...maybe something like "entity.URL is promulgated, not deleting" is more appropriate.
|
|
|
Status: merge request accepted. Url: http://ci-gce.jujugui.org:8080/job/charmstore-merge |
jrwren commentedJan 26, 2017
No description provided.