From 76e01636e28cdd5fc187a06f8635657d188dbb06 Mon Sep 17 00:00:00 2001 From: geyaning Date: Thu, 13 Jul 2023 13:28:23 +0800 Subject: [PATCH] The rstrip() method removes slashes at the end of the path string instead of slicing Signed-off-by: geyaning --- avocado/utils/cloudinit.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/avocado/utils/cloudinit.py b/avocado/utils/cloudinit.py index 533816ab35..3b6e0cb157 100644 --- a/avocado/utils/cloudinit.py +++ b/avocado/utils/cloudinit.py @@ -150,9 +150,7 @@ def do_POST(self): Respond with status 200 if the instance phoned back. """ - path = self.path[1:] - if path[-1] == "/": - path = path[:-1] + path = self.path[1:].rstrip("/") if path == self.server.instance_id: self.server.instance_phoned_back = True self.send_response(200)