Skip to content

Commit

Permalink
Merge pull request #5255 from liulinC/master
Browse files Browse the repository at this point in the history
CP-46168: Some py2->py3 update for xapi startup
  • Loading branch information
Vincent-lau authored Nov 23, 2023
2 parents 7ac88b9 + edcb9f9 commit 697fefa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions scripts/host-display
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""
This script can be used to enable, disable or query the status of dom0 and
Expand Down Expand Up @@ -37,7 +37,8 @@ def doexec(args):
stdin=None,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
close_fds=True,
universal_newlines=True)
rc = proc.wait()
stdout = proc.stdout
stderr = proc.stderr
Expand Down Expand Up @@ -95,7 +96,7 @@ def _get_com_port():

def usage():
""" Display a usage string. """
command_names = COMMANDS.keys()
command_names = list(COMMANDS.keys())
command_names.sort()
print("Usage:")
print(" %s {%s}" % (sys.argv[0], '|'.join(command_names)))
Expand Down
9 changes: 4 additions & 5 deletions scripts/xe-reset-networking
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""
Copyright (C) 2006-2009 Citrix Systems Inc.
Expand All @@ -16,7 +16,6 @@ from __future__ import print_function

import sys
import os
import commands
import time
import re
from optparse import OptionParser
Expand Down Expand Up @@ -186,7 +185,7 @@ the command with appropriate arguments (use --help for a list of options).
Type 'yes' to continue.
Type 'no' to cancel.
"""
res = raw_input(warning + '\n'.join(configuration) + confirmation)
res = input(warning + '\n'.join(configuration) + confirmation)
if res != 'yes':
sys.exit(1)

Expand Down Expand Up @@ -232,7 +231,7 @@ Type 'no' to cancel.
# Rewrite firstboot management.conf file, which will be picked it by xcp-networkd on restart (if used)
is_static = False
try:
f = file(management_conf, 'w')
f = open(management_conf, 'w')
f.write("LABEL='" + device + "'\n")
if options.mode != "none":
f.write("MODE='" + options.mode + "'\n")
Expand Down Expand Up @@ -260,7 +259,7 @@ Type 'no' to cancel.

# Write trigger file for XAPI to continue the network reset on startup
try:
f = file(network_reset, 'w')
f = open(network_reset, 'w')
f.write('DEVICE=' + device + '\n')
if options.mode != "none":
f.write('MODE=' + options.mode + '\n')
Expand Down

0 comments on commit 697fefa

Please sign in to comment.