Skip to content

Commit ececc14

Browse files
author
Félix Cantournet
committed
Fix missing flag for skipAuths and missing policy dir
Added --skip-auths flag to skip configuring Auths backends If you don't specify a directory for policies with -p then assume skiPolicies == true
1 parent d422f38 commit ececc14

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

cmd/sync.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,24 @@ func (r *syncCommand) parseConfigFiles() error {
422422
func (r *syncCommand) validateAction(cx *cli.Context) error {
423423
r.configFiles = cx.StringSlice("config")
424424

425+
var err error
426+
if len(cx.StringSlice("policies")) == 0 { // no policy dirs specified
427+
r.skipPolicies = true
428+
} else {
429+
// step: get a list of policy files from the directories
430+
r.policyFiles, err = utils.FindFilesInDirectory(cx.StringSlice("policies"), r.policyExtension)
431+
if err != nil {
432+
return fmt.Errorf("cannot find policy files")
433+
}
434+
}
435+
425436
// step: check the skips
426437
if r.skipBackends && r.skipPolicies && r.skipUsers {
427438
return fmt.Errorf("you are skipping all the resources, what exactly are we syncing")
428439
}
440+
if r.skipAuths {
441+
log.Infof("skipping the synchronization of auths")
442+
}
429443
if r.skipBackends {
430444
log.Infof("skipping the synchronization of backends")
431445
}
@@ -443,12 +457,6 @@ func (r *syncCommand) validateAction(cx *cli.Context) error {
443457
}
444458
r.configFiles = append(r.configFiles, files...)
445459

446-
// step: get a list of policy files from the directories
447-
r.policyFiles, err = utils.FindFilesInDirectory(cx.StringSlice("policies"), r.policyExtension)
448-
if err != nil {
449-
return err
450-
}
451-
452460
return nil
453461
}
454462

@@ -499,6 +507,11 @@ func (r *syncCommand) getCommand() cli.Command {
499507
Usage: "wheather or not to skip synchronizing the backends",
500508
Destination: &r.skipBackends,
501509
},
510+
cli.BoolFlag{
511+
Name: "skip-auths",
512+
Usage: "wheather or not to skip synchronizing the backends",
513+
Destination: &r.skipAuths,
514+
},
502515
cli.BoolFlag{
503516
Name: "skip-secrets",
504517
Usage: "wheather or not to skip synchronizing the secrets",

0 commit comments

Comments
 (0)