add "gocage get property jail" + "gocage set property jail" now support string, int and bool types
This commit is contained in:
15
cmd/root.go
15
cmd/root.go
@ -107,6 +107,19 @@ Multiples properties can be specified, separated with space (Ex: gocage set allo
|
||||
cleanAfterRun()
|
||||
},
|
||||
}
|
||||
|
||||
getCmd = &cobra.Command{
|
||||
Use: "get",
|
||||
Short: "Get a jail property",
|
||||
Long: `Get jail property value. Specify property, end command with jail name.
|
||||
Multiples properties can be specified, separated with space (Ex: gocage get allow_mlock boot myjail)`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// Get the inventory
|
||||
ListJails(args, false)
|
||||
GetJailProperties(args)
|
||||
cleanAfterRun()
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -130,6 +143,7 @@ func init() {
|
||||
listCmd.AddCommand(listPropsCmd)
|
||||
rootCmd.AddCommand(stopCmd)
|
||||
rootCmd.AddCommand(startCmd)
|
||||
rootCmd.AddCommand(getCmd)
|
||||
rootCmd.AddCommand(setCmd)
|
||||
|
||||
// Get FreeBSD version
|
||||
@ -187,7 +201,6 @@ func initConfig() {
|
||||
func cleanAfterRun() {
|
||||
for _, j := range gJails {
|
||||
if j.ConfigUpdated {
|
||||
// TODO : Marshall to disk
|
||||
//fmt.Printf("Config for jail %s will be updated\n", j.Name)
|
||||
marshaled, err := json.MarshalIndent(j.Config, "", " ")
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user