Skip to content

Commit

Permalink
Merge pull request #94 from Cray-HPE/Paradise
Browse files Browse the repository at this point in the history
Paradise TFTP support - Loader fix
  • Loading branch information
mbuchmann-hpe authored Mar 28, 2024
2 parents d244cc0 + 7a8ae4a commit 952cca1
Show file tree
Hide file tree
Showing 16 changed files with 369 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.29.0
1.30.0
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.30.0] - 2024-03-27

- Added support for Paradise (Foxconn) OpenBMC nodes
- Added support for TFTP downloads
- Update to loader for race condition on unpacking / deleting packages

## [1.29.0] - 2023-06-30

- Changed FAS database struct back to use "actionID" instead of the
Expand Down
6 changes: 6 additions & 0 deletions api/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@ components:
s3URL:
type: string
example: s3://firmware/f1.1123.24.xz.iso
tftpURL:
type: string
example: tctp://f1.1123.24.xz.iso
allowableDeviceStates:
type: array
items:
Expand Down Expand Up @@ -1311,6 +1314,9 @@ components:
s3URL:
type: string
example: s3://firmware/f1.1123.24.xz.iso
tftpURL:
type: string
example: tftp://f1.1123.24.xz.iso
allowableDeviceStates:
type: array
items:
Expand Down
4 changes: 3 additions & 1 deletion cmd/fw-loader/fas/FirmwareAction.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# MIT License
#
# (C) Copyright [2020-2021] Hewlett Packard Enterprise Development LP
# (C) Copyright [2020-2024] Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -219,6 +219,7 @@ def create_image(self, image):
im['models'] = []
im['models'] += image.models
im['s3URL'] = image.s3URL
im['tftpURL'] = image.tftpURL
im['tags'] = []
im['tags'] += image.tags
im['target'] = image.target
Expand Down Expand Up @@ -251,6 +252,7 @@ def update_image(self, imageID, image):
im['models'] = []
im['models'] += image.models
im['s3URL'] = image.s3URL
im['tftpURL'] = image.tftpURL
im['tags'] = []
im['tags'] += image.tags
im['target'] = image.target
Expand Down
5 changes: 3 additions & 2 deletions cmd/fw-loader/fas/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# MIT License
#
# (C) Copyright [2020-2021] Hewlett Packard Enterprise Development LP
# (C) Copyright [2020-2024] Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -123,7 +123,7 @@ def __validate(self):

class Image:

def __init__(self, deviceType, manufacturer, models, target, s3URL, firmwareVersion, semanticFirmwareVersion, updateURI="", versionURI="", needReboot=False, allowableDeviceStates=[], tags=["default"]):
def __init__(self, deviceType, manufacturer, models, target, s3URL, firmwareVersion, semanticFirmwareVersion, updateURI="", versionURI="", needReboot=False, allowableDeviceStates=[], tags=["default"], tftpURL=""):

self.deviceType = deviceType
self.manufacturer = manufacturer
Expand All @@ -137,6 +137,7 @@ def __init__(self, deviceType, manufacturer, models, target, s3URL, firmwareVers
self.needReboot =needReboot
self.s3URL = s3URL
self.allowableDeviceStates = allowableDeviceStates
self.tftpURL = tftpURL

self.__validate()

Expand Down
9 changes: 7 additions & 2 deletions cmd/fw-loader/fw-loader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# MIT License
#
# (C) Copyright [2020-2023] Hewlett Packard Enterprise Development LP
# (C) Copyright [2020-2024] Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -552,16 +552,21 @@ def main():
download_path = '/fw/download'
#Cleanse the path
shutil.rmtree(download_path, ignore_errors=True)
while os.path.exists(download_path):
logging.info("Path Exists after remove - try again")
time.sleep(5)
shutil.rmtree(download_path, ignore_errors=True)
os.mkdir(download_path)
_, file_ext = os.path.splitext(file)
if file_ext.lower() == ".rpm":
logging.info("extracting rpm: " + file)
rpm2cpio_digester = subprocess.Popen(['rpm2cpio', file], stdout=subprocess.PIPE, cwd=download_path)
cpio_digester = subprocess.Popen(['cpio', '-idmv'], stdin=rpm2cpio_digester.stdout, cwd=download_path)
rpm2cpio_digester.wait()
cpio_digester.wait()
elif file_ext.lower() == ".zip":
logging.info("unzip: "+ file)
unzip_digester = subprocess.run(['unzip', file], stdout=subprocess.PIPE, cwd=download_path)
unzip_digester.wait()
else:
logging.error("unsupported file extension: " + file_ext)
numup += process_fw(urls)
Expand Down
6 changes: 5 additions & 1 deletion cmd/hms-firmware-action/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* (C) Copyright [2020-2023] Hewlett Packard Enterprise Development LP
* (C) Copyright [2020-2024] Hewlett Packard Enterprise Development LP
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -66,15 +66,18 @@ const manufacturerCray = "cray"
const manufacturerGigabyte = "gigabyte"
const manufacturerIntel = "intel"
const manufacturerHPE = "hpe"
const manufacturerFoxconn = "foxconn"

const (
dfltMaxHTTPRetries = 5
dfltMaxHTTPTimeout = 40
dfltMaxHTTPBackoff = 8
)
const defaultS3Endpoint = "s3"
const defaultTFTPEndpoint = "TFTP"

var S3_ENDPOINT string
var TFTP_ENDPOINT string

var nodeBlacklistSt string
var nodeBlacklist []string
Expand Down Expand Up @@ -116,6 +119,7 @@ func main() {
flag.StringVar(&StateManagerServer, "sms_server", defaultSMSServer, "SMS Server")
flag.StringVar(&nodeBlacklistSt, "node_blacklist", defaultNodeBlacklist, "Node Black List")
flag.StringVar(&S3_ENDPOINT, "s3_endpoint", defaultS3Endpoint, "S3 Endpoint")
flag.StringVar(&TFTP_ENDPOINT, "tftp_endpoint", defaultTFTPEndpoint, "TFTP Endpoint")
flag.BoolVar(&runControl, "run_control", runControl, "run control loop; false runs API only")
flag.BoolVar(&hsmlockEnabled, "hsmlock_enabled", true, "Use HSM Locking")
flag.BoolVar(&VaultEnabled, "vault_enabled", true, "Should vault be used for credentials?")
Expand Down
Loading

0 comments on commit 952cca1

Please sign in to comment.