Repository: containers/ramalama
Pull request #949: Add --runtime-arg option for run and serve
Author: login: edmcman
Created: 2025-03-12T00:18:34Z | Merged: 2025-03-17T14:08:46Z

See #948 

Useful for passing `--jinja` to llama.cpp at the moment to enable tool calling.

## Summary by Sourcery

Adds the `--runtime-args` option to the `run` and `serve` commands, allowing users to pass arguments directly to the underlying runtime (llama.cpp or vllm).

New Features:
- Adds the `--runtime-args` option to the `run` and `serve` commands.

Tests:
- Adds tests to verify that `--runtime-args` are passed to the runtime.


Diff:
diff --git a/docs/ramalama-perplexity.1.md b/docs/ramalama-perplexity.1.md
index a2ec2218b..fea608c50 100644
--- a/docs/ramalama-perplexity.1.md
+++ b/docs/ramalama-perplexity.1.md
@@ -96,6 +96,9 @@ not have more privileges than the user that launched them.
 - **never**: Never pull the image but use the one from the local containers storage. Throw an error when no image is found.
 - **newer**: Pull if the image on the registry is newer than the one in the local containers storage. An image is considered to be newer when the digests are different. Comparing the time stamps is prone to errors. Pull errors are suppressed if a local image was found.
 
+#### **--runtime-args**="*args*"
+Add *args* to the runtime (llama.cpp or vllm) invocation.
+
 #### **--seed**=
 Specify seed rather than using random seed model interaction
 
diff --git a/docs/ramalama-run.1.md b/docs/ramalama-run.1.md
index 49c95b607..f92b4f4ff 100644
--- a/docs/ramalama-run.1.md
+++ b/docs/ramalama-run.1.md
@@ -100,6 +100,9 @@ Pull image policy. The default is **missing**.
 - **never**: Never pull the image but use the one from the local containers storage. Throw an error when no image is found.
 - **newer**: Pull if the image on the registry is newer than the one in the local containers storage. An image is considered to be newer when the digests are different. Comparing the time stamps is prone to errors. Pull errors are suppressed if a local image was found.
 
+#### **--runtime-args**="*args*"
+Add *args* to the runtime (llama.cpp or vllm) invocation.
+
 #### **--seed**=
 Specify seed rather than using random seed model interaction
 
diff --git a/docs/ramalama-serve.1.md b/docs/ramalama-serve.1.md
index 26bda688c..3680a583d 100644
--- a/docs/ramalama-serve.1.md
+++ b/docs/ramalama-serve.1.md
@@ -127,11 +127,14 @@ not have more privileges than the user that launched them.
 - **never**: Never pull the image but use the one from the local containers storage. Throw an error when no image is found.
 - **newer**: Pull if the image on the registry is newer than the one in the local containers storage. An image is considered to be newer when the digests are different. Comparing the time stamps is prone to errors. Pull errors are suppressed if a local image was found.
 
+#### **--runtime-args**="*args*"
+Add *args* to the runtime (llama.cpp or vllm) invocation.
+
 #### **--seed**=
 Specify seed rather than using random seed model interaction
 
 #### **--temp**="0.8"
-Temperature of the response from the AI Model
+Temperature of the response from the AI Model.
 llama.cpp explains this as:
 
     The lower the number is, the more deterministic the response.
diff --git a/ramalama/cli.py b/ramalama/cli.py
index fb867ea8f..7420afe46 100644
--- a/ramalama/cli.py
+++ b/ramalama/cli.py
@@ -2,6 +2,7 @@
 import glob
 import json
 import os
+import shlex
 import subprocess
 from datetime import datetime, timezone
 from pathlib import Path
@@ -186,6 +187,8 @@ def post_parse_setup(args):
         if resolved_model:
             args.UNRESOLVED_MODEL = args.MODEL
             args.MODEL = resolved_model
+    if hasattr(args, "runtime_args"):
+        args.runtime_args = shlex.split(args.runtime_args)
 
 
 def login_parser(subparsers):
@@ -690,6 +693,13 @@ def run_serve_perplexity_args(parser):
         default=CONFIG['ctx_size'],
         help="size of the prompt context (0 = loaded from model)",
     )
+    parser.add_argument(
+        "--runtime-args",
+        dest="runtime_args",
+        default="",
+        type=str,
+        help="arguments to add to runtime invocation",
+    )
 
 
 def bench_run_serve_perplexity_args(parser):
