Commit Graph

2195 Commits

Author SHA1 Message Date
Jonathan Lebon
747236d593 daemon: Rename sysroot_reload to be more descriptive
Follow-up to previous commit. Since we have so many concepts called
"sysroot" and "configs", let's be explicit with our naming here to be
sure we know what we're calling.

Closes: #1311
Approved by: cgwalters
2018-03-23 21:50:33 +00:00
Colin Walters
60aa9a4a33 daemon: Automatically reload sysroot before txn
In this PR: https://github.com/projectatomic/rpm-ostree/pull/1309
I was hitting race conditions running `ostree admin pin` then
`rpm-ostree cleanup` as it was possible that the daemon hadn't handled
the inotify on the sysroot and reloaded the deployment state before
the txn request came in.

Close this race by doing an implicit `reload` before starting a txn.
This is a pretty efficient operation because for the sysroot we're
just doing a `stat()` and comparing mtime.

Implementation wise, change the external API to drop the "did change"
boolean as nothing outside of the `sysroot.c` file used it.

A followup to this would be changing the `status` CLI to call a
(new) DBus API like `RequestReload` that at least did the sysroot
reload if the daemon was otherwise idle or so?  And it'd be available
to unprivileged users.

Closes: #1311
Approved by: cgwalters
2018-03-23 21:50:33 +00:00
Colin Walters
9ddf65aade daemon: Retain pinned deployments
Followup to: https://github.com/ostreedev/ostree/pull/1464

Ideally, we'd delegate more logic around these things to libostree, but we're
not there yet.

This means e.g. `rpm-ostree cleanup -r` for a pinned rollback will just silently
skip it.  It'd be nicer to emit an error probably, but that'd be quite a bit
more work.

Closes: https://github.com/projectatomic/rpm-ostree/issues/1293

Closes: #1309
Approved by: jlebon
2018-03-23 13:25:33 +00:00
Jonathan Lebon
4291500368 daemon: Also generate CachedUpdate in DownloadUpdateRpmDiff
Moving to caching the GVariant to disk rather than during RPMOSTreeOS
reloads broke the legacy `DownloadUpdateRpmDiff` path because it relied
on the implied recalculations that occur on reloads to update
`CachedUpdate`.

This patch series was initially going to be about just migrating all the
legacy APIs to make use of the new metadata, which would have fixed this
properly. But we first need some real coverage in that aread, which is
very poor right now. I'd like to investigate integrating the Cockpit
tests (at least the ostree-specific parts) into our CI to remedy this.

Anyways, for now at least, let's fix Cockpit.

Closes: #1300

Closes: #1303
Approved by: cgwalters
2018-03-17 20:17:32 +00:00
Jonathan Lebon
e4dd2c4d23 daemon: Write to journal on successful transaction
We would write to the journal when we initiated a new transaction as
well as when that transaction errored. This just completes the picture
by also writing when the transaction finished successfully. My ulterior
motive is to make testing easier.

Also make sure to print the method name, which is more telling than the
object path.

Closes: #1303
Approved by: cgwalters
2018-03-17 20:17:32 +00:00
Jonathan Lebon
bc97c3aa53 app/db-list: Use pkglist metadata when possible
This patch teaches `db list` to also use the pkglist metadata when it
can, just like we did for `db diff`. To spell it out: this then allows
`db list` to work on commits for which we only have the commit object.

I went for the surgical incision here and didn't try to support
invocations which use fnmatch patterns for now. Definitely possible,
though it didn't feel like it was worth the effort given that the common
case is just a raw `db list` (I'd wager most people are probably
hard-wired to pipe to `grep` anyway for filtering).

Also fix the usage string, which had the arguments flipped.

Closes: #1299
Approved by: cgwalters
2018-03-15 15:49:44 +00:00
Jonathan Lebon
d6172ddee2 app/db-diff: Add --base switch
Support a `--base` switch to perform the diff on the base layer if
deployment checksum was locally composed. This is useful to filter out
from the diff changes due to layered packages.

