Skip to content

Commit

Permalink
Finish generate command
Browse files Browse the repository at this point in the history
  • Loading branch information
Clément Blaise committed Jan 8, 2021
1 parent 0e02c93 commit 8ad2b10
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
28 changes: 27 additions & 1 deletion cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"github.com/ca-gip/dploy/internal/services"
"github.com/spf13/cobra"
"log"
"os"
"regexp"
"strings"
Expand All @@ -36,8 +37,33 @@ TODO`,
k8s := services.LoadFromPath(curr)
filters, _ := cmd.Flags().GetStringSlice("filter")
inventories := k8s.FilterFromVars(filters)
playbookPath, _ := cmd.Flags().GetString("playbook")
playbook := k8s.GetPlaybook(playbookPath)
if playbook == nil {
log.Fatalf(`%s not a valid path`, playbookPath)
}

tags, _ := cmd.Flags().GetStringSlice("tags")
limit, _ := cmd.Flags().GetStringSlice("limit")
skipTags, _ := cmd.Flags().GetStringSlice("skip-tags")
check, _ := cmd.Flags().GetBool("check")
diff, _ := cmd.Flags().GetBool("diff")
vaultPassFile, _ := cmd.Flags().GetString("vault-password-file")
askVaultPass, _ := cmd.Flags().GetBool("ask-vault-password")

commands := &services.AnsibleCommandTpl{
Inventory: inventories,
Playbook: playbook,
Tags: tags,
Limit: limit,
SkipTags: skipTags,
Check: check,
Diff: diff,
VaultPasswordFile: vaultPassFile,
AskVaultPass: askVaultPass,
}

fmt.Println(inventories)
commands.GenerateCmd()

},
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
// Check: true,
// Diff: true,
// VaultPasswordFile: "/path/to/passwordfile",
// AskVaultPassFile: false,
// AskVaultPass: false,
//}
//tpl.GenerateCmd()

Expand Down

0 comments on commit 8ad2b10

Please sign in to comment.