diff --git a/ramalama/model.py b/ramalama/model.py
index 4bc257d67..789959cdb 100644
--- a/ramalama/model.py
+++ b/ramalama/model.py
@@ -540,6 +540,7 @@ def build_exec_args_run(self, args, model_path, prompt):
             os.environ["LLAMA_PROMPT_PREFIX"] = "🦙 > "
 
         exec_args = ["llama-run", "-c", f"{args.context}", "--temp", f"{args.temp}"]
+        exec_args += args.runtime_args
 
         if args.seed:
             exec_args += ["--seed", args.seed]
@@ -601,7 +602,7 @@ def build_exec_args_serve(self, args, exec_model_path, chat_template_path=""):
                 args.port,
                 "--max-sequence-length",
                 f"{args.context}",
-            ]
+            ] + args.runtime_args
         else:
             exec_args = [
                 "llama-server",
@@ -613,7 +614,7 @@ def build_exec_args_serve(self, args, exec_model_path, chat_template_path=""):
                 f"{args.context}",
                 "--temp",
                 f"{args.temp}",
-            ]
+            ] + args.runtime_args
             if chat_template_path != "":
                 exec_args.extend(["--chat-template-file", chat_template_path])
         if args.seed:
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 88111804c..61e9740d2 100755
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -53,6 +53,16 @@ EOF
 	assert "$output" =~ ".*--cap-drop=all" "verify --cap-add is present"
 	assert "$output" =~ ".*no-new-privileges" "verify --no-new-privs is not present"
 
+    run_ramalama --dryrun run --runtime-args="--foo -bar" ${MODEL}
+    assert "$output" =~ ".*--foo" "--foo passed to runtime"
+    assert "$output" =~ ".*-bar" "-bar passed to runtime"
+
+    run_ramalama --dryrun run --runtime-args="--foo='a b c'" ${MODEL}
+    assert "$output" =~ ".*--foo=a b c" "argument passed to runtime with spaces"
+
+    run_ramalama 1 --dryrun run --runtime-args="--foo='a b c" ${MODEL}
+    assert "$output" =~ "No closing quotation" "error for improperly quoted runtime arguments"
+
 	if is_container; then
 	    run_ramalama --dryrun run --privileged ${MODEL}
 	    is "$output" ".*--privileged" "verify --privileged is set"
diff --git a/test/system/040-serve.bats b/test/system/040-serve.bats
index 3177516d2..df6979bc4 100755
--- a/test/system/040-serve.bats
+++ b/test/system/040-serve.bats
@@ -33,7 +33,7 @@ verify_begin=".*run --rm -i --label ai.ramalama --name"
         run_ramalama --dryrun serve --seed 1234 ${model}
         is "$output" ".*--seed 1234" "verify seed is set"
         if not_docker; then
-        is "$output" ".*--pull=newer" "verify pull is newer"
+            is "$output" ".*--pull=newer" "verify pull is newer"
         fi
         assert "$output" =~ ".*--cap-drop=all" "verify --cap-add is present"
         assert "$output" =~ ".*no-new-privileges" "verify --no-new-privs is not present"
@@ -44,15 +44,11 @@ verify_begin=".*run --rm -i --label ai.ramalama --name"
         run_ramalama 2 --dryrun serve --pull=bogus ${model}
         is "$output" ".*error: argument --pull: invalid choice: 'bogus'" "verify pull can not be bogus"
 
-        if is_container; then
-            run_ramalama --dryrun serve --privileged ${model}
-            is "$output" ".*--privileged" "verify --privileged is set"
-            assert "$output" != ".*--cap-drop=all" "verify --cap-add is not present"
-            assert "$output" != ".*no-new-privileges" "verify --no-new-privs is not present"
-        fi
-
-        run_ramalama stop --all
-        else
+        run_ramalama --dryrun serve --privileged ${model}
+        is "$output" ".*--privileged" "verify --privileged is set"
+        assert "$output" != ".*--cap-drop=all" "verify --cap-add is not present"
+        assert "$output" != ".*no-new-privileges" "verify --no-new-privs is not present"
+    else
         run_ramalama --dryrun serve ${model}
         assert "$output" =~ ".*--host 0.0.0.0" "Outside container sets host to 0.0.0.0"
         run_ramalama --dryrun serve --seed abcd --host 127.0.0.1 ${model}
