-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pr/acond/mount-fstab
- Loading branch information
Showing
26 changed files
with
2,354 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright © 2023 Intel Corporation | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os/user" | ||
|
||
"aconcli/service" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var loginCmd = &cobra.Command{ | ||
Use: "login", | ||
Short: "log in the ACON TD/VM", | ||
GroupID: "runtime", | ||
Long: ` | ||
Log in the specified ACON TD/VM for the current user. | ||
`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return login() | ||
}, | ||
} | ||
|
||
func login() error { | ||
c, err := service.NewAconHttpConnWithOpts(vmConnTarget, service.OptDialTLSContextInsecure()) | ||
if err != nil { | ||
return fmt.Errorf("Login: cannot connect to %s: %v", vmConnTarget, err) | ||
} | ||
user, err := user.Current() | ||
if err != nil { | ||
return fmt.Errorf("Login: cannot get the current user: %v", err) | ||
} | ||
if err := c.Login(user.Uid); err != nil { | ||
return fmt.Errorf("Login: cannot call 'login' service: %v", err) | ||
} | ||
return nil | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(loginCmd) | ||
loginCmd.Flags().StringVarP(&vmConnTarget, "connect", "c", "", | ||
"protocol/address of the ACON TD/VM") | ||
loginCmd.MarkFlagRequired("connect") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright © 2023 Intel Corporation | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os/user" | ||
|
||
"aconcli/service" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var logoutCmd = &cobra.Command{ | ||
Use: "logout", | ||
Short: "log out the ACON TD/VM", | ||
GroupID: "runtime", | ||
Long: ` | ||
Log out the specified ACON TD/VM for the current user. If not logged in, | ||
this command has no effect. | ||
`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return logout() | ||
}, | ||
} | ||
|
||
func logout() error { | ||
c, err := service.NewAconHttpConnWithOpts(vmConnTarget, service.OptDialTLSContextInsecure()) | ||
if err != nil { | ||
return fmt.Errorf("Logout: cannot connect to %s: %v", vmConnTarget, err) | ||
} | ||
user, err := user.Current() | ||
if err != nil { | ||
return fmt.Errorf("Logout: cannot get the current user: %v", err) | ||
} | ||
if err := c.Logout(user.Uid); err != nil { | ||
return fmt.Errorf("Logout: cannot call 'logout' service: %v", err) | ||
} | ||
return nil | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(logoutCmd) | ||
logoutCmd.Flags().StringVarP(&vmConnTarget, "connect", "c", "", | ||
"protocol/address of the ACON TD/VM") | ||
logoutCmd.MarkFlagRequired("connect") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.