Skip to content

Commit

Permalink
Ignore GPG check for install or upgrade in the script
Browse files Browse the repository at this point in the history
To circumvent the lack of signature of 8.2 ISOs, added an option to
deactivate GPG verification in the answerfile.

Signed-off-by: Gael Duperrey <[email protected]>
  • Loading branch information
gduperrey committed Sep 27, 2023
1 parent 930885e commit d18edde
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions scripts/install_xcpng.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def generate_boot_conf(directory, installer, action):
{rt}
""")

def generate_answerfile(directory, installer, hostname_or_ip, target_hostname, action, hdd):
def generate_answerfile(directory, installer, hostname_or_ip, target_hostname, action, hdd, netinstall_gpg_check):
pxe = pxe_address()
password = host_data(hostname_or_ip)['password']
cmd = ['openssl', 'passwd', '-6', password]
Expand All @@ -56,7 +56,7 @@ def generate_answerfile(directory, installer, hostname_or_ip, target_hostname, a
with open(f'{directory}/answerfile.xml', 'w') as answerfile:
if action == 'install':
answerfile.write(f"""<?xml version="1.0"?>
<installation>
<installation{netinstall_gpg_check}>
<keymap>fr</keymap>
<primary-disk>{hdd}</primary-disk>
<guest-disk>{hdd}</guest-disk>
Expand All @@ -72,7 +72,7 @@ def generate_answerfile(directory, installer, hostname_or_ip, target_hostname, a
""")
elif action == 'upgrade':
answerfile.write(f"""<?xml version="1.0"?>
<installation mode="upgrade">
<installation mode="upgrade"{netinstall_gpg_check}>
<existing-installation>{hdd}</existing-installation>
<source type="url">{installer}</source>
<script stage="filesystem-populated" type="url">
Expand Down Expand Up @@ -186,6 +186,7 @@ def main():
help="The hostname of the VM in which XCP-ng will be installed. By default "
"a hostname is generated starting with xcp-ng-XXXXX where XXXXX is "
"randomly generated using lowercase characters.")
parser.add_argument("--netinstall-gpg-check", default=False, action='store_true', help="Disable GPG Check")
args = parser.parse_args()

# *** "fail early" checks
Expand All @@ -200,6 +201,11 @@ def main():
else:
raise Exception(f'The version does not seem valid: {args.xcpng_version}')

if args.netinstall_gpg_check:
netinstall_gpg_check = " netinstall-gpg-check=\"false\""
else:
netinstall_gpg_check = ""

# *** slower checks (involving network, SSH...)

if not is_ssh_up(args.host):
Expand Down Expand Up @@ -229,7 +235,8 @@ def main():
with tempfile.TemporaryDirectory(suffix=mac_address) as tmp_local_path:
logging.info('Generate files: answerfile.xml and boot.conf')
hdd = 'nvme0n1' if vm.is_uefi else 'sda'
generate_answerfile(tmp_local_path, installer, args.host, args.target_hostname, args.action, hdd)
generate_answerfile(tmp_local_path, installer, args.host, args.target_hostname, args.action, hdd,
netinstall_gpg_check)
generate_boot_conf(tmp_local_path, installer, args.action)
logging.info('Copy files to the pxe server')
copy_files_to_pxe(mac_address, tmp_local_path)
Expand Down

0 comments on commit d18edde

Please sign in to comment.