Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docker/Dockerfile.oidc
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Dockerfile to create a container with the IM client
FROM ubuntu:22.04
FROM ubuntu:24.04
LABEL maintainer="Miguel Caballer <micafer1@upv.es>"
LABEL version="1.8.3-oidc"
LABEL description="Container image to run the IM client. (http://www.grycap.upv.es/im)"

# Install python3
RUN apt update && \
apt install -y --no-install-recommends gnupg && \
echo "deb https://repo.data.kit.edu/ubuntu/22.04 ./" >> /etc/apt/sources.list && \
echo "deb https://repo.data.kit.edu/ubuntu/24.04 ./" >> /etc/apt/sources.list && \
apt-key adv --keyserver hkp://pgp.surfnet.nl --recv-keys ACDFB08FDC962044D87FF00B512839863D487A87 && \
apt update && \
apt install -y --no-install-recommends python3-requests jq python3-pip oidc-agent && \
pip install im-client==1.8.3 && \
pip install --break-system-packages im-client==1.8.3 && \
apt-get purge -y python-pip && \
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf ~/.cache/


ENTRYPOINT ["/usr/local/bin/im_client.py"]
ENTRYPOINT ["/usr/local/bin/im_client"]
2 changes: 2 additions & 0 deletions imclient/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ def get_parser():
help="Use infrastructure name instead of ID")
parser.add_option("-s", "--system_name", default=None, dest="system_name", nargs=1, type="string",
help="Filter VMs by system name")
parser.add_option("-y", "--yes", action="store_true", default=False, dest="yes",
help="Do not ask for confirmation when performing operations that may cause data loss")
parser.add_operation_help('list', '')
parser.add_operation_help('create', '<radl_file> [async_flag]')
parser.add_operation_help('destroy', '<inf_id>')
Expand Down
8 changes: 6 additions & 2 deletions imclient/imclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,12 @@ def destroy(self, inf_id, asyncr=False):

def _destroy(self):
inf_id = self._get_inf_id()
res = input(f"Are you sure you want to destroy Inf:{inf_id}?\n"
"This process cannot be undone!!.\n(yes/no):").strip().lower()
if not self.options.yes:
res = input(f"Are you sure you want to destroy Inf:{inf_id}?\n"
"This process cannot be undone!!.\n(yes/no):").strip().lower()
else:
res = "yes"

if res == "yes":
return self.destroy(inf_id)
else:
Expand Down
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
requires = [
"setuptools~=69.5",
"wheel~=0.46"
]
build-backend = "setuptools.build_meta"


[project]
name = "IM-client"
name = "im-client"
version = "1.8.3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "1.8.3"
version = "1.8.4"

description = "IM is a tool to manage virtual infrastructures on Cloud deployments"
readme = "README.md"
license = "GPL-3.0-or-later"
license = {text = "GPL version 3, http://www.gnu.org/licenses/gpl-3.0.txt"}


authors = [
{ name = "GRyCAP - Universitat Politecnica de Valencia", email = "micafer1@upv.es" }
Expand Down
15 changes: 15 additions & 0 deletions test/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ def test_destroy(self, input_mock, server_proxy, requests):
options.quiet = False
options.name = False
options.force = False
options.yes = False
parser = MagicMock()

out = StringIO()
Expand Down Expand Up @@ -685,6 +686,7 @@ def test_destroy(self, input_mock, server_proxy, requests):
input_mock.return_value = "a"
out = StringIO()
sys.stdout = out
options.yes = False
options.force = True
options.xmlrpc = None
options.restapi = "https://localhost:8800"
Expand All @@ -695,6 +697,19 @@ def test_destroy(self, input_mock, server_proxy, requests):
self.assertIn("Canceled by the user", output)
sys.stdout = oldstdout

out = StringIO()
sys.stdout = out
options.yes = True
options.force = False
options.xmlrpc = None
options.restapi = "https://localhost:8800"
requests.side_effect = self.get_response
res = main("destroy", options, ["infid"], parser)
self.assertEqual(res, True)
output = out.getvalue().strip()
self.assertIn("Infrastructure successfully destroyed", output)
sys.stdout = oldstdout

@patch('requests.request')
@patch("imclient.imclient.ServerProxy")
def test_start(self, server_proxy, requests):
Expand Down
Loading