Skip to content

Commit

Permalink
Fix missing flag for skipAuths and missing policy dir
Browse files Browse the repository at this point in the history
Added --skip-auths flag to skip configuring Auths backends
If you don't specify a directory for policies with -p
then assume skiPolicies == true
  • Loading branch information
Félix Cantournet committed Jan 19, 2017
1 parent d422f38 commit ececc14
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,24 @@ func (r *syncCommand) parseConfigFiles() error {
func (r *syncCommand) validateAction(cx *cli.Context) error {
r.configFiles = cx.StringSlice("config")

var err error
if len(cx.StringSlice("policies")) == 0 { // no policy dirs specified
r.skipPolicies = true
} else {
// step: get a list of policy files from the directories
r.policyFiles, err = utils.FindFilesInDirectory(cx.StringSlice("policies"), r.policyExtension)
if err != nil {
return fmt.Errorf("cannot find policy files")
}
}

// step: check the skips
if r.skipBackends && r.skipPolicies && r.skipUsers {
return fmt.Errorf("you are skipping all the resources, what exactly are we syncing")
}
if r.skipAuths {
log.Infof("skipping the synchronization of auths")
}
if r.skipBackends {
log.Infof("skipping the synchronization of backends")
}
Expand All @@ -443,12 +457,6 @@ func (r *syncCommand) validateAction(cx *cli.Context) error {
}
r.configFiles = append(r.configFiles, files...)

// step: get a list of policy files from the directories
r.policyFiles, err = utils.FindFilesInDirectory(cx.StringSlice("policies"), r.policyExtension)
if err != nil {
return err
}

return nil
}

Expand Down Expand Up @@ -499,6 +507,11 @@ func (r *syncCommand) getCommand() cli.Command {
Usage: "wheather or not to skip synchronizing the backends",
Destination: &r.skipBackends,
},
cli.BoolFlag{
Name: "skip-auths",
Usage: "wheather or not to skip synchronizing the backends",
Destination: &r.skipAuths,
},
cli.BoolFlag{
Name: "skip-secrets",
Usage: "wheather or not to skip synchronizing the secrets",
Expand Down

0 comments on commit ececc14

Please sign in to comment.