Closes: #1299
Approved by: cgwalters
2018-03-15 15:49:44 +00:00
Jonathan Lebon
4e99052d07 Fix GitHub issue template formatting
The extra spaces were preventing proper bolding.

Closes: #1306
Approved by: cgwalters
2018-03-14 21:54:16 +00:00
Jonathan Lebon
45fb100826 daemon/deploy: Factor out update variant generation
No functional change. Prep for next patch.

Closes: #1304
Approved by: cgwalters
2018-03-14 21:49:16 +00:00
Jonathan Lebon
2eb424b9ce vmcheck: Add vm_shell_inline
Initially suggested in #1298. Wanted to try this out for an upcoming
patch.

Closes: #1304
Approved by: cgwalters
2018-03-14 21:49:16 +00:00
Jonathan Lebon
3e39fda4aa vmcheck: Make vm_ansible_inline more verbose
Because otherwise, there's no way to see the output of the script.

Also, turn off `gather_facts` since in the majority of cases, we don't
need it, so let's avoid the overhead. We can make this an opt-in flag
later on if needed.

Closes: #1304
Approved by: cgwalters
2018-03-14 21:49:16 +00:00
Jonathan Lebon
aaf2c30807 vmcheck: Obey VMCHECK_DEBUG for rpm-ostreed.conf
Closes: #1304
Approved by: cgwalters
2018-03-14 21:49:16 +00:00
Colin Walters
f6d08183b6 daemon: Don't error out if a remote isn't found
This came up in a few places recently; it happens for RHEL in some
cases, and in general we don't want to completely fail the daemon
start if someone messes up their remote config.

Closes: https://github.com/projectatomic/rpm-ostree/issues/1301

Closes: #1302
Approved by: jlebon
2018-03-14 18:50:13 +00:00
Colin Walters
b509af739a daemon: Clean up how we load deployment GPG results
Mostly prep for further work.  But it's just nicer anyways to
directly write into the dict.

Closes: #1302
Approved by: jlebon
2018-03-14 18:50:13 +00:00
Colin Walters
63f545a6f4 tests: Replace some more libvm bits with Ansible
`vm_cmdfile()` was clearly calling out for this. I also replaced `vm_send()`
calls.

Closes: #1298
Approved by: jlebon
2018-03-14 14:13:07 +00:00
Colin Walters
bb86912de9 tests: Dip our toes into using Ansible
This adds a shell primitive to make it easy to execute a playbook
task list.

The big picture idea is to sync with https://github.com/ostreedev/ostree/pull/1462
and rewrite some of the libvm shell stuff as playbooks, allowing easier
code sharing with a-h-t and just in general being a better library for
talking ssh and executing commnads.

Closes: #1297
Approved by: jlebon
2018-03-09 19:04:32 +00:00
Colin Walters
9cbec27d4c core: Add rpmostree.rpmmd-repos metadata to client layers too
This is a logical followup to:

 - "core: Add rpmostree.repo metadata to imported packages" AKA a52cb7d78e
 - "compose: Add rpmostree.rpmmd-repo metadata to commits by default" AKA e7a42f70a9

Basically I'd like to display this in `status` at least, though how we render it
gets...interesting when there is layering in play. For now though let's just
capture the data the same way we do server side.

Theoretically we could reconstruct this data by walking all of the pkgrefs in
the tree but...ugh. It's just a lot simpler to have it in this form too just
like the server-side path.

Closes: #1296
Approved by: jlebon
2018-03-08 20:59:15 +00:00
Jonathan Lebon
cdd3227f70 app/db-diff: assume booted deployment if less args
Very often when I have a pending deployment, I just want to find out
what the diff is before rebooting. We do print it after whatever
transaction laid down the new deployment, though we may not reboot right
away. It seems like a common enough operation to warrant some shortcuts.

