Skip to content

Commit f16a545

Browse files
Merge pull request #21 from overmindtech/plan-submit-fixes
Plan-submit-fixes
2 parents b5c4394 + 62a26c0 commit f16a545

File tree

4 files changed

+24
-30
lines changed

4 files changed

+24
-30
lines changed

cmd/datamaps/awssource.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/root.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"google.golang.org/protobuf/types/known/durationpb"
2424
)
2525

26-
var cfgFile string
2726
var logLevel string
2827

2928
var minStatusInterval = durationpb.New(250 * time.Millisecond)
@@ -188,7 +187,6 @@ func init() {
188187
cobra.OnInitialize(initConfig)
189188

190189
// General Config
191-
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is redacted.yaml)")
192190
rootCmd.PersistentFlags().StringVar(&logLevel, "log", "info", "Set the log level. Valid values: panic, fatal, error, warn, info, debug, trace")
193191

194192
// api endpoint
@@ -249,17 +247,8 @@ func init() {
249247

250248
// initConfig reads in config file and ENV variables if set.
251249
func initConfig() {
252-
viper.SetConfigFile(cfgFile)
253-
254250
replacer := strings.NewReplacer("-", "_")
255251

256252
viper.SetEnvKeyReplacer(replacer)
257253
viper.AutomaticEnv() // read in environment variables that match
258-
259-
// If a config file is found, read it in.
260-
if err := viper.ReadInConfig(); err == nil {
261-
log.Infof("Using config file: %v", viper.ConfigFileUsed())
262-
} else {
263-
log.WithFields(log.Fields{"err": err}).Errorf("Error reading config file")
264-
}
265254
}

cmd/submitplan.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func SubmitPlan(signals chan os.Signal, ready chan bool) int {
216216
}
217217

218218
log.WithContext(ctx).WithFields(lf).WithField("item_count", len(queries)).Info("identifying items")
219-
c, _, err := websocket.Dial(ctx, viper.GetString("url"), options)
219+
c, _, err := websocket.Dial(ctx, viper.GetString("gateway-url"), options)
220220
if err != nil {
221221
log.WithContext(ctx).WithFields(lf).WithError(err).Error("Failed to connect to overmind API")
222222
return 1
@@ -236,6 +236,16 @@ func SubmitPlan(signals chan os.Signal, ready chan bool) int {
236236
},
237237
}
238238
err = wspb.Write(ctx, c, &req)
239+
240+
if err == nil {
241+
log.WithContext(ctx).WithFields(log.Fields{
242+
"scope": q.Scope,
243+
"type": q.Type,
244+
"query": q.Query,
245+
"method": q.Method.String(),
246+
"uuid": q.ParseUuid().String(),
247+
}).Trace("Started query")
248+
}
239249
if err != nil {
240250
log.WithContext(ctx).WithFields(lf).WithError(err).WithField("req", &req).Error("Failed to send request")
241251
continue

extractmaps.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,7 @@ func dataFromFiles(path string) map[string][]map[string]string {
124124
data["query-field"] = qSplit[1]
125125

126126
data["scope"] = parsed["terraformScope"].(string)
127-
switch parsed["terraformMethod"].(string) {
128-
case "GET":
129-
data["method"] = "GET"
130-
case "SEARCH":
131-
data["method"] = "LIST"
132-
}
127+
data["method"] = parsed["terraformMethod"].(string)
133128

134129
result[data["query-type"]] = append(result[data["query-type"]], data)
135130
}

0 commit comments

Comments
 (0)