Commit Graph

2062 Commits

Author SHA1 Message Date
Jonathan Lebon
60a59cbbe4 vmcheck/override-replace: Fix status jq test
We should be checking that there are no requested base replacements
here, not removals. This was likely a copy-paste slip-up from copying
the override-remove tests. I still kept those checks for sanity, and
just tacked on the correct ones.

Closes: #1323
Approved by: cgwalters
2018-04-05 15:26:46 +00:00
Jonathan Lebon
bb07a29bc2 overrides: Allow resetting inactive overrides
This fixes a small regression from #852 which prevented inactive
overrides to be reset. Which is funny, because that's exactly the most
likely time when you would want to reset an override.

Basically, the `!is_layered --> no overrides` doesn't make sense for
inactive overrides. I suspect most people worked around this by just
using `reset --all`.

Closes: #1323
Approved by: cgwalters
2018-04-05 15:26:46 +00:00
Jonathan Lebon
cb99fb44b2 buildutils: Add libglnx.m4 to .gitignore
Not sure why this one isn't being auto-generated.

Closes: #1323
Approved by: cgwalters
2018-04-05 15:26:46 +00:00
Colin Walters
d25588722b ci: Ensure we exclude ostree from base fedora too
rdgo uses an earlier git tag due to branches, until we have proper
repo priorities that don't care about versions, let's do this
hack.

Same thing as https://pagure.io/fedora-atomic-host-continuous/c/a7145410fbc7e73188fde449628fa0343b05e4a4?branch=master

Closes: #1326
Approved by: jlebon
2018-04-05 15:26:23 +00:00
Jonathan Lebon
28a00f8a13 daemon: Factor out function for retrieving DnfSack
Factor out a helper function to create a `DnfSack` for the booted
deployment. Prep for more work.

Closes: #1324
Approved by: cgwalters
2018-04-04 20:48:39 +00:00
Jonathan Lebon
29826564d4 daemon: Create cache dir before writing cached update
If the user never ran e.g. `rpm-ostree install`, then the cache dir will
not even exist yet. Let's make sure it's created before writing the
cached update into it.

Closes: #1324
Approved by: cgwalters
2018-04-04 20:48:39 +00:00
Jonathan Lebon
3a1fd2c139 tests/libvm: Support SSH_CONFIG env var
When juggling multiple test VMs for different purposes, it's useful to
be able to easily e.g. `make vmcheck` a specific one by overriding the
ssh-config file to use, rather than editing the latter each time.

Closes: #1324
Approved by: cgwalters
2018-04-04 20:48:39 +00:00
Jonathan Lebon
bd2920ad01 daemon/upgrader: Return new deployment in deploy()
Enhance `rpmostree_sysroot_upgrader_deploy` to also return the newly
created deployment on success. Prep for more work.

Closes: #1324
Approved by: cgwalters
2018-04-04 20:48:39 +00:00
Colin Walters
2b7f33ca9d core: Bound number of async imports by CPUs
I was doing a `--ex-unified-core` compose of FAW, and started hitting
the fd limit (1024), since we created hundreds of threads.  Since
it doesn't make sense to do that, let's bound the number of concurrent
imports by the number of CPUs.

This is another implementation of the "bounded async" pattern, like
c18628ecb8

Closes: #1317
Approved by: jlebon
2018-04-03 14:39:24 +00:00
Colin Walters
defa1dc38a core/scripts: Support /var/lib/rpm-state
I was trying a `--ex-unified-core` compose of FAW, and things fell over
on `urw-base35-fonts` which does a dance of setting a stamp file in
`%post` and checking it in `%posttrans`.

This whole pattern should be considered deprecated by file triggers. But let's
support it for now.

Note there's a lot of parameter passing as we need a single directory which is
held across multiple script invocations.

Closes: #1319
Approved by: jlebon
2018-03-28 18:37:17 +00:00
Colin Walters
f05b980094 build-sys: Mark libpriv symbols as private
This was caught by the abicheck in Fedora; since we were building with default
visibility for `librpmostreepriv.la` which was linked statically into the public
library, we'd end up with lots of internals as public ABI.

Fix this by using `-fvisibility=private` for the libpriv build and for good
measure elsewhere so we remember to use it by default.

Closes: #1320
Approved by: jlebon
2018-03-28 15:18:11 +00:00
Colin Walters
84f09172e4 core: Prefix error when loading commit for cache branch
Somehow my dev container's pkgcache repo lost a commit.  Prefix
the error so this is easier to debug.

Closes: #1314
Approved by: jlebon
2018-03-26 18:27:38 +00:00
Micah Abbott
0399e185e4 docs: add additional details about 'tmp-is-dir'
Expanded the details around using 'tmp-is-dir' and what happens when
it is used.

Closes: #1315
Approved by: dustymabe
2018-03-26 17:26:54 +00:00
Jonathan Lebon
835c3ad303 Release 2018.4
It's been more than a month, let's get a release out since the tree is
in a fairly good condition now.

Closes: #1313
Approved by: cgwalters
2018-03-26 14:13:35 +00:00
Colin Walters
779f764fcd app: Call Reload right after getting sysroot proxy
A final followup to our pile of "add reload" PRs.  This one is
necessary to fix the `status` race.

Closes: #1312
Approved by: jlebon
2018-03-26 13:05:40 +00:00
Jonathan Lebon
706506b2d1 app/dbus: Always call Reload() after transaction
Specifically in this case, this allows us to close a race condition
during `upgrade --check` where the `CachedUpdate` property might not
have been updated yet when we read it after finishing the transaction.

Closes: #1311
Approved by: cgwalters
2018-03-23 21:50:33 +00:00
Jonathan Lebon
37306e36ee daemon: Add new Reload D-Bus method
Add a new `Reload` method as a softer alternative to `ReloadConfig`.
We'll also make use of this on the client side to sync with the daemon.

Closes: #1311
Approved by: cgwalters
2018-03-23 21:50:33 +00:00
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