Fix argparse option order and generated service invocation
This commit is contained in:
@@ -52,9 +52,9 @@ JSON
|
||||
<array>
|
||||
<string>${PYTHON}</string>
|
||||
<string>${AGENT}</string>
|
||||
<string>serve</string>
|
||||
<string>--config</string>
|
||||
<string>${CONFIG}</string>
|
||||
<string>serve</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
@@ -113,7 +113,7 @@ Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=${PYTHON} ${AGENT} serve --config ${CONFIG}
|
||||
ExecStart=${PYTHON} ${AGENT} --config ${CONFIG} serve
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
User=root
|
||||
|
||||
@@ -501,14 +501,22 @@ def serve(config: Dict[str, Any]) -> None:
|
||||
def build_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(description="ollama-plagin-swap remote agent")
|
||||
parser.add_argument("--config", help="path to JSON configuration")
|
||||
config_parent = argparse.ArgumentParser(add_help=False)
|
||||
config_parent.add_argument("--config", help="path to JSON configuration")
|
||||
subparsers = parser.add_subparsers(dest="command")
|
||||
subparsers.add_parser("serve", help="run HTTP agent and watcher")
|
||||
status_parser = subparsers.add_parser("status", help="print one status report")
|
||||
subparsers.add_parser("serve", parents=[config_parent], help="run HTTP agent and watcher")
|
||||
status_parser = subparsers.add_parser(
|
||||
"status", parents=[config_parent], help="print one status report"
|
||||
)
|
||||
status_parser.add_argument("--json", action="store_true")
|
||||
status_parser.add_argument("--dry-run", action="store_true")
|
||||
check_parser = subparsers.add_parser("check", help="run one threshold check")
|
||||
check_parser = subparsers.add_parser(
|
||||
"check", parents=[config_parent], help="run one threshold check"
|
||||
)
|
||||
check_parser.add_argument("--dry-run", action="store_true")
|
||||
restart_parser = subparsers.add_parser("restart-now", help="restart ollama service now")
|
||||
restart_parser = subparsers.add_parser(
|
||||
"restart-now", parents=[config_parent], help="restart ollama service now"
|
||||
)
|
||||
restart_parser.add_argument("--force", action="store_true")
|
||||
restart_parser.add_argument("--reason", default="manual")
|
||||
restart_parser.add_argument("--dry-run", action="store_true")
|
||||
|
||||
Reference in New Issue
Block a user