Skip to content

Commit 6c0c75f

Browse files
authored
Merge pull request ceph#44812 from rhcs-dashboard/box-remove-error
cephadm/box: fix remove image tar error
2 parents 18618bf + 71c4935 commit 6c0c75f

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

src/cephadm/box/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
FROM centos:8 as centos-systemd
33
ENV container docker
44
ENV CEPHADM_PATH=/usr/local/sbin/cephadm
5+
6+
# Centos met EOL and the content of the CentOS 8 repos has been moved to vault.centos.org
7+
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
8+
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
9+
510
RUN dnf -y install chrony firewalld lvm2 \
611
openssh-server openssh-clients python3 \
712
yum-utils sudo which && dnf clean all
@@ -23,7 +28,5 @@ EXPOSE 22
2328

2429
FROM centos-systemd-docker
2530
WORKDIR /root
26-
# VOLUME /var/run/docker.sock
27-
COPY start /usr/local/bin
2831

2932
CMD [ "/usr/sbin/init" ]

src/cephadm/box/box.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@
1414
CEPH_IMAGE = 'quay.ceph.io/ceph-ci/ceph:master'
1515
BOX_IMAGE = 'cephadm-box:latest'
1616

17+
# NOTE: this image tar is a trickeroo so cephadm won't pull the image everytime
18+
# we deploy a cluster. Keep in mind that you'll be responsible of pulling the
19+
# image yourself with `box cluster setup`
20+
CEPH_IMAGE_TAR = 'docker/ceph/image/quay.ceph.image.tar'
21+
22+
def remove_ceph_image_tar():
23+
if os.path.exists(CEPH_IMAGE_TAR):
24+
os.remove(CEPH_IMAGE_TAR)
25+
1726
def cleanup_box() -> None:
1827
osd.cleanup()
28+
remove_ceph_image_tar()
1929

2030
def image_exists(image_name: str):
2131
# extract_tag
@@ -39,10 +49,10 @@ def get_ceph_image():
3949
run_shell_command(f'docker build -t {CEPH_IMAGE} docker/ceph')
4050
if not os.path.exists('docker/ceph/image'):
4151
os.mkdir('docker/ceph/image')
42-
image_tar = 'docker/ceph/image/quay.ceph.image.tar'
43-
if not os.path.exists(image_tar):
44-
os.remove(image_tar)
45-
run_shell_command(f'docker save {CEPH_IMAGE} -o {image_tar}')
52+
53+
remove_ceph_image_tar()
54+
55+
run_shell_command(f'docker save {CEPH_IMAGE} -o {CEPH_IMAGE_TAR}')
4656
print('Ceph image added')
4757

4858
def get_box_image():
@@ -92,10 +102,6 @@ def bootstrap(self):
92102

93103
extra_args = []
94104

95-
shared_ceph_folder = os.environ.get('SHARED_CEPH_FOLDER')
96-
if shared_ceph_folder:
97-
extra_args.extend(['--shared_ceph_folder', shared_ceph_folder])
98-
99105
extra_args.append('--skip-pull')
100106

101107
# cephadm prints in warning, let's redirect it to the output so shell_command doesn't

0 commit comments

Comments
 (0)