parent
b1e368da43
commit
692254fcbf
@ -23,7 +23,7 @@ def is_program_installed_in_qube( program, qube_name ):
|
||||
return is_installed
|
||||
|
||||
|
||||
#this function requires virsh
|
||||
#this function requires virsh
|
||||
#domstate only works for Xen domU (guests)
|
||||
def is_qube_running( qube_name ):
|
||||
runs = False
|
||||
@ -58,37 +58,37 @@ def get_qube_packages( qube_name ):
|
||||
pass #do nothing
|
||||
|
||||
else:
|
||||
content += "**No packages listed, because Qube " + qube_name + " was not running**\n\n"
|
||||
content += "**No packages listed, because Qube " + qube_name + " was not running**\n\n"
|
||||
|
||||
return content
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def get_dom0_packages():
|
||||
content = create_heading( "Dom0 Packages", 2 )
|
||||
out = subprocess.check_output([ "rpm", "-qa", "qubes-*" ])
|
||||
out = out.decode('utf-8')
|
||||
content += wrap_code( out )
|
||||
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def wrap_code( text ):
|
||||
code = "~~~\n" + text + "~~~\n\n"
|
||||
|
||||
|
||||
return code
|
||||
|
||||
def create_heading( heading, level ):
|
||||
heading = heading + "\n\n"
|
||||
|
||||
|
||||
if 1 == level:
|
||||
heading = "# " + heading
|
||||
elif 2 == level:
|
||||
elif 2 == level:
|
||||
heading = "## " + heading
|
||||
else:
|
||||
heading = "### " + heading
|
||||
|
||||
return heading
|
||||
|
||||
|
||||
|
||||
|
||||
def get_log_file_content( qube_name ):
|
||||
@ -110,10 +110,10 @@ def get_log_file_content( qube_name ):
|
||||
def get_qube_prefs( qube_name ):
|
||||
qube_prefs = subprocess.check_output([ "qvm-prefs", qube_name ])
|
||||
qube_prefs = qube_prefs.decode('utf-8')
|
||||
|
||||
|
||||
content = create_heading( "Qube Prefs", 2 )
|
||||
content += wrap_code( qube_prefs )
|
||||
|
||||
|
||||
return content
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ def report( qube_name ):
|
||||
content_text += get_dom0_packages()
|
||||
content_text += get_log_file_content( qube_name )
|
||||
content_text += get_qube_packages( qube_name )
|
||||
|
||||
|
||||
|
||||
report = template.format( title=title_text, content=content_text )
|
||||
|
||||
@ -148,10 +148,10 @@ def send_report( dest_qube, file_path):
|
||||
except subprocess.CalledProcessError:
|
||||
print( "Error while starting: " + dest_qube, file = sys.stderr )
|
||||
|
||||
try:
|
||||
try:
|
||||
subprocess.check_call([ "qvm-move-to-vm", dest_qube, file_path ])
|
||||
except subprocess.calledProcessError:
|
||||
print( "Moving file bug-report failed", file = sys.stderr )
|
||||
print( "Moving file bug-report failed", file = sys.stderr )
|
||||
|
||||
|
||||
def get_log_file( log_file ):
|
||||
@ -161,12 +161,12 @@ def get_log_file( log_file ):
|
||||
with open( log_file ) as log:
|
||||
data = log.read()
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
|
||||
def qube_exist( qube_name ):
|
||||
exists = True
|
||||
|
||||
|
||||
try:
|
||||
#calls: qvm-check --quiet vmanme
|
||||
subprocess.check_call([ "qvm-check", "--quiet", qube_name ])
|
||||
@ -174,7 +174,7 @@ def qube_exist( qube_name ):
|
||||
except subprocess.CalledProcessError:
|
||||
exists = False
|
||||
|
||||
return exists
|
||||
return exists
|
||||
|
||||
|
||||
def get_report_file_path( qube_name ):
|
||||
@ -218,11 +218,11 @@ def main():
|
||||
else:
|
||||
print ( "Destination VM does not exist" )
|
||||
exit(1)
|
||||
|
||||
|
||||
else:
|
||||
print( "VM does not exist" )
|
||||
exit(1)
|
||||
|
||||
|
||||
|
||||
#calls the main function -> program start point
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user