This makes `db diff` more useful by automatically subbing in the booted
deployment if less arguments are given:

    rpm-ostree db diff
      <diff booted and pending deployment>
    rpm-ostree db diff $csum
      <diff booted and $csum>
    rpm-ostree db diff $csum1 $csum2
      <as before, diff $csum1 and $csum2>

As before, we never try to even load the sysroot in the last invocation,
so it still works equally well on non-OSTree systems/unprivileged.

Closes: #1294
Approved by: cgwalters
2018-03-08 17:30:42 +00:00
Jonathan Lebon
2715a1b1e1 app/db: factor out diff printing
No functional change. Prep for more work.

Note we reword `old/new_ref` to `old/new_desc` inside the function
because it's only used for printing at this point.

Closes: #1294
Approved by: cgwalters
2018-03-08 17:30:42 +00:00
Jonathan Lebon
699c50dcec app: fix wrong EXIT_FAILURE returns
Fix all instances where we were returning `EXIT_FAILURE` instead of
`FALSE`. Also be more precise and use `gboolean` instead of `int` as
return type, which probably makes it easier to fall in this trap.

We should probably add a `make syntax-check` or something to scan for
these.

Closes: #1294
Approved by: cgwalters
2018-03-08 17:30:42 +00:00
Colin Walters
60d4470e05 status: Show deployment pinned 📌 state
Implemented in libostree in https://github.com/ostreedev/ostree/pull/1464
Let's display it - wrapping the command will come later.

I also just noticed `rpmostree_syscore_filter_deployments()` at least is
going to have to learn about pinning; will need to improve the test suite
around this too.

Closes: #1292
Approved by: jlebon
2018-03-08 13:43:50 +00:00
Jonathan Lebon
99f111fd3d man: Add rpm-ostreed-automatic page
Let's be nice to sysadmins and document our systemd units like systemd
itself does.

Closes: #1291
Approved by: cgwalters
2018-03-07 22:54:33 +00:00
Jonathan Lebon
ae91959e0e man/rpm-ostree: Add override command
Add the missing docs for the recently promoted `override` command.

Also drop the `pkg-add` and `pkg-remove` mentions. I think `install` and
`uninstall` have pervaded enough by now that most people have probably
forgotten (or never learned) the legacy aliases. Let's just nuke them
from the man pages.

Closes: #1291
Approved by: cgwalters
2018-03-07 22:54:32 +00:00
Jonathan Lebon
9d92684afb app/status: Handle auto-update service running
If the `rpm-ostreed-automatic.service` unit is running while a user runs
`status`, we would incorrectly print `no runs since boot`. Check for
this case and just show the state as `running`.

Closes: #1291
Approved by: cgwalters
2018-03-07 22:54:32 +00:00
Colin Walters
bc61769c8c status: Port to declare-and-initialize style
Prep for further changes here (e.g. displaying pinned status).

Closes: #1290
Approved by: jlebon
2018-03-07 19:00:32 +00:00
Jonathan Lebon
5173f579ca tests/vmcheck: add coverage for --check and --preview
We had no coverage for `--check` and `--preview`. Now that they use the
more efficient auto-updates API, it should be fine to document/recommend
to users. Let's add some coverage in the existing auto-updates tests to
make sure we don't regress on them e.g. only working when auto-update
"check" mode is on.

Closes: #1268
Approved by: cgwalters
2018-03-05 22:42:26 +00:00
Jonathan Lebon
05e09cd72c auto-updates: Cache cached-update GVariant to disk
Rather than recalculating `cached-update` as part of transaction
cleanups and RpmostreedOS internal reloads, write it directly to a file
from `deploy_transaction_execute`. This gives two major benefits:

1. Auto-updates now has virtually zero impact to daemon startup time.
2. We get to directly use the `DnfSack` created during metadata refresh
   rather than reconstructing it later on. This greatly simplifies code.

This makes use of new APIs in libdnf to skip filelists and load
updateinfo metadata right from the start.

