Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"log"

"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/privateerproj/privateer-sdk/raidengine"
)
Expand All @@ -15,7 +14,7 @@ var (
Use: "debug",
Short: "Run the Raid in debug mode",
Run: func(cmd *cobra.Command, args []string) {
err := raidengine.Run(RaidName, viper.GetString("raids.wireframe.tactic"), getStrikes())
err := raidengine.Run(RaidName, getStrikes())
if err != nil {
log.Fatal(err)
}
Expand Down
16 changes: 12 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"os"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -72,22 +73,29 @@ func cleanupFunc() error {
// Adding raidengine.SetupCloseHandler(cleanupFunc) will allow you to append custom cleanup behavior
func (r *Raid) Start() error {
raidengine.SetupCloseHandler(cleanupFunc)
return raidengine.Run(RaidName, viper.GetString("tactic"), getStrikes()) // Return errors from strike executions
return raidengine.Run(RaidName, getStrikes()) // Return errors from strike executions
}

// GetStrikes returns a list of probe objects
func getStrikes() map[string][]raidengine.Strike {
func getStrikes() []raidengine.Strike {
logger := raidengine.GetLogger(RaidName, false)
a := &strikes.Antijokes{
Log: logger,
}
return map[string][]raidengine.Strike{
"PCI": {
availableStrikes := map[string][]raidengine.Strike{
"CCC-Taxonomy": {
a.KnockKnock,
},
"CIS": {
a.KnockKnock,
a.ChickenCrossedRoad,
},
}
tactic := viper.GetString("raids.wireframe.tactic")
strikes := availableStrikes[tactic]
if len(strikes) == 0 {
message := fmt.Sprintf("No strikes were found for the provided strike set: %s", tactic)
logger.Error(message)
}
return strikes
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.14

require (
github.com/hashicorp/go-hclog v1.2.0
github.com/privateerproj/privateer-sdk v0.0.3
github.com/privateerproj/privateer-sdk v0.0.4
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.15.0
)
Expand Down