Skip to content

Commit e7450ba

Browse files
authored
Merge pull request #177 from canonical/add-hp-oemscript-device-connector
Add add hp_oemscript device connector
2 parents 0a74115 + 2e480e6 commit e7450ba

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (C) 2023 Canonical
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# You should have received a copy of the GNU General Public License
13+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
14+
15+
"""
16+
Ubuntu OEM Recovery Provisioning for HP OEM devices
17+
Use this for systems that can use the oem recovery-from-iso.sh script
18+
for provisioning, but require the --ubr flag in order to use the
19+
"ubuntu recovery" method.
20+
"""
21+
22+
import logging
23+
24+
import yaml
25+
26+
import testflinger_device_connectors
27+
from testflinger_device_connectors import logmsg
28+
from testflinger_device_connectors.devices import (
29+
DefaultDevice,
30+
RecoveryError,
31+
catch,
32+
)
33+
from .hp_oemscript import HPOemScript
34+
35+
device_name = "hp_oemscript"
36+
37+
38+
class DeviceConnector(DefaultDevice):
39+
40+
"""Tool for provisioning HP OEM devices with an oem image."""
41+
42+
@catch(RecoveryError, 46)
43+
def provision(self, args):
44+
"""Method called when the command is invoked."""
45+
with open(args.config) as configfile:
46+
config = yaml.safe_load(configfile)
47+
testflinger_device_connectors.configure_logging(config)
48+
device = HPOemScript(args.config, args.job_data)
49+
logmsg(logging.INFO, "BEGIN provision")
50+
logmsg(logging.INFO, "Provisioning device")
51+
device.provision()
52+
logmsg(logging.INFO, "END provision")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (C) 2023 Canonical
2+
#
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# You should have received a copy of the GNU General Public License
13+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
14+
15+
"""Ubuntu OEM Script provisioning for HP OEM devices
16+
this for systems that can use the oem recovery-from-iso.sh script
17+
for provisioning, but require the --ubr flag in order to use the
18+
"ubuntu recovery" method.
19+
"""
20+
21+
import logging
22+
from testflinger_device_connectors.devices.oemscript.oemscript import OemScript
23+
24+
logger = logging.getLogger()
25+
26+
27+
class HPOemScript(OemScript):
28+
"""Device Agent for HP OEM devices."""
29+
30+
# Extra arguments to pass to the OEM script
31+
extra_script_args = ["--ubr"]

docs/reference/device-connector-types.rst

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ To specify the commands to run by the device in each test phase, set the ``testf
3030
- 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.
3131
* - ``lenovo_oemscript``
3232
- 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.
33+
* - ``hp_oemscript``
34+
- 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.

0 commit comments

Comments
 (0)