-
Notifications
You must be signed in to change notification settings - Fork 46
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
Skips running the updater if last update was good, a reboot isn't needed, and a config-specified delta isn't defined. #450
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7a25389
adding argument to launcher desktop file to specify time delta for sk…
zenmonkeykstop d90890e
Added check for last update in launcher script
zenmonkeykstop 591ca58
Added test coverage for updater-vs.-client logic
zenmonkeykstop 09b7cb1
corrected lint errors
zenmonkeykstop 7005388
updated RPM build config with revised shortcut filename
zenmonkeykstop 83df22c
removed update_skip_delta from config.json, cleaned up
zenmonkeykstop ea7a9af
fixed default launcher behaviour
zenmonkeykstop ed92761
updated flag file behaviour to prevent stale status file when updater…
zenmonkeykstop 25df3de
rebased and added a test to get 100% coverage back
zenmonkeykstop 115a541
Updated version to 0.1.4
zenmonkeykstop c719c34
Updates based on PR review
zenmonkeykstop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.3 | ||
0.1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,19 @@ | |
logger = logging.getLogger(__name__) | ||
|
||
|
||
def launch_securedrop_client(): | ||
""" | ||
Helper function to launch the SecureDrop Client | ||
""" | ||
try: | ||
logger.info("Launching SecureDrop client") | ||
subprocess.Popen(["qvm-run", "sd-app", "gtk-launch securedrop-client"]) | ||
except subprocess.CalledProcessError as e: | ||
logger.error("Error while launching SecureDrop client") | ||
logger.error(str(e)) | ||
sys.exit(0) | ||
|
||
|
||
class UpdaterApp(QtGui.QMainWindow, Ui_UpdaterDialog): | ||
def __init__(self, parent=None): | ||
super(UpdaterApp, self).__init__(parent) | ||
|
@@ -19,7 +32,7 @@ def __init__(self, parent=None): | |
self.setupUi(self) | ||
self.clientOpenButton.setEnabled(False) | ||
self.clientOpenButton.hide() | ||
self.clientOpenButton.clicked.connect(self.launch_securedrop_client) | ||
self.clientOpenButton.clicked.connect(launch_securedrop_client) | ||
emkll marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.rebootButton.setEnabled(False) | ||
self.rebootButton.hide() | ||
self.rebootButton.clicked.connect(self.reboot_workstation) | ||
|
@@ -173,19 +186,6 @@ def get_vms_that_need_upgrades(self, results): | |
vms_to_upgrade.append(vm) | ||
return vms_to_upgrade | ||
|
||
def launch_securedrop_client(self): | ||
""" | ||
Helper method to launch the SecureDrop Client | ||
""" | ||
try: | ||
logger.info("Launching SecureDrop client") | ||
subprocess.Popen(["qvm-run", "sd-app", "gtk-launch securedrop-client"]) | ||
except subprocess.CalledProcessError as e: | ||
self.proposedActionDescription.setText(strings.descri) | ||
logger.error("Error while launching SecureDrop client") | ||
logger.error(str(e)) | ||
sys.exit(0) | ||
|
||
def apply_all_updates(self): | ||
""" | ||
Method used by the applyUpdatesButton that will create and start an | ||
|
@@ -246,10 +246,11 @@ def run(self): | |
results[vm] = result | ||
self.progress_signal.emit(progress) | ||
|
||
# write the flags to disk | ||
# write the flags to disk after successful updates, including updates | ||
# that require a reboot. | ||
run_results = Updater.overall_update_status(results) | ||
Updater._write_updates_status_flag_to_disk(run_results) | ||
if run_results == UpdateStatus.UPDATES_OK: | ||
if run_results in {UpdateStatus.UPDATES_OK, UpdateStatus.REBOOT_REQUIRED}: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend adding a code comment above this line, explaining the behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✔️ |
||
Updater._write_last_updated_flags_to_disk() | ||
# populate signal contents | ||
message = results # copy all the information from results | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps setting the default in argparse will simplify the logic here: https://docs.python.org/3.7/library/argparse.html#default