Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/control/cmd/ddb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ func exitWithError(log logging.Logger, err error) {
}

type cliOptions struct {
Debug bool `long:"debug" description:"enable debug output"`
WriteMode bool `long:"write_mode" short:"w" description:"Open the vos file in write mode."`
CmdFile string `long:"cmd_file" short:"f" description:"Path to a file containing a sequence of ddb commands to execute."`
SysdbPath string `long:"db_path" short:"p" description:"Path to the sys db."`
Version bool `short:"v" long:"version" description:"Show version"`
Debug bool `long:"debug" description:"enable debug output"`
WriteMode bool `long:"write_mode" short:"w" description:"Open the vos file in write mode."`
CmdFile string `long:"cmd_file" short:"f" description:"Path to a file containing a sequence of ddb commands to execute."`
SysdbPath string `long:"db_path" short:"p" description:"Path to the sys db."`
VosPath vosPathStr `long:"vos_path" short:"s" description:"Path to the VOS file to open."`
Version bool `short:"v" long:"version" description:"Show version"`
Args struct {
VosPath vosPathStr `positional-arg-name:"vos_file_path"`
RunCmd ddbCmdStr `positional-arg-name:"ddb_command"`
RunCmdArgs []string `positional-arg-name:"ddb_command_args"`
RunCmd ddbCmdStr `positional-arg-name:"ddb_command"`
RunCmdArgs []string `positional-arg-name:"ddb_command_args"`
} `positional-args:"yes"`
}

Expand Down Expand Up @@ -272,14 +272,14 @@ ddb "" ls --help
defer cleanup()
app := createGrumbleApp(ctx)

if opts.Args.VosPath != "" {
if opts.VosPath != "" {
if !strings.HasPrefix(string(opts.Args.RunCmd), "feature") &&
!strings.HasPrefix(string(opts.Args.RunCmd), "rm_pool") &&
!strings.HasPrefix(string(opts.Args.RunCmd), "dev_list") &&
!strings.HasPrefix(string(opts.Args.RunCmd), "dev_replace") {
log.Debugf("Connect to path: %s\n", opts.Args.VosPath)
if err := ddbOpen(ctx, string(opts.Args.VosPath), string(opts.SysdbPath), opts.WriteMode); err != nil {
return errors.Wrapf(err, "Error opening path: %s", opts.Args.VosPath)
log.Debugf("Connect to path: %s\n", opts.VosPath)
if err := ddbOpen(ctx, string(opts.VosPath), string(opts.SysdbPath), opts.WriteMode); err != nil {
return errors.Wrapf(err, "Error opening path: %s", opts.VosPath)
}
}
}
Expand All @@ -288,8 +288,8 @@ ddb "" ls --help
return errors.New("Cannot use both command file and a command string")
}

if opts.Args.VosPath != "" {
ctx.ctx.dc_pool_path = C.CString(string(opts.Args.VosPath))
if opts.VosPath != "" {
ctx.ctx.dc_pool_path = C.CString(string(opts.VosPath))
defer C.free(unsafe.Pointer(ctx.ctx.dc_pool_path))
}
if opts.Args.RunCmd != "" || opts.CmdFile != "" {
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/util/ddb_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
(C) Copyright 2022 Intel Corporation.
(C) Copyright 2025 Hewlett Packard Enterprise Development LP
(C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP

SPDX-License-Identifier: BSD-2-Clause-Patent
"""
Expand Down Expand Up @@ -38,7 +38,7 @@ def __init__(self, server_host, path, verbose=True, timeout=None, sudo=True):
self.single_command = BasicParameter(None, position=2)

# VOS file path.
self.vos_path = BasicParameter(None, position=1)
self.vos_path = FormattedParameter("--vos-path {}")

# Members needed for run().
self.verbose = verbose
Expand Down
Loading