Skip to content

Commit 749f136

Browse files
committed
Always use absolute path for --store option
Fixes: #1634 Signed-off-by: Daniel J Walsh <[email protected]>
1 parent 162e2e5 commit 749f136

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ramalama/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ def get_description():
148148
"""
149149

150150

151+
def abspath(astring):
152+
return os.path.abspath(astring)
153+
154+
151155
def create_argument_parser(description: str):
152156
"""Create and configure the argument parser for the CLI."""
153157
parser = ArgumentParserWithDefaults(
@@ -222,6 +226,7 @@ def configure_arguments(parser):
222226
parser.add_argument(
223227
"--store",
224228
default=CONFIG.store,
229+
type=abspath,
225230
help="store AI Models in the specified directory",
226231
)
227232
parser.add_argument(

test/system/060-info.bats

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,12 @@ Store | $store
5959

6060
}
6161

62+
@test "ramalama info --store" {
63+
randdir=$(random_string 20)
64+
store=$PWD/${randdir}
65+
run_ramalama --store ./${randdir} info
66+
actual=$(echo "$output" | jq -r ".Store")
67+
is "$actual" "$store" "Verify relative paths translated to absolute path"
68+
}
69+
6270
# vim: filetype=sh

0 commit comments

Comments
 (0)