diff --git a/.github/workflows/blacked.yml b/.github/workflows/blacked.yml index 0cd64dd6..0890319b 100644 --- a/.github/workflows/blacked.yml +++ b/.github/workflows/blacked.yml @@ -17,7 +17,7 @@ jobs: - name: Create Pull Request if: steps.git-check.outputs.modified == 'true' id: cpr - uses: peter-evans/create-pull-request@v4.1.4 + uses: peter-evans/create-pull-request@v4.2.0 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: fix(Linting):blacked code diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index 9c71901f..20e757f1 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -424,6 +424,8 @@ def get_Images(self): min_disk=img["min_disk"], min_ram=img["min_ram"], status=img["status"], + os_version=img.get("os_version", ""), + os_distro=img.get("os_distro", ""), created_at=img["created_at"], updated_at=img["updated_at"], openstack_id=img["id"], @@ -463,6 +465,8 @@ def prepare_image(self, img): min_disk=img["min_disk"], min_ram=img["min_ram"], status=img["status"], + os_version=img.get("os_version", ""), + os_distro=img.get("os_distro", ""), created_at=img["created_at"], updated_at=img["updated_at"], openstack_id=img["id"], @@ -551,6 +555,8 @@ def get_Image_with_Tag(self, id): min_disk=img["min_disk"], min_ram=img["min_ram"], status=img["status"], + os_version=img.get("os_version", ""), + os_distro=img.get("os_distro", ""), created_at=img["created_at"], updated_at=img["updated_at"], openstack_id=img["id"], @@ -599,6 +605,8 @@ def get_Images_by_filter(self, filter_list): status=img["status"], created_at=img["created_at"], updated_at=img["updated_at"], + os_version=img.get("os_version", ""), + os_distro=img.get("os_distro", ""), openstack_id=img["id"], description=description, tag=tags, @@ -2185,15 +2193,13 @@ def create_snapshot(self, openstack_id, name, elixir_id, base_tags, description) ) ) - server=self.conn.get_server_by_id(openstack_id) + server = self.conn.get_server_by_id(openstack_id) LOG.info(server) if server is None: LOG.exception(f"Instance {openstack_id} not found") raise serverNotFoundException try: - snapshot_munch = self.conn.create_image_snapshot( - server=server, name=name - ) + snapshot_munch = self.conn.create_image_snapshot(server=server, name=name) except ConflictException as e: LOG.exception(f"Create snapshot {openstack_id} error: {e}") diff --git a/VirtualMachineService/VirtualMachineService-remote b/VirtualMachineService/VirtualMachineService-remote index f4268f60..56dd56c0 100755 --- a/VirtualMachineService/VirtualMachineService-remote +++ b/VirtualMachineService/VirtualMachineService-remote @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Autogenerated by Thrift Compiler (0.15.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/VirtualMachineService/VirtualMachineService.py b/VirtualMachineService/VirtualMachineService.py index 533e7c59..2929961f 100644 --- a/VirtualMachineService/VirtualMachineService.py +++ b/VirtualMachineService/VirtualMachineService.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.15.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/VirtualMachineService/constants.py b/VirtualMachineService/constants.py index 55b1d3fd..a334d1fc 100644 --- a/VirtualMachineService/constants.py +++ b/VirtualMachineService/constants.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.15.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # diff --git a/VirtualMachineService/ttypes.py b/VirtualMachineService/ttypes.py index ceec3ff1..64eb8238 100644 --- a/VirtualMachineService/ttypes.py +++ b/VirtualMachineService/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.15.0) +# Autogenerated by Thrift Compiler (0.16.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -796,6 +796,8 @@ class Image(object): - description: The description of the image - tag: List of tags from image - is_snapshot: If the Image is a snapshot + - os_version + - os_distro """ @@ -811,6 +813,8 @@ def __init__( description=None, tag=None, is_snapshot=None, + os_version=None, + os_distro=None, ): self.name = name self.min_disk = min_disk @@ -822,6 +826,8 @@ def __init__( self.description = description self.tag = tag self.is_snapshot = is_snapshot + self.os_version = os_version + self.os_distro = os_distro def read(self, iprot): if ( @@ -919,6 +925,24 @@ def read(self, iprot): self.is_snapshot = iprot.readBool() else: iprot.skip(ftype) + elif fid == 11: + if ftype == TType.STRING: + self.os_version = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + else: + iprot.skip(ftype) + elif fid == 12: + if ftype == TType.STRING: + self.os_distro = ( + iprot.readString().decode("utf-8", errors="replace") + if sys.version_info[0] == 2 + else iprot.readString() + ) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -996,6 +1020,22 @@ def write(self, oprot): oprot.writeFieldBegin("is_snapshot", TType.BOOL, 10) oprot.writeBool(self.is_snapshot) oprot.writeFieldEnd() + if self.os_version is not None: + oprot.writeFieldBegin("os_version", TType.STRING, 11) + oprot.writeString( + self.os_version.encode("utf-8") + if sys.version_info[0] == 2 + else self.os_version + ) + oprot.writeFieldEnd() + if self.os_distro is not None: + oprot.writeFieldBegin("os_distro", TType.STRING, 12) + oprot.writeString( + self.os_distro.encode("utf-8") + if sys.version_info[0] == 2 + else self.os_distro + ) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -2632,6 +2672,20 @@ def __ne__(self, other): None, None, ), # 10 + ( + 11, + TType.STRING, + "os_version", + "UTF8", + None, + ), # 11 + ( + 12, + TType.STRING, + "os_distro", + "UTF8", + None, + ), # 12 ) all_structs.append(VM) VM.thrift_spec = ( diff --git a/portal_client.thrift b/portal_client.thrift index 28281340..c462a0b2 100644 --- a/portal_client.thrift +++ b/portal_client.thrift @@ -99,6 +99,10 @@ struct Image{ /** If the Image is a snapshot*/ 10:optional bool is_snapshot + + 11:optional string os_version + 12:optional string os_distro + } /** * This Struct defines a VirtualMachine. diff --git a/requirements.txt b/requirements.txt index 515efe52..915f1b28 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -setuptools==65.4.1 +setuptools==65.5.0 thrift==0.16.0 python-keystoneclient==5.0.1 -openstacksdk ==0.101.0 +openstacksdk ==0.102.0 deprecated == 1.2.13 ansible==6.5.0 Click==8.1.3