@@ -62,6 +58,16 @@ verify_begin=".*run --rm -i --label ai.ramalama --name"
         is "${lines[0]}"  "Error: --nocontainer and --name options conflict. The --name option requires a container." "conflict between nocontainer and --name line"
     fi
 
+    run_ramalama --dryrun serve --runtime-args="--foo -bar" ${model}
+    assert "$output" =~ ".*--foo" "--foo passed to runtime"
+    assert "$output" =~ ".*-bar" "-bar passed to runtime"
+
+    run_ramalama --dryrun serve --runtime-args="--foo='a b c'" ${model}
+    assert "$output" =~ ".*--foo=a b c" "argument passed to runtime with spaces"
+
+    run_ramalama 1 --dryrun serve --runtime-args="--foo='a b c" ${model}
+    assert "$output" =~ "No closing quotation" "error for improperly quoted runtime arguments"
+
     run_ramalama 1 serve MODEL
     assert "$output" =~ "serving on port .*"
     assert "$output" =~ "Error: MODEL was not found in the Ollama registry"


Reviews:
user: login: sourcery-ai[bot]
body: Hey @edmcman - I've reviewed your changes - here's some feedback:

**Overall Comments**:
- Consider validating `runtime_args` to prevent users from injecting arbitrary commands.

<details>
<summary>Here's what I looked at during the review</summary>

- 🟢 **General issues**: all looks good
- 🟢 **Security**: all looks good
- 🟢 **Testing**: all looks good
- 🟢 **Complexity**: all looks good
- 🟢 **Documentation**: all looks good
</details>

***

