"""This module contains all necessary Model Component Objects for linux.ubuntu2204."""fromlinux.ubuntuimportUbuntuHost,UbuntuServer,UbuntuDesktopfromlinux.base_objectsimportLinuxNetplanHostfromfirewheel.control.experiment_graphimport(IncorrectConflictHandlerError,require_class,)
[docs]defubuntu_2204_conflict_handler(entry_name,_decorator_value,_current_instance_value):""" The conflict handler for functions overwritten in :py:class`linux.ubuntu2204.Ubuntu2204Host` Ubuntu2204Host that are also implemented elsewhere Args: entry_name (str): A string describing the attribute that has a conflict _decorator_value (any): The value of the attribute from the class that it is trying to be decorated by _current_instance_value (any): The current value of the conflicting attribute Returns: function: The :py:class`linux.ubuntu2204.Ubuntu2204Host` version of the function if there are conflicts Raises: IncorrectConflictHandlerError: If the conflicting function is not ``"add_debug_debs”``. """ifentry_name=="add_debug_debs":returnUbuntu2204Host.add_debug_debsraiseIncorrectConflictHandlerError
[docs]@require_class(UbuntuHost,conflict_handler=ubuntu_2204_conflict_handler)@require_class(LinuxNetplanHost)classUbuntu2204Host:""" A general class to provide an abstraction between Ubuntu Server and Desktop """def__init__(self):"""This abstraction is not needed"""
[docs]defadd_debug_debs(self):""" Installs debian packages that are useful for debugging purposes, including parallel-ssh. """self.install_debs(-244,"pssh_2.3.4-2_all_debs.tgz")
[docs]@require_class(Ubuntu2204Host)@require_class(UbuntuServer)classUbuntu2204Server:""" The Model Component for the Ubuntu2204Server image. """def__init__(self):""" Setting all of the required parameters for a new image """self.vm=getattr(self,"vm",{})if"architecture"notinself.vm:self.vm["architecture"]="x86_64"if"vcpu"notinself.vm:self.vm["vcpu"]={"model":"qemu64","sockets":1,"cores":1,"threads":1,}if"mem"notinself.vm:self.vm["mem"]=1024if"drives"notinself.vm:self.vm["drives"]=[{"db_path":"ubuntu-22.04-server-amd64.qcow2.tgz","file":"ubuntu-22.04-server-amd64.qcow2",}]if"vga"notinself.vm:self.vm["vga"]="std"self.set_image("ubuntu2204server")
[docs]@require_class(Ubuntu2204Host)@require_class(UbuntuDesktop)classUbuntu2204Desktop:""" The Model Component for the Ubuntu2204Desktop image. """def__init__(self):""" Setting all of the required parameters for a new image """self.vm=getattr(self,"vm",{})if"architecture"notinself.vm:self.vm["architecture"]="x86_64"if"vcpu"notinself.vm:self.vm["vcpu"]={"model":"qemu64","sockets":1,"cores":2,"threads":1,}if"mem"notinself.vm:self.vm["mem"]=2048if"drives"notinself.vm:self.vm["drives"]=[{"db_path":"ubuntu-22.04-desktop-amd64.qcow2.tgz","file":"ubuntu-22.04-desktop-amd64.qcow2",}]if"vga"notinself.vm:self.vm["vga"]="std"self.set_image("ubuntu2204desktop")