Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
add start-vm to supported export methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Jan 14, 2020
1 parent 13faaa2 commit 3ed91d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
1 change: 1 addition & 0 deletions securedrop_export/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Metadata(object):

METADATA_FILE = "metadata.json"
SUPPORTED_EXPORT_METHODS = [
"start-vm",
"usb-test", # general preflight check
"disk",
"disk-test", # disk preflight test
Expand Down
2 changes: 1 addition & 1 deletion securedrop_export/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __main__(submission):
submission.exit_gracefully(ExportStatus.ERROR_ARCHIVE_METADATA.value)

if submission.archive_metadata.export_method == "start-vm":
return # Export VM is running
submission.exit_gracefully('') # Export VM is running
elif submission.archive_metadata.export_method == "usb-test":
action = USBTestAction(submission)
elif submission.archive_metadata.export_method == "disk":
Expand Down
25 changes: 4 additions & 21 deletions securedrop_export/print/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,17 @@ def check_printer_setup(self) -> None:

def print_test_page(self):
logger.info('Printing test page')
self._print_file("/usr/share/cups/data/testprint")
self.submission.popup_message("Printing test page")
self.print_file("/usr/share/cups/data/testprint")

def print_all_files(self):
logger.info('Printing files')
files_path = os.path.join(self.submission.tmpdir, "export_data/")
files = os.listdir(files_path)
print_count = 0
for f in files:
file_path = os.path.join(files_path, f)
self._print_file(file_path)
self.print_file(file_path)
print_count += 1
msg = "Printing document {} of {}".format(print_count, len(files))
self.submission.popup_message(msg)
logger.info("Printing document {} of {}".format(print_count, len(files)))

def _install_printer_ppd(self, uri: str):
if "Brother" in uri:
Expand Down Expand Up @@ -133,21 +130,7 @@ def _setup_printer(self, printer_uri, printer_ppd):
error_message=ExportStatus.ERROR_PRINTER_INSTALL.value
)

def print_test_page(self):
logger.info('Printing test page')
self.print_file("/usr/share/cups/data/testprint")

def print_all_files(self):
files_path = os.path.join(self.submission.tmpdir, "export_data/")
files = os.listdir(files_path)
print_count = 0
for f in files:
file_path = os.path.join(files_path, f)
self.print_file(file_path)
print_count += 1
logger.info("Printing document {} of {}".format(print_count, len(files)))

def is_open_office_file(self, filename):
def _is_open_office_file(self, filename):
OPEN_OFFICE_FORMATS = [
".doc",
".docx",
Expand Down

0 comments on commit 3ed91d4

Please sign in to comment.