-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from canonical/add-hp-oemscript-device-connector
Add add hp_oemscript device connector
- Loading branch information
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
|
||
""" | ||
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") |
31 changes: 31 additions & 0 deletions
31
device-connectors/src/testflinger_device_connectors/devices/hp_oemscript/hp_oemscript.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
|
||
"""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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters