Commit Graph

2036 Commits

Author SHA1 Message Date
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
Colin Walters
b304a433a0 Second renaming pass for "rojig"
We're continuing an incremental renaming process; previously we changed
the most user-visible strings.  Now we're doing some internal variables,
and notably the cached refs and the origin files - the latter set is
things that end up on disk.

This leaves the biggest items; renaming APIs, files, and tests.

Closes: #1276
Approved by: jlebon
2018-02-27 18:45:10 +00:00
Jonathan Lebon
829a746821 lib/package: Handle arch pkg transitions
Let's try to match expectations a bit from the dnf/yum world and
describe e.g. a `noarch` package become archful as an upgrade rather
than a removal and an addition. This was originally implicitly supported
(before PR #1230) by the fact that we didn't compare arches at all (and
in fact, arches don't even show up in a `db diff` output for modified
packages).

We bring this back here, but only in the simple case that it's a single
package. We still don't try to do any fancy handling for packages of the
same name.

Closes: #1272

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Jonathan Lebon
64968436e6 lib/package: Re-order arch comparison branches
Making this a separate commit to increase the odds we get this right.
Prep for next commit.

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Jonathan Lebon
56c192f5cc lib/package: Fix logic error in diff algorithm
Classic indentation/bracing error causing logic error. This made us skip
over some packages which then showed up wrongly as removed. This will be
implicitly tested in a new test case added in a following commit.

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Jonathan Lebon
0874152ba6 vmcheck: Drop selinux-policy hack
This shouldn't be necessary anymore.

Closes: #1274
Approved by: cgwalters
2018-02-27 15:44:11 +00:00
Micah Abbott
ad8e9b6de8 man: add example usage for automatic update policy
The man page was a little weak on how to configure and enable the
automatic update policy of `rpm-ostreed`.  I've added an `EXAMPLE`
section that shows the necessary steps to get this working.

Closes: #1273
Approved by: jlebon
2018-02-26 20:21:43 +00:00
Colin Walters
3dd132285a Initial renaming pass of "jigdo" to "rojig"
I noticed that Ubuntu also uses the original "jigdo", so let's start
pulling off the band-aid here and do a mass rename.

For this first pass I'm focusing on CLI entrypoints and docs, as that's what
people are going to see; renaming all of the internal C functions, structure
variables etc. can come later.

Closes: #1269
Approved by: jlebon
2018-02-26 15:32:50 +00:00
Colin Walters
4af55efffd main: Fix wording of ex command description
Previous wording was awkward; noticed this in a CI error.

Closes: #1271
Approved by: jlebon
2018-02-23 18:21:17 +00:00
pcahyna
1ea5426751 fix "make tags"
src/libpriv/rpmostree-cleanup.h was removed in commit f14d1a3536 and its presence in Makefile causes "make tags" to fail.
Closes: #1270
Approved by: jlebon
2018-02-23 16:35:48 +00:00