Skip to content

Commit a728315

Browse files
authored
Merge pull request #1615 from grycap/devel
Devel
2 parents 2cc3e0b + c0c3bee commit a728315

File tree

8 files changed

+37
-20
lines changed

8 files changed

+37
-20
lines changed

IM/SSH.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,15 @@ def __init__(self, host, user, passwd=None, private_key=None, port=22, proxy_hos
131131

132132
self.private_key = private_key
133133
private_key_obj.seek(0)
134-
self.private_key_obj = paramiko.RSAKey.from_private_key(
135-
private_key_obj)
134+
135+
if "BEGIN RSA PRIVATE KEY" in private_key:
136+
self.private_key_obj = paramiko.RSAKey.from_private_key(private_key_obj)
137+
elif "BEGIN DSA PRIVATE KEY" in private_key:
138+
self.private_key_obj = paramiko.DSSKey.from_private_key(private_key_obj)
139+
elif "BEGIN EC PRIVATE KEY" in private_key:
140+
self.private_key_obj = paramiko.ECDSAKey.from_private_key(private_key_obj)
141+
elif "BEGIN OPENSSH PRIVATE KEY" in private_key:
142+
self.private_key_obj = paramiko.Ed25519Key.from_private_key(private_key_obj)
136143

137144
def __del__(self):
138145
self.close()

IM/connectors/Kubernetes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def _generate_pod_data(self, namespace, name, outports, system, volumes, configm
443443
if tags:
444444
for k, v in tags.items():
445445
# Remove special characters
446-
pod_data['metadata']['labels'][k] = re.sub('[!"#$%&\'()*+,/:;<=>?@[\\]^`{|}~]', '', v).lstrip("_-")
446+
pod_data['metadata']['labels'][k] = re.sub('[!"#$%&\'()*+,/:;<=>?@[\\]^`{|}~ ]', '', v).lstrip("_-")
447447

448448
containers = [{
449449
'name': name,
@@ -553,7 +553,7 @@ def launch(self, inf, radl, requested_radl, num_vm, auth_data):
553553
vm = VirtualMachine(inf, None, self.cloud, radl, requested_radl, self)
554554
vm.destroy = True
555555
inf.add_vm(vm)
556-
pod_name = re.sub('[!"#$%&\'()*+,/:;<=>?@[\\]^`{|}~_]', '-', system.name)
556+
pod_name = re.sub('[!"#$%&\'()*+,/:;<=>?@[\\]^`{|}~_ ]', '-', system.name)
557557

558558
volumes = self._create_volumes(namespace, system, pod_name, auth_data)
559559

doc/source/client.rst

+3
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ There are several ways to get the EGI AAI token:
501501

502502
token = command(oidc-token OIDC_ACCOUNT)
503503

504+
* It is also possible to get the token using the EGI AAI endpoint. The token can be obtained in the
505+
`Check-in Token Portal <https://aai.egi.eu/token/>`_.
506+
504507
* Another way is using the IM-Dashboard (:ref:`use-dashboard`). In the "Advanced" menu, the "Settings"
505508
item enables getting the some configuration settings as the OIDC issuer or the current user's
506509
access token.

docker-devel/Dockerfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile to create a container with the IM service
2-
FROM ubuntu:24.04
2+
FROM ubuntu:22.04
33
ARG BRANCH=devel
44
LABEL maintainer="Miguel Caballer <[email protected]>"
55
LABEL version="1.17.0"
@@ -12,18 +12,19 @@ RUN apt-get update && apt-get install --no-install-recommends -y patch wget pyth
1212

1313
# Install IM
1414
RUN apt-get update && apt-get install --no-install-recommends -y python3-setuptools python3-pip git && \
15-
pip3 install --break-system-packages msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
16-
pip3 install --break-system-packages pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
17-
pip3 install --break-system-packages git+https://github.com/micafer/libcloud@ost_nets_extra && \
18-
pip3 install --break-system-packages apache-libcloud==3.8.0 git+https://github.com/grycap/im@$BRANCH && \
15+
pip3 install -U pip && \
16+
pip3 install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
17+
pip3 install pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
18+
pip3 install git+https://github.com/micafer/libcloud@ost_nets_extra && \
19+
pip3 install apache-libcloud==3.8.0 git+https://github.com/grycap/im@$BRANCH && \
1920
apt-get purge -y python3-pip git && \
2021
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf ~/.cache/
2122

2223
# Patch libcloud to add network extra
2324
# untill this PR is merged and released
2425
# https://github.com/apache/libcloud/pull/2016
2526
COPY ost.patch /tmp/ost.patch
26-
RUN patch /usr/local/lib/python3.12/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
27+
RUN patch /usr/local/lib/python3.10/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
2728

2829
# Copy im configuration files
2930
RUN mkdir /etc/im
@@ -38,7 +39,7 @@ RUN sed -i -e 's/VM_NUM_USE_CTXT_DIST = 30/VM_NUM_USE_CTXT_DIST = 3/g' /etc/im/i
3839
COPY ansible.cfg /etc/ansible/ansible.cfg
3940

4041
# Fix boto issue https://github.com/boto/boto/issues/3783
41-
COPY endpoints.json /usr/local/lib/python3.12/dist-packages/boto/endpoints.json
42+
COPY endpoints.json /usr/local/lib/python3.10/dist-packages/boto/endpoints.json
4243

4344
# Start IM service
4445
CMD /usr/local/bin/im_service

docker-py3/Dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile to create a container with the IM service
2-
FROM ubuntu:24.04
2+
FROM ubuntu:22.04
33

44
ENV VERSION=1.17.0
55

@@ -14,17 +14,18 @@ RUN apt-get update && apt-get install --no-install-recommends -y patch wget pyth
1414

1515
# Install IM
1616
RUN apt-get update && apt-get install --no-install-recommends -y python3-setuptools python3-pip git && \
17-
pip3 install --break-system-packages msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
18-
pip3 install --break-system-packages pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
19-
pip3 install --break-system-packages apache-libcloud==3.8.0 IM==${VERSION} && \
17+
pip3 install -U pip && \
18+
pip3 install msrest msrestazure azure-common azure-mgmt-storage azure-mgmt-compute azure-mgmt-network azure-mgmt-resource azure-mgmt-dns azure-identity==1.8.0 && \
19+
pip3 install pyOpenSSL cheroot xmltodict pymongo ansible==8.7.0&& \
20+
pip3 install apache-libcloud==3.8.0 && IM==${VERSION}\
2021
apt-get purge -y python3-pip git && \
2122
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf ~/.cache/
2223

2324
# Patch libcloud to add network extra
2425
# untill this PR is merged and released
2526
# https://github.com/apache/libcloud/pull/2016
2627
COPY ost.patch /tmp/ost.patch
27-
RUN patch /usr/local/lib/python3.12/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
28+
RUN patch /usr/local/lib/python3.10/dist-packages/libcloud/compute/drivers/openstack.py < /tmp/ost.patch && rm /tmp/ost.patch
2829

2930
# Copy im configuration files
3031
RUN mkdir /etc/im
@@ -36,7 +37,7 @@ RUN wget https://raw.githubusercontent.com/grycap/im/v${VERSION}/etc/logging.con
3637
COPY ansible.cfg /etc/ansible/ansible.cfg
3738

3839
# Fix boto issue https://github.com/boto/boto/issues/3783
39-
COPY endpoints.json /usr/local/lib/python3.12/dist-packages/boto/endpoints.json
40+
COPY endpoints.json /usr/local/lib/python3.10/dist-packages/boto/endpoints.json
4041

4142
# Start IM service
4243
CMD ["/usr/local/bin/im_service"]

test/files/privatekeyec.pem

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-----BEGIN OPENSSH PRIVATE KEY-----
2+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
3+
QyNTUxOQAAACAJRqoIjiHNnr8AugARO9zIoSQP+lIRmSkl92mcc8T9JAAAAKANznLhDc5y
4+
4QAAAAtzc2gtZWQyNTUxOQAAACAJRqoIjiHNnr8AugARO9zIoSQP+lIRmSkl92mcc8T9JA
5+
AAAECBnGuXE7SFHDP32PbNFbfXkkZNpeHJKG5luU1H7kH1HQlGqgiOIc2evwC6ABE73Mih
6+
JA/6UhGZKSX3aZxzxP0kAAAAF21pY2FmZXJAREVTS1RPUC02Vk9DNEMzAQIDBAUG
7+
-----END OPENSSH PRIVATE KEY-----

test/unit/AppDB.py

-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ def test_get_site_url(self, requests):
9999
requests.side_effect = self.get_response
100100
res = AppDB.get_site_url("8016G0", "openstack")
101101
self.assertEqual(res, "https://cloud.recas.ba.infn.it:5000")
102-
res = AppDB.get_site_url("8015G0", "occi")
103-
self.assertEqual(res, "http://cloud.recas.ba.infn.it:8787/occi/")
104102

105103
@patch('requests.request')
106104
def test_get_image_id(self, requests):

test/unit/SSH.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_str(self):
4747

4848
@patch('paramiko.SSHClient')
4949
def test_test_connectivity(self, ssh_client):
50-
ssh = SSHRetry("host", "user", "passwd", read_file_as_string("../files/privatekey.pem"))
50+
ssh = SSHRetry("host", "user", "passwd", read_file_as_string("../files/privatekeyec.pem"))
5151
success = ssh.test_connectivity(5)
5252
self.assertTrue(success)
5353

0 commit comments

Comments
 (0)