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
packagekit: Add automatic update configuration for dnf #7709
Conversation
0109301
to
9800bb0
Compare
9800bb0
to
ed8cf5b
Compare
ed8cf5b
to
7636e05
Compare
7636e05
to
0f75960
Compare
0f75960
to
b4a3a59
Compare
I now implemented the last TODO item, so that this is now an useful and working feature. It is currently limited to dnf (i. e. Fedora 26+) and for systems which have the By default, automatic updates are off: Once you enable them, they default to "every day at 06:00", which seems like a reasonable default to me (a bit before most people start working and thus can intervene if updates broke something). Automatic reboots are always on and there is no option for it (I don't think automatic updates without automatic reboots would be very useful/advisable, particularly on a server). @garrett, this should be really close to your designs, but I'd still like you to sign off on it. Thanks in advance! |
@mvollmer, can I ask you to give this a code review? Thanks! |
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.
@martinpitt and I talked about it and decided to move the every/on string into the dropdown for better language flow ("every day", "on Mondays", etc.), which is also better for translations. Also, we decided to add "at" between date and time (and it could be translated to an empty string when it's not appropriate).
b4a3a59
to
97ddac3
Compare
Force-pushed to change the auto update config sentence/structure like discussed with @garrett above. I adjusted the screenshots in above comment to the new design. |
97ddac3
to
d1063e9
Compare
fedora-27 image needs dnf-automatic installed. |
d1063e9
to
7f3bf0e
Compare
This does not yet install dnf-automatic on demand - if it's not already installed, automatic updates are not supported and not shown. Closes cockpit-project#7709
image-refresh in progress on cockpit-tests-4kx0n. |
image-refresh in progress on cockpit-tests-vlgmj. |
image-refresh in progress on cockpit-tests-jttb7. |
image-refresh fedora-27 done: https://github.com/cockpituous/cockpit/commits/image-refresh-fedora-27-20170926-105555 |
7f3bf0e
to
48f9d87
Compare
@mvollmer: Some details about the file writing that we do:
|
I find the On/Off animation slightly confusing. When toggling On/Off, the button is first disabled while the machine is working, and then switches over to the other position. I think I would prefer it to first switch and then be disabled until the new state sticks. Once I figured out how the button works, it didn't feel so wrong anymore, but when clicking it the first time and it didn't move immediately confused me quite a bit, and I actually clicked it again a couple of times just to get a feel for how it works. |
@@ -837,7 +840,8 @@ class OsUpdates extends React.Component { | |||
} | |||
<UpdatesList updates={this.state.updates} /> | |||
|
|||
{ this.state.history | |||
{ /* Hide history with automatic updates, as they don't feed their history into PackageKit */ |
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.
UpdateHistory
is instanciated in two more places, AskRestart
and when the system is up-to-date. Shouldn't it be hidden there, too?
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.
It's intentionally not hidden for "ask to restart", as there we just did a PackageKit update and thus the history is recent and valid. But indeed, if I forgot to hide it for "up to date", this needs to be fixed.
// (https://bugzilla.redhat.com/show_bug.cgi?id=1491190) | ||
script += "mkdir -p /etc/systemd/system/dnf-automatic-install.service.d; "; | ||
script += "printf '[Service]\\nExecStartPost=/bin/sh -ec \"" + | ||
"if systemctl status --no-pager --lines=100 dnf-automatic-install.service| grep -q ===========$$; then " + |
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.
Since we want to grep the journal, what about using journalctl? Also, does this really only look at the last run, or does it look at the last 100 lines?
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.
This is exactly why I can't use journalctl
for this - it doesn't have an option for "just show me the current run". One can sort of fake it with first doing a systemctl show
, grab the started time from it, and plug that into journalctl --since
, but overall that's more overhead than just using this. (I asked the systemd guys about that).
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.
Oh, systemctl status
only shows the journal for the current run? I didn't know that, nice!
# dial down the random sleep to avoid the test having to wait 5 mins | ||
m.execute("sed -i '/random_sleep/ s/=.*$/= 3/' /etc/dnf/automatic.conf") | ||
# then manually start the upgrade job like the timer would | ||
m.execute("systemctl start dnf-automatic-install.service") |
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.
Add a --wait
?
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.
No need, it's Type=oneshot
thus the start
will block until it's actually done. Also, I remember adding --wait
not too long ago (late last year), so it might not yet be available on RHEL/CentOS 7.
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.
Roger. Looks like you know a thing or two about systemd... :-)
48f9d87
to
0edfd50
Compare
Force-pushed to hide the history for "up to date" too, thanks for spotting! That leaves the on/off button behaviour. I'm not sure how to influence this behaviour, it's a standard component - but I'll look into that. I added a TODO item for it for now. |
Would it work to use |
Similar to OnOffSwitch, this allows to gray out a Select component and make it inactive.
Corresponding to commit fb0f7d6 which did it for the older Fedora versions.
This does not yet install dnf-automatic on demand - if it's not already installed, automatic updates are not supported and not shown. Closes cockpit-project#7709
0edfd50
to
2a49f1a
Compare
@mvollmer: The actual implementation is a tad more involved, but in spirit, yes. I did that now and force-pushed the change to keep button mergeability. But for easier review, here is the relative diff to your previous review. |
At the moment this does not install dnf-automatic on demand - if it's not already installed, automatic updates are not supported and not shown. This will be added in a second iteration.
See UI design.
null is not an object
exception on unsupported backends#containers-containers-filter button is disabled or somehow not clickable
)