Skip to content

Commit

Permalink
Merge default images for podman/testcloud [psss#169]
Browse files Browse the repository at this point in the history
  • Loading branch information
psss committed Mar 23, 2020
2 parents e6a7308 + 10a0c9e commit b28bb16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion tmt/steps/provision/podman.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from tmt.steps.provision.base import ProvisionBase
from tmt.utils import GeneralError, SpecificationError

DEFAULT_IMAGE = 'fedora'


class ProvisionPodman(ProvisionBase):
""" Podman Provisioner """
Expand All @@ -16,7 +18,7 @@ def __init__(self, data, step):
}

# Get image from provision options
self.image = self.option('image')
self.image = self.option('image') or DEFAULT_IMAGE
self.pull = self.option('container_pull')

# Instances variables initialized later
Expand Down
9 changes: 4 additions & 5 deletions tmt/steps/provision/testcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
</domain>
"""

# Default image
DEFAULT_IMAGE = 'fedora'

# VM defaults
DEFAULT_MEMORY = 2048 # MiB
DEFAULT_DISK_SIZE = 10 # GiB
Expand Down Expand Up @@ -153,10 +156,6 @@ def __init__(self, data, step):
'shell': self._prepare_shell,
}

# Get image from provision options
if not self.option('image'):
raise GeneralError('No image specified')

# Initialize testcloud image
self.image = None

Expand Down Expand Up @@ -219,7 +218,7 @@ def go(self):

# If image does not start with http/https/file, consider it a mapping
# value and try to guess the URL
image_url = self.option('image')
image_url = self.option('image') or DEFAULT_IMAGE
if not re.match(r'^(?:https?|file)://.*', image_url):
image_url = guess_image_url(image_url)

Expand Down

0 comments on commit b28bb16

Please sign in to comment.