Skip to content

Commit

Permalink
Merge pull request #476 from rhatdan/oci
Browse files Browse the repository at this point in the history
Failover to OCI when push fails with default push mechanism
  • Loading branch information
rhatdan authored Nov 21, 2024
2 parents 1529a9b + fc0546e commit 68ab492
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 14 additions & 2 deletions ramalama/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
perror,
run_cmd,
)
from ramalama.model import model_types
from ramalama.oci import OCI
from ramalama.ollama import Ollama
from ramalama.shortnames import Shortnames
Expand Down Expand Up @@ -584,8 +585,19 @@ def push_cli(args):
if not tgt:
tgt = target

model = New(tgt, args)
model.push(source, args)
try:
model = New(tgt, args)
model.push(source, args)
except KeyError as e:
for mtype in model_types:
if model.startswith(mtype + "://"):
raise e
try:
# attempt to push as a container image
m = OCI(model, config.get('engine', container_manager()))
m.push(args)
except Exception:
raise e


def run_parser(subparsers):
Expand Down
1 change: 0 additions & 1 deletion ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def remove(self, args):

self.garbage_collection(args)


def _image(self, args):
if args.image != default_image():
return args.image
Expand Down

0 comments on commit 68ab492

Please sign in to comment.