Closes: #1268
Approved by: cgwalters
2018-03-05 22:42:26 +00:00
Jonathan Lebon
1b580ce201 libpriv/core: Use new download_metadata libdnf API
Allow callers to pass flags directly to libdnf depending on their needs.
Make use of this in `refresh-md` at least so that we don't even bother
loading the rpmdb since we're just interested in downloading fresh bits.

Closes: #1268
Approved by: cgwalters
2018-03-05 22:42:26 +00:00
Colin Walters
bc01208d13 core: Use libdnf API to disable filelists in "pure rojig" mode
All depsolving etc. was done on the server side; we just need the
`primary.xml` in order to enumerate available rojigRPMs.

Update submodule: libdnf

Requires: https://github.com/rpm-software-management/libdnf/pull/416

Closes: #1268
Approved by: cgwalters
2018-03-05 22:42:26 +00:00
Jonathan Lebon
03874ba49a core: Print rpmmd to journal in prepare()
The "Preparing pkg txn" message is a bit misleading when all we're doing
is e.g. `refresh-md` or check-mode auto-updates trigger. Move that
message to `prepare()` instead.

We already do print to the journal the repos that are enabled before we
try to update them. That seems like good enough information for the
cases mentioned above.

Closes: #1289
Approved by: cgwalters
2018-03-05 20:06:19 +00:00
Jonathan Lebon
747e52cbc9 app/status: Display StateRoot if multiple OSes
Auto-detect if there are multiple OSes deployed and display the
StateRoot by default if so.

Closes: #1289
Approved by: cgwalters
2018-03-05 20:06:19 +00:00
Jonathan Lebon
b54b8744b9 tests/libvm: Handle transient service already existing
We would error out when trying to start the transient httpd service if
it already exists, e.g. from a previous test.

Depending on how we exit, the `vm_stop_httpd` trap for the previous test
might not have been able to kick in. I think this happens when we exit
using `fatal`, which just does an `exit 1`. It's not strictly an error,
so doesn't trip the `ERR` handler.

Let's just go the extra mile and explicitly delete transient services if
they already exist.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
a05a21edd3 daemon/refresh-md: Describe transaction as "refresh-md"
Not sure what I was thinking using "makecache" as the human-friendly
title for this transaction, when the well-known name is "refresh-md".
Let's just make these match.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
3496947f8d configure.ac: Also build in debug mode for -Og
I prefer to use `-Og` rather than `-O0` in debug mode. Notably, it shuts
up `_FORTIFY_SOURCE` warnings which require *some* optimizations turned
on.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
d85a1fba0a libpriv/util: Factor out size limit checking
This will be used in the upcoming patch.

Closes: #1284
Approved by: cgwalters
2018-03-01 23:29:17 +00:00
Jonathan Lebon
f6fb505cac daemon: Complete output-to-self rename
To reduce confusion in future versions of myself and other readers,
complete the suggested rename from "redirect-output" to "output-to-self"
to internal variable names as well.

Closes: #1283
Approved by: cgwalters
2018-03-01 23:04:11 +00:00
Colin Walters
36071d3c69 rojig-rename: (almost) Everything else
This renames the remaining C files, tests, etc.  There are only
a few hits for `jigdo` left; changing them would be a format break,
so let's wait to do that until we need to.

Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
ec5b560979 rojig-rename: Client side files
Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
df86d81ad7 rojig-rename: Rename the "build" side files
Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
6dcc8376a1 rojig-rename: Core defines
Rename the `core.h` file and the `#define` set.

Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Colin Walters
76919a0c4b rojig-rename: API functions in core/origin, pruning refspec
This renames the API functions in the core and origin, and also fixes up the
fact that we were still looking for `jigdo/` refs in the pruning code.

Closes: #1279
Approved by: jlebon
2018-03-01 22:35:46 +00:00
Jonathan Lebon
bb4033f3e8 app/usroverlay: Do a root check and fix typo
Let's give a nicer error than 'Permission denied' if users try to run
this as non-root. Kinda overkill to set up polkit auth for this command.
Feels like something only uid 0 should be able to do anyway.

Also fix `/usr` typo.

Closes: #1286
Approved by: cgwalters
2018-03-01 21:30:54 +00:00
Colin Walters
50b1f9b63f compose: Also treat FUSE as a netfs
Fedora is apparently currently using sshfs because S390 is in a different
location than the main servers.

Since it seems nontrivial to detect just sshfs, and FUSE is problematic in
general, let's just do the the not-horrific-on-netfs path for all FUSE mounts.

Closes: #1285
Approved by: jlebon
2018-03-01 18:51:42 +00:00
Jonathan Lebon
83a94ffe95 daemon/os: Check deployment before using it
If one isn't actually booted in a deployment, we'd get `NULL` from
libostree. Check for it before trying to use it. Something something
Rust.

This will all go away soon with #1268, though this quick fix should
allow anyone hitting this to use FAHC RPMs to move forward.

Closes: #1282
Approved by: cgwalters
2018-02-28 17:52:42 +00:00
Colin Walters
07d5cb5914 scripts: Disable rofiles-fuse for glibc locales
OK so I give up on this glibc locales issue; see
https://github.com/ostreedev/ostree/pull/1470

Based on what I've been reading it looks like newer FUSE may
help, but we can't rely on that.

We should also rewrite the upstream glibc code to be less pathological; it'd
make sense to use `O_TMPFILE` for example, and keep track of how many bytes we
wrote rather than calling `fstat()`, and rather than `truncate()` on the tmpl
file at the end, do a create-empty-file-then-`rename()`. But for now let's go
with this so we get the pretty `●` back in rojig mode!

Closes: #1280
Approved by: jlebon
2018-02-28 16:33:20 +00:00
Jonathan Lebon
ccae8ca977 auto-updates: Redirect output to self if timer
As mentioned during code review, it feels odd to have our automatic
service collect output under its name rather than the main daemon. It
shouldn't be thought of as a daemon with its own logs, it's really just
a trigger.

We change this here so that for automatic updates, output is redirected
to the daemon stdout, which of course goes to the journal. This should
make logs in case of errors more discoverable as well since
`rpm-ostreed` is the well-known name.

I drilled down the notion directly into `RpmostreedTransaction` since I
think it's a useful property that might be handy at a more general
level.

Closes: #1278
Approved by: cgwalters
2018-02-28 14:13:47 +00:00
Jonathan Lebon
f0910c2b5c libpriv/output: Also quiet down progress if not tty
Teach the RpmOstreeOutput default handler to be nice to non-TTYs as
well, just like we did in #1225. We should look at somehow unifying this
with the code in `rpmostree-dbus-helpers.c`.

Closes: #1278
Approved by: cgwalters
2018-02-28 14:13:47 +00:00
Jonathan Lebon
80bd997212 daemon/os: Check transaction before connecting signal
Didn't hit this, but clearly we should check if there's even a
transaction to listen to before trying to connect a signal.

Closes: #1278
Approved by: cgwalters
2018-02-28 14:13:47 +00:00
Jonathan Lebon
26f3784972 daemon/transaction: drop emit_message_printf() helper
This was superseded by `rpmostree_output_message`. This is prep for
being able to "silence" transactions and instead have all the output go
to the daemon.

Closes: #1277
Approved by: cgwalters
2018-02-27 21:14:55 +00:00
Colin Walters
aba3f444d6 scripts: Support RPMOSTREE_SCRIPT_DEBUG
This makes it easy to get an interactive shell instead of executing a specific
script. I used this while debugging `build-locale-archive`. This is better than
`bwrap-script-shell.sh` as we'll get the real rofiles-fuse etc., and
additionally have the root filesystem at the exact same point.

Closes: #1275
Approved by: jlebon
2018-02-27 19:16:18 +00:00