Skip to content

Commit

Permalink
add: compatible with postinit
Browse files Browse the repository at this point in the history
  • Loading branch information
ak1ra24 committed Dec 13, 2019
1 parent b7d232a commit b818040
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
13 changes: 7 additions & 6 deletions cmd/reconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ var reconfCmd = &cobra.Command{
fmt.Println(strings.Join(preExecInitCmds, "\n"))
}
}
if len(tnconfig.PostInit) != 0 {
for _, postInitCmds := range tnconfig.PostInit {
postExecInitCmds := shell.ExecCmd(postInitCmds.Cmds)
fmt.Println(strings.Join(postExecInitCmds, "\n"))
}
}
for _, node := range tnconfig.Nodes {
createNodeCmds := shell.CreateNode(node)
fmt.Println(strings.Join(createNodeCmds, "\n"))
Expand Down Expand Up @@ -82,6 +76,13 @@ var reconfCmd = &cobra.Command{
}
}

if len(tnconfig.PostInit) != 0 {
for _, postInitCmds := range tnconfig.PostInit {
postExecInitCmds := shell.ExecCmd(postInitCmds.Cmds)
fmt.Println(strings.Join(postExecInitCmds, "\n"))
}
}

nodeinfo := map[string]string{}
for _, node := range tnconfig.Nodes {
nodeinfo[node.Name] = node.Type
Expand Down
13 changes: 7 additions & 6 deletions cmd/reup.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ var reupCmd = &cobra.Command{
fmt.Println(strings.Join(preExecInitCmds, "\n"))
}
}
if len(tnconfig.PostInit) != 0 {
for _, postInitCmds := range tnconfig.PostInit {
postExecInitCmds := shell.ExecCmd(postInitCmds.Cmds)
fmt.Println(strings.Join(postExecInitCmds, "\n"))
}
}
for _, node := range tnconfig.Nodes {
createNodeCmds := shell.CreateNode(node)
fmt.Println(strings.Join(createNodeCmds, "\n"))
Expand Down Expand Up @@ -81,6 +75,13 @@ var reupCmd = &cobra.Command{
}
}
}

if len(tnconfig.PostInit) != 0 {
for _, postInitCmds := range tnconfig.PostInit {
postExecInitCmds := shell.ExecCmd(postInitCmds.Cmds)
fmt.Println(strings.Join(postExecInitCmds, "\n"))
}
}
},
}

Expand Down
13 changes: 7 additions & 6 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ var upCmd = &cobra.Command{
fmt.Println(strings.Join(preExecInitCmds, "\n"))
}
}
if len(tnconfig.PostInit) != 0 {
for _, postInitCmds := range tnconfig.PostInit {
postExecInitCmds := shell.ExecCmd(postInitCmds.Cmds)
fmt.Println(strings.Join(postExecInitCmds, "\n"))
}
}
for _, node := range tnconfig.Nodes {
createNodeCmds := shell.CreateNode(node)
fmt.Println(strings.Join(createNodeCmds, "\n"))
Expand Down Expand Up @@ -70,6 +64,13 @@ var upCmd = &cobra.Command{
}
}
}

if len(tnconfig.PostInit) != 0 {
for _, postInitCmds := range tnconfig.PostInit {
postExecInitCmds := shell.ExecCmd(postInitCmds.Cmds)
fmt.Println(strings.Join(postExecInitCmds, "\n"))
}
}
},
}

Expand Down

0 comments on commit b818040

Please sign in to comment.