Skip to content

Commit

Permalink
Merge pull request #2069 from FroggyFlox/Issue2017_Rock-on_parse_Imag…
Browse files Browse the repository at this point in the history
…e_Tag

Allow multiple versions for a docker image. Fixes #2017
  • Loading branch information
phillxnet authored Nov 12, 2019
2 parents fe907ce + 2202447 commit ce3412f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/rockstor/scripts/rockon_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"""

import sys

from storageadmin.models import (RockOn, DContainer)
from system.osi import run_command


DOCKER = '/usr/bin/docker'


Expand All @@ -44,9 +44,11 @@ def delete_rockon():
# We don't throw any exceptions because we want to ensure metadata is
# deleted for sure. It would be nice to fully delete containers and
# images, but that's not a hard requirement.
run_command([DOCKER, 'stop', c.name], throw=False)
run_command([DOCKER, 'rm', c.name], throw=False)
run_command([DOCKER, 'rmi', c.dimage.name], throw=False)
run_command([DOCKER, 'stop', c.name], throw=False, log=True)
run_command([DOCKER, 'rm', c.name], throw=False, log=True)
# Get image name with tag information
img_plus_tag = '{}:{}'.format(c.dimage.name, c.dimage.tag)
run_command([DOCKER, 'rmi', img_plus_tag], throw=False, log=True)

ro.delete()
print('Rock-On(%s) metadata in the db is deleted' % name)
Expand Down
4 changes: 2 additions & 2 deletions src/rockstor/storageadmin/views/rockon.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def _create_update_meta(self, name, r_d):
co.dimage.delete()
if (co is None):
co = DContainer(name=c, rockon=ro)
defaults = {'tag': c_d.get('tag', 'latest'),
'repo': 'na', }
defaults = {'repo': 'na', }
io, created = DImage.objects.get_or_create(name=c_d['image'],
tag=c_d.get('tag', 'latest'),
defaults=defaults)
co.dimage = io
co.launch_order = c_d['launch_order']
Expand Down

0 comments on commit ce3412f

Please sign in to comment.