Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore GPG check for install or upgrade in the script #166

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading