-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
105 lines (79 loc) · 2.31 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package main
import (
"embed"
_ "embed"
"flag"
"fmt"
"os"
"path/filepath"
"github.com/atyronesmith/gennextgen/pkg/generate"
"github.com/atyronesmith/gennextgen/pkg/types"
"github.com/atyronesmith/gennextgen/pkg/utils"
)
//go:embed configs/*
var configs embed.FS
//go:embed configs/service-var-map.yaml
var serviceMap string
//go:embed templates/*
var templates embed.FS
func main() {
isVerbose := flag.Bool("verbose", false, "Print extra runtime information.")
isHelp := flag.Bool("help", false, "Print usage information.")
outDir := flag.String("outdir", "/tmp/osp", "Where to place output.")
var CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)
flag.Usage = func() {
fmt.Fprintf(CommandLine.Output(), "Usage: %s [options] config.yaml stack_dir\n", filepath.Base(os.Args[0]))
fmt.Fprintf(CommandLine.Output(), " config.yaml -- Path to the tool config file.\n")
fmt.Fprintf(CommandLine.Output(), " stack_dir -- Path to directory containing overcloud-deploy stack.\n")
flag.PrintDefaults()
}
flag.Parse()
if *isVerbose {
fmt.Println("Verbose...")
}
if *isHelp || flag.NArg() < 2 {
flag.Usage()
os.Exit(0)
}
dirName := flag.Arg(1)
configFile := flag.Arg(0)
utils.SetRootDir(dirName)
err := utils.ReadRhosoConfig(configFile)
if err != nil {
os.Exit(1)
}
configDownload := types.NewConfigDownload()
err = configDownload.Process(*outDir, configs, serviceMap)
if err != nil {
fmt.Printf("%s\n", err)
os.Exit(1)
}
err = types.InitEDPMVarMap(configs)
if err != nil {
fmt.Printf("%s\n", err)
os.Exit(1)
}
if err := generate.GenerateNetworkValues(*outDir, configDownload); err != nil {
fmt.Printf("%s\n", err)
os.Exit(1)
}
if err := generate.GenSecrets(templates, *outDir, configDownload); err != nil {
fmt.Printf("%s\n", err)
os.Exit(1)
}
generate.CreateVADirs(*outDir, templates)
generate.GenEdpmNodesetValues(*outDir, configs, configDownload)
// if err := generate.GenOpenStackControlPlane(templates, *outDir); err != nil {
// fmt.Printf("%s\n", err)
// os.Exit(1)
// }
// if err := generate.GenNNCP(*outDir, configDownload); err != nil {
// fmt.Printf("%s\n", err)
// os.Exit(1)
// }
// err = generate.GenGraph(templates, *outDir, configDownload) // Generate the graph
// if err != nil {
// fmt.Printf("%s\n", err)
// os.Exit(1)
// }
}