<details>
<summary>Sourcery is free for open source - if you like our reviews please consider sharing them ✨</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20got%20an%20instant%20code%20review%20from%20%40SourceryAI%2C%20and%20it%20was%20brilliant%21%20It%27s%20free%20for%20open%20source%20and%20has%20a%20free%20trial%20for%20private%20code.%20Check%20it%20out%20https%3A//sourcery.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20got%20an%20instant%20code%20review%20from%20%40SourceryAI%2C%20and%20it%20was%20brilliant%21%20It%27s%20free%20for%20open%20source%20and%20has%20a%20free%20trial%20for%20private%20code.%20Check%20it%20out%20https%3A//sourcery.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https://sourcery.ai)
- [Facebook](https://www.facebook.com/sharer/sharer.php?u=https://sourcery.ai)

</details>

<sub>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
</sub>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T00:19:11Z
user: login: engelmi
body: I think some of the end-to-end tests need to be updated regarding the expected output.
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-12T06:32:02Z
user: login: sourcery-ai[bot]
body: Hey @edmcman - I've reviewed your changes and found some issues that need to be addressed.

**Blocking issues**:
- Reference to undefined variable 'chat_template_path'. ([link](https://github.com/containers/ramalama/pull/949/files#diff-df19838abdc928ad5378587b7b23b29b5623d368daf8b19d59f74863049aebb5R607))

**Overall Comments**:
- Consider renaming `--runtime-args` to `--llama-args` to be more specific.
- It might be helpful to add a short example of how to use the new `--runtime-args` option to the documentation.

<details>
<summary>Here's what I looked at during the review</summary>

- 🔴 **General issues**: 1 blocking issue
- 🟢 **Security**: all looks good
- 🟢 **Testing**: all looks good
- 🟢 **Complexity**: all looks good
- 🟢 **Documentation**: all looks good
</details>

***

<details>
<summary>Sourcery is free for open source - if you like our reviews please consider sharing them ✨</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20got%20an%20instant%20code%20review%20from%20%40SourceryAI%2C%20and%20it%20was%20brilliant%21%20It%27s%20free%20for%20open%20source%20and%20has%20a%20free%20trial%20for%20private%20code.%20Check%20it%20out%20https%3A//sourcery.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20got%20an%20instant%20code%20review%20from%20%40SourceryAI%2C%20and%20it%20was%20brilliant%21%20It%27s%20free%20for%20open%20source%20and%20has%20a%20free%20trial%20for%20private%20code.%20Check%20it%20out%20https%3A//sourcery.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https://sourcery.ai)
- [Facebook](https://www.facebook.com/sharer/sharer.php?u=https://sourcery.ai)

</details>

<sub>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
</sub>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-13T13:51:56Z

Review comments:
diff_hunk: @@ -690,6 +690,14 @@ def run_serve_perplexity_args(parser):
         default=CONFIG['ctx_size'],
         help="size of the prompt context (0 = loaded from model)",
     )
+    parser.add_argument(
+        "--runtime-arg",
+        dest="runtime_args",
+        action='append',
+        type=str,
+        default=[],
+        help="argument to add to runtime invocation"
path: ramalama/cli.py
user: login: engelmi
body: NIT:
```suggestion
        help="arguments to add to runtime invocation"
```
created_at: 2025-03-12T06:27:18Z
author_association: MEMBER
diff_hunk: @@ -690,6 +690,14 @@ def run_serve_perplexity_args(parser):
         default=CONFIG['ctx_size'],
         help="size of the prompt context (0 = loaded from model)",
     )
+    parser.add_argument(
+        "--runtime-arg",
+        dest="runtime_args",
+        action='append',
+        type=str,
path: ramalama/cli.py
user: login: engelmi
body: ```suggestion
        type=str,
        nargs="+",
```
created_at: 2025-03-12T06:30:05Z
author_association: MEMBER
diff_hunk: @@ -690,6 +690,14 @@ def run_serve_perplexity_args(parser):
         default=CONFIG['ctx_size'],
         help="size of the prompt context (0 = loaded from model)",
     )
+    parser.add_argument(
+        "--runtime-arg",
path: ramalama/cli.py
user: login: engelmi
body: NIT:
```suggestion
        "--runtime-args",
```
created_at: 2025-03-12T06:30:42Z
author_association: MEMBER
diff_hunk: @@ -600,7 +603,7 @@ def build_exec_args_serve(self, args, exec_model_path, chat_template_path=""):
                 f"{args.context}",
                 "--temp",
                 f"{args.temp}",
-            ]
+            ] + runtime_args
             if chat_template_path != "":
path: ramalama/model.py
user: login: sourcery-ai[bot]
body: **issue (bug_risk):** Reference to undefined variable 'chat_template_path'.

The function signature was modified to remove the 'chat_template_path' parameter, but the condition below still uses it. This will lead to a runtime error. Either reintroduce the parameter or remove the related code.
created_at: 2025-03-13T13:51:56Z
author_association: CONTRIBUTOR

PR comments:
user: login: sourcery-ai[bot]
created_at: 2025-03-12T00:18:37Z
body: <!-- Generated by sourcery-ai[bot]: start review_guide -->

## Reviewer's Guide by Sourcery

This pull request introduces the `--runtime-arg` option for the `run` and `serve` commands. This allows users to pass arguments directly to the llama executable. The implementation involves adding the argument to the CLI, incorporating it into the command execution logic for both `run` and `serve`, updating the documentation, and adding system tests to verify the functionality.

#### Sequence diagram for ramalama run with --runtime-args

```mermaid
sequenceDiagram
    participant User
    participant ramalama CLI
    participant llama-run

    User->>ramalama CLI: ramalama run --runtime-args="--jinja" ...
    ramalama CLI->>llama-run: llama-run -c <context> --temp <temp> --jinja ...
    activate llama-run
    llama-run-->>ramalama CLI: Output
    deactivate llama-run
    ramalama CLI-->>User: Output
```

#### Sequence diagram for ramalama serve with --runtime-args

```mermaid
sequenceDiagram
    participant User
    participant ramalama CLI
    participant llama-server

    User->>ramalama CLI: ramalama serve --runtime-args="--ctx 2048" ...
    ramalama CLI->>llama-server: llama-server --model <model_path> --host 0.0.0.0 --port <port> --ctx 2048 --temp <temp>
    activate llama-server
    llama-server-->>ramalama CLI: Output
    deactivate llama-server
    ramalama CLI-->>User: Output
```

### File-Level Changes

| Change | Details | Files |
| ------ | ------- | ----- |
| Introduces the `--runtime-args` option to the `run` and `serve` commands, enabling users to pass arguments directly to the underlying llama executable. | <ul><li>Added `--runtime-args` argument to `run` and `serve` commands in `cli.py`.</li><li>Modified `build_exec_args_run` in `model.py` to include runtime arguments.</li><li>Modified `build_exec_args_serve` in `model.py` to include runtime arguments.</li><li>Updated documentation for `ramalama-run.1.md`, `ramalama-serve.1.md`, and `ramalama-perplexity.1.md` to include the new `--runtime-args` option.</li><li>Added tests in `030-run.bats` and `040-serve.bats` to verify the functionality of `--runtime-args`.</li></ul> | `test/system/040-serve.bats`<br/>`ramalama/model.py`<br/>`ramalama/cli.py`<br/>`docs/ramalama-serve.1.md`<br/>`test/system/030-run.bats`<br/>`docs/ramalama-perplexity.1.md`<br/>`docs/ramalama-run.1.md` |

### Possibly linked issues

- **#948**: The PR implements the feature requested in the issue by adding a --runtime-arg option.

---

<details>
<summary>Tips and commands</summary>

#### Interacting with Sourcery

- **Trigger a new review:** Comment `@sourcery-ai review` on the pull request.
- **Continue discussions:** Reply directly to Sourcery's review comments.
- **Generate a GitHub issue from a review comment:** Ask Sourcery to create an
  issue from a review comment by replying to it. You can also reply to a
  review comment with `@sourcery-ai issue` to create an issue from it.
- **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull
  request title to generate a title at any time. You can also comment
  `@sourcery-ai title` on the pull request to (re-)generate the title at any time.
- **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in
  the pull request body to generate a PR summary at any time exactly where you
  want it. You can also comment `@sourcery-ai summary` on the pull request to
  (re-)generate the summary at any time.
- **Generate reviewer's guide:** Comment `@sourcery-ai guide` on the pull
  request to (re-)generate the reviewer's guide at any time.
- **Resolve all Sourcery comments:** Comment `@sourcery-ai resolve` on the
  pull request to resolve all Sourcery comments. Useful if you've already
  addressed all the comments and don't want to see them anymore.
- **Dismiss all Sourcery reviews:** Comment `@sourcery-ai dismiss` on the pull
  request to dismiss all existing Sourcery reviews. Especially useful if you
  want to start fresh with a new review - don't forget to comment
  `@sourcery-ai review` to trigger a new review!
- **Generate a plan of action for an issue:** Comment `@sourcery-ai plan` on
  an issue to generate a plan of action for it.

#### Customizing Your Experience

Access your [dashboard](https://app.sourcery.ai) to:
- Enable or disable review features such as the Sourcery-generated pull request
  summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.

#### Getting Help

- [Contact our support team](mailto:support@sourcery.ai) for questions or feedback.
- Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information.
- Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).

</details>

<!-- Generated by sourcery-ai[bot]: end review_guide -->
author_association: CONTRIBUTOR
user: login: rhatdan
created_at: 2025-03-12T10:59:26Z
body: Needs man page documention?

Sourcery has some good points.

Test required, basically just look at the dryrun tests.
author_association: MEMBER
user: login: rhatdan
created_at: 2025-03-12T10:59:37Z
body: Thanks @edmcman 
author_association: MEMBER
user: login: rhatdan
created_at: 2025-03-12T13:50:09Z
body: You are going to need to squash your commits, for some reason our DCO check is not handling the contributing CI from @engelmi 

Still need man pages and tests. Want to make sure I can add multiple --runtime-arg "--foo" --runtime-arg "--bar"
author_association: MEMBER
user: login: rhatdan
created_at: 2025-03-12T13:51:19Z
body: You can run `make validate` locally to descover quickly issues that will prevent your PR from being merged.
author_association: MEMBER
user: login: ericcurtin
created_at: 2025-03-12T13:54:23Z
body: You need to sign your commits to pass the DCO build, recommend reading the build logs for the others.
author_association: MEMBER
user: login: edmcman
created_at: 2025-03-12T13:58:54Z
body: Thanks, I will try to address the other issues after work tonight.
author_association: COLLABORATOR
user: login: edmcman
created_at: 2025-03-13T01:31:48Z
body: FYI [ramalama-serve.md](https://github.com/containers/ramalama/blob/main/docs/ramalama-serve.1.md) seems pretty specific to llama.cpp.  Is this right?  Does `ramalama-serve` not support `vllm`?
author_association: COLLABORATOR
user: login: edmcman
created_at: 2025-03-13T01:53:11Z
body: Ah, I don't think `nargs="+"` will work here because we might want to pass things that look like arguments to `argparse`.  The only way I know how to do this is too have `nargs=1` and use `--runtime-args=--arg1 --runtime-args=--arg2` and use append.  But if there is a better way I am all ears...
author_association: COLLABORATOR
user: login: engelmi
created_at: 2025-03-13T06:53:34Z
body: > Ah, I don't think `nargs="+"` will work here because we might want to pass things that look like arguments to `argparse`. The only way I know how to do this is too have `nargs=1` and use `--runtime-args=--arg1 --runtime-args=--arg2` and use append. But if there is a better way I am all ears...

Makes sense. With `nargs="+"` and `action="append"` we'll get a list of lists with one element. 
author_association: MEMBER
user: login: rhatdan
created_at: 2025-03-13T10:44:51Z
body: Well we could not support a list, and just force users to put all options into one command, which should work.

--runtime-arg="--arg1 --arg2=foo --arg3" 

author_association: MEMBER
user: login: ericcurtin
created_at: 2025-03-13T10:53:38Z
body: There are other implementations of arg appending tools, dracut is one off the top of my head (it's kargs, but the same concept), might be worth a little bit of research on existing implementations. Arg parsing, appending, etc. can get hairy (especially when adding multiple args at once), would be nice to get it right the first time.
author_association: MEMBER
user: login: ericcurtin
created_at: 2025-03-13T10:54:16Z
body: > FYI [ramalama-serve.md](https://github.com/containers/ramalama/blob/main/docs/ramalama-serve.1.md) seems pretty specific to llama.cpp. Is this right? Does `ramalama-serve` not support `vllm`?

It can also be used with vllm.

author_association: MEMBER
user: login: edmcman
created_at: 2025-03-13T12:43:00Z
body: > Well we could not support a list, and just force users to put all options into one command, which should work.
> 
> --runtime-arg="--arg1 --arg2=foo --arg3"

We then have to parse the the string to split it.  Though maybe that is easy with [this](https://docs.python.org/3/library/shlex.html#shlex.split).  I kind of like that plan, though as @ericcurtin suggested I'll take a look at dracut.
author_association: COLLABORATOR
user: login: edmcman
created_at: 2025-03-13T12:44:26Z
body: @ericcurtin Were you thinking of `--kernel-cmdline`?  I guess those don't really have dashes in them, so it seems like they didn't have to worry about that problem.

https://github.com/dracutdevs/dracut/blob/5d2bda46f4e75e85445ee4d3bd3f68bf966287b9/test/test-functions#L29
author_association: COLLABORATOR
user: login: edmcman
created_at: 2025-03-13T13:32:45Z
body: Can someone allow the CI to run the BATS test again?  I am having trouble running it locally.
author_association: COLLABORATOR
user: login: edmcman
created_at: 2025-03-13T14:29:54Z
body: Hmm.  I think there might be an issue with `run_ramalama` passing the quoted argument properly...
author_association: COLLABORATOR
user: login: edmcman
created_at: 2025-03-13T15:49:39Z
body: Woohoo. My BATS tests are finally passing :sweat:  I don't think the current bats failures are my fault.  Seems like a flaky test?
author_association: COLLABORATOR
user: login: ericcurtin
created_at: 2025-03-13T16:33:40Z
body: > @ericcurtin Were you thinking of `--kernel-cmdline`? I guess those don't really have dashes in them, so it seems like they didn't have to worry about that problem.
> 
> https://github.com/dracutdevs/dracut/blob/5d2bda46f4e75e85445ee4d3bd3f68bf966287b9/test/test-functions#L29

I think I was actually thinking of grubby 😅  I think that can add kargs.

It was just the first example of a arg appending tool I could think of. There may be some pitfalls to consider like how we interpret " , etc.

author_association: MEMBER
user: login: edmcman
created_at: 2025-03-15T15:56:46Z
body: Looks like grubby calls `poptParseArgvString` https://github.com/rhboot/grubby/blob/c01b0d5bb182bde35b464d14996acf354a3ada2e/grubby.c#L3804

> Although popt is usually used for parsing arguments already divided into an argv-style array, some programs need to parse strings that are formatted identically to command lines. To facilitate this, popt provides a function that parses a string into an array of strings, using rules similiar to normal shell parsing.

This sounds like `shlex.split`, which I am using now.

My thoughts:
1. Add a test or two involving quoted arguments
2. Move the `shlex.split` calls closer to the argument parsing, rather than in `model.py` where they are currently.
author_association: COLLABORATOR
user: login: rhatdan
created_at: 2025-03-17T10:54:14Z
body: You need to squash your commits.

git rebase -i origin 
git push --force


author_association: MEMBER
user: login: rhatdan
created_at: 2025-03-17T14:08:42Z
body: LGTM
author_association: MEMBER