Beispiel #1
0
    def get_os_data(self, image, os_type):
        os_data = {
            'os_distro': self.get_os_distro(image.get('Name', ''), os_type),
            'os_arch': image.get('Architecture', '')
        }

        return OS(os_data, strict=False)
Beispiel #2
0
 def get_os_data(self, vm_storage_profile):
     os_data = {
         'os_distro': self.get_os_distro(self.get_os_type(vm_storage_profile.os_disk),
                                         vm_storage_profile.image_reference.offer),
         'details': self.get_os_details(vm_storage_profile.image_reference)
     }
     return OS(os_data, strict=False)
 def get_os_data(self, os_name_en, os_type):
     os_data = {
         "os_distro": self.get_os_distro(os_name_en, os_type),
         "os_arch": self.get_os_arch(os_name_en),
         "details": os_name_en,
     }
     return OS(os_data, strict=False)
Beispiel #4
0
    def get_os_data(self, vm_storage_profile):
        if vm_storage_profile.image_reference is not None:
            try:
                os_type = self.get_os_type(vm_storage_profile.os_disk)
                image_reference = vm_storage_profile.image_reference
                offer = vm_storage_profile.image_reference.offer

                if os_type and offer is not None:
                    try:
                        os_data = {
                            'os_distro': self.get_os_distro(os_type, offer),
                            'details': self.get_os_details(image_reference)
                        }
                        return OS(os_data, strict=False)

                    except Exception as e:
                        print(f'[ERROR: GET OS Distro Data]: {e}')

            except Exception as e:
                print(f'[ERROR: GET OS Data]: {e}')
Beispiel #5
0
    def get_os_type_and_data(self, instance, public_images):

        disk_info = instance.get("disks", [])
        os_dists = disk_info[0].get('licenses',
                                    []) if len(disk_info) > 0 else []
        licenses = disk_info[0].get('licenses',
                                    []) if len(disk_info) > 0 else []
        os_type = "LINUX"
        os_identity = ''

        for idx, val in enumerate(os_dists):
            os_items = val.split("/")
            os_identity = os_items[-1].lower()
            if idx == 0:
                if "windows" in os_identity:
                    os_type = "WINDOWS"
                break

        os_data = self._get_appropriate_image_info(os_identity, licenses,
                                                   public_images)
        return os_type, OS(os_data, strict=False)