cmd: switch to --connect and --listen flags
Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
316e85f0b4
commit
3f48986ea0
3 changed files with 9 additions and 8 deletions
|
@ -19,7 +19,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func getClientConnection(context *cli.Context) (*grpc.ClientConn, error) {
|
func getClientConnection(context *cli.Context) (*grpc.ClientConn, error) {
|
||||||
conn, err := grpc.Dial(context.GlobalString("socket"), grpc.WithInsecure(), grpc.WithTimeout(timeout),
|
conn, err := grpc.Dial(context.GlobalString("connect"), grpc.WithInsecure(), grpc.WithTimeout(timeout),
|
||||||
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
|
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
|
||||||
return net.DialTimeout("unix", addr, timeout)
|
return net.DialTimeout("unix", addr, timeout)
|
||||||
}))
|
}))
|
||||||
|
@ -83,7 +83,7 @@ func main() {
|
||||||
|
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "socket",
|
Name: "connect",
|
||||||
Value: "/var/run/ocid.sock",
|
Value: "/var/run/ocid.sock",
|
||||||
Usage: "Socket to connect to",
|
Usage: "Socket to connect to",
|
||||||
},
|
},
|
||||||
|
|
|
@ -53,7 +53,7 @@ func main() {
|
||||||
Usage: "ocid container dir",
|
Usage: "ocid container dir",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "socket",
|
Name: "listen",
|
||||||
Value: "/var/run/ocid.sock",
|
Value: "/var/run/ocid.sock",
|
||||||
Usage: "path to ocid socket",
|
Usage: "path to ocid socket",
|
||||||
},
|
},
|
||||||
|
@ -67,7 +67,7 @@ func main() {
|
||||||
Usage: "enable debug output for logging",
|
Usage: "enable debug output for logging",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "selinux-enabled",
|
Name: "selinux",
|
||||||
Usage: "enable selinux support",
|
Usage: "enable selinux support",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
|
@ -86,7 +86,7 @@ func main() {
|
||||||
if c.GlobalBool("debug") {
|
if c.GlobalBool("debug") {
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
}
|
}
|
||||||
if !c.GlobalBool("selinux-enabled") {
|
if !c.GlobalBool("selinux") {
|
||||||
selinux.SetDisabled()
|
selinux.SetDisabled()
|
||||||
}
|
}
|
||||||
if path := c.GlobalString("log"); path != "" {
|
if path := c.GlobalString("log"); path != "" {
|
||||||
|
@ -108,11 +108,12 @@ func main() {
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unknown log-format %q", c.GlobalString("log-format"))
|
return fmt.Errorf("unknown log-format %q", c.GlobalString("log-format"))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Action = func(c *cli.Context) error {
|
app.Action = func(c *cli.Context) error {
|
||||||
socketPath := c.String("socket")
|
socketPath := c.String("listen")
|
||||||
// Remove the socket if it already exists
|
// Remove the socket if it already exists
|
||||||
if _, err := os.Stat(socketPath); err == nil {
|
if _, err := os.Stat(socketPath); err == nil {
|
||||||
if err := os.Remove(socketPath); err != nil {
|
if err := os.Remove(socketPath); err != nil {
|
||||||
|
|
|
@ -36,7 +36,7 @@ function ocid() {
|
||||||
|
|
||||||
# Run ocic using the binary specified by $OCID_BINARY.
|
# Run ocic using the binary specified by $OCID_BINARY.
|
||||||
function ocic() {
|
function ocic() {
|
||||||
"$OCIC_BINARY" --socket "$OCID_SOCKET" "$@"
|
"$OCIC_BINARY" --connect "$OCID_SOCKET" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Communicate with Docker on the host machine.
|
# Communicate with Docker on the host machine.
|
||||||
|
@ -72,7 +72,7 @@ function wait_until_reachable() {
|
||||||
|
|
||||||
# Start ocid.
|
# Start ocid.
|
||||||
function start_ocid() {
|
function start_ocid() {
|
||||||
"$OCID_BINARY" --conmon "$CONMON_BINARY" --pause "$PAUSE_BINARY" --debug --socket "$TESTDIR/ocid.sock" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" --sandboxdir "$TESTDIR/sandboxes" --containerdir "$TESTDIR/ocid/containers" & OCID_PID=$!
|
"$OCID_BINARY" --conmon "$CONMON_BINARY" --pause "$PAUSE_BINARY" --debug --listen "$TESTDIR/ocid.sock" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" --sandboxdir "$TESTDIR/sandboxes" --containerdir "$TESTDIR/ocid/containers" & OCID_PID=$!
|
||||||
wait_until_reachable
|
wait_until_reachable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue