Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/loxilb-io/loxicmd into main
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Sep 6, 2024
2 parents 6f5a7c5 + aa3d917 commit 36f1910
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/get/get_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ func FWAPICall(restOptions *api.RESTOptions) (*http.Response, error) {

func FWdump(restOptions *api.RESTOptions, path string) (string, error) {
// File Open
fileP := []string{"FWconfig_", ".txt"}
fileP := []string{"/tmp/FWconfig_", ".txt"}
t := time.Now()
file := strings.Join(fileP, t.Local().Format("2006-01-02_15:04:05"))
f, err := os.Create(file)
if err != nil {
fmt.Printf("Can't create dump file\n")
os.Exit(1)
}
defer f.Close()
defer os.Remove(f.Name())

// API Call
client := api.NewLoxiClient(restOptions)
Expand Down
4 changes: 2 additions & 2 deletions cmd/get/get_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ func Lbdump(restOptions *api.RESTOptions, path string) (string, error) {
lbresp := api.LbRuleModGet{}
dresp := api.LbRuleModGet{}
// File Open
fileP := []string{"lbconfig_", ".txt"}
fileP := []string{"/tmp/lbconfig_", ".txt"}
t := time.Now()
file := strings.Join(fileP, t.Local().Format("2006-01-02_15:04:05"))
f, err := os.Create(file)
if err != nil {
fmt.Printf("Can't create dump file\n")
os.Exit(1)
}
defer f.Close()
defer os.Remove(f.Name())

// API Call
client := api.NewLoxiClient(restOptions)
Expand Down
8 changes: 5 additions & 3 deletions cmd/get/get_netlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func GetBonds() {
func Nlpdump(dpath string) (string, error) {
var ret int
var err error
fileP := []string{"ipconfig_", ".txt"}
fileP := []string{"/tmp/ipconfig_", ".txt"}
t := time.Now()
file := strings.Join(fileP, t.Local().Format("2006-01-02_15:04:05"))
f, err = os.Create(file)
Expand All @@ -523,9 +523,9 @@ func Nlpdump(dpath string) (string, error) {
os.Exit(1)
}

defer f.Close()
defer os.Remove(f.Name())

path = "ipconfig_" + t.Local().Format("2006-01-02_15:04:05") + "/"
path = "/tmp/" + "ipconfig_" + t.Local().Format("2006-01-02_15:04:05") + "/"
//fmt.Printf("Creating intf config dir : %s\n", path)
if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
err := os.Mkdir(path, os.ModePerm)
Expand All @@ -534,6 +534,8 @@ func Nlpdump(dpath string) (string, error) {
}
}

defer os.RemoveAll(path)

/*Get bridge info first */
GetBridges()
GetBonds()
Expand Down

0 comments on commit 36f1910

Please # to comment.