diff --git a/device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/__init__.py b/device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/__init__.py new file mode 100644 index 00000000..df23ed08 --- /dev/null +++ b/device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/__init__.py @@ -0,0 +1,52 @@ +# Copyright (C) 2023 Canonical +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Ubuntu OEM Recovery Provisioning for HP OEM devices +Use this for systems that can use the oem recovery-from-iso.sh script +for provisioning, but require the --ubr flag in order to use the +"ubuntu recovery" method. +""" + +import logging + +import yaml + +import testflinger_device_connectors +from testflinger_device_connectors import logmsg +from testflinger_device_connectors.devices import ( + DefaultDevice, + RecoveryError, + catch, +) +from .hp_oemscript import HPOemScript + +device_name = "hp_oemscript" + + +class DeviceConnector(DefaultDevice): + + """Tool for provisioning HP OEM devices with an oem image.""" + + @catch(RecoveryError, 46) + def provision(self, args): + """Method called when the command is invoked.""" + with open(args.config) as configfile: + config = yaml.safe_load(configfile) + testflinger_device_connectors.configure_logging(config) + device = HPOemScript(args.config, args.job_data) + logmsg(logging.INFO, "BEGIN provision") + logmsg(logging.INFO, "Provisioning device") + device.provision() + logmsg(logging.INFO, "END provision") diff --git a/device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/hp_oemscript.py b/device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/hp_oemscript.py new file mode 100644 index 00000000..30c8fe8a --- /dev/null +++ b/device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/hp_oemscript.py @@ -0,0 +1,31 @@ +# Copyright (C) 2023 Canonical +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Ubuntu OEM Script provisioning for HP OEM devices +this for systems that can use the oem recovery-from-iso.sh script +for provisioning, but require the --ubr flag in order to use the +"ubuntu recovery" method. +""" + +import logging +from testflinger_device_connectors.devices.oemscript.oemscript import OemScript + +logger = logging.getLogger() + + +class HPOemScript(OemScript): + """Device Agent for HP OEM devices.""" + + # Extra arguments to pass to the OEM script + extra_script_args = ["--ubr"] diff --git a/docs/reference/device-connector-types.rst b/docs/reference/device-connector-types.rst index 67df960a..a232722d 100644 --- a/docs/reference/device-connector-types.rst +++ b/docs/reference/device-connector-types.rst @@ -30,3 +30,5 @@ To specify the commands to run by the device in each test phase, set the ``testf - This device connector is used for Dell OEM devices running certain versions of OEM supported images that can use a recovery partition to recover not only the same image, but in some cases, other OEM image versions as well. * - ``lenovo_oemscript`` - This device connector is used for Lenovo OEM devices running certain versions of OEM supported images that can use a recovery partition to recover not only the same image, but in some cases, other OEM image versions as well. + * - ``hp_oemscript`` + - This device connector is used for HP OEM devices running certain versions of OEM supported images that can use a recovery partition to recover not only the same image, but in some cases, other OEM image versions as well.