Commit Graph

1732 Commits

Author SHA1 Message Date
Colin Walters
0428275a3c tree-wide: Port to new libglnx tmpdir API
Lots of cleanups, and this also allows us to fully port to new style in several
places.

We can drop our own `rpmostree_mkdtemp()`.

Update submodule: libglnx

Closes: #928
Approved by: jlebon
2017-08-22 17:21:37 +00:00
Colin Walters
82f95e7761 daemon/upgrader: Use new libostree timestamp-check option
Since we have a copy of this libostree code, pick up the new
changes from <https://github.com/ostreedev/ostree/pull/1055>.

Note the added test doesn't really test our logic since
we're only doing local pulls, but at least we have something.

Closes: #932
Approved by: jlebon
2017-08-22 16:08:21 +00:00
Colin Walters
ce2033c182 lib/core: Unlink to-import RPMs before unpacking
Was just reading the code. We have similar logic in libostree for individual
objects and deltas.

Closes: #933
Approved by: jlebon
2017-08-22 15:51:05 +00:00
Colin Walters
83bd3c8d13 bin/compose: Move /etc/{passwd,group} injection later
There's no reason to touch things in the target root *before*
we've even downloaded the repodata.  Further, doing so has
the potential trigger the "existing root" logic in libdnf if
it detects `/usr`.  This doesn't matter now since we're writing
to `/etc/`, but it will for later work, so let's put these bits
in the right place.

Prep for <https://github.com/projectatomic/rpm-ostree/pull/927>

Closes: #931
Approved by: jlebon
2017-08-22 01:02:52 +00:00
Colin Walters
932520a0c7 tests/compose: Be a bit more verbose
This would have helped me debug an issue that caused the first compose to fail.

Closes: #931
Approved by: jlebon
2017-08-22 01:02:52 +00:00
Colin Walters
129f95b6d8 bin/compose: Move treefile variable into self struct
Prep for a future patch.

Closes: #931
Approved by: jlebon
2017-08-22 01:02:52 +00:00
Colin Walters
b419cb9071 lib/passwd: Misc code cleanup and style porting
I was briefly thinking about sysusers work, and decided to do some quick cleanup
here.

Closes: #929
Approved by: jlebon
2017-08-21 16:59:46 +00:00
Colin Walters
f51611dc74 tree-wide: Some misc libglnx porting
Port away from `glnx_set_error_from_errno` to prefixing errors or libglnx
wrappers as appropriate.

Closes: #926
Approved by: jlebon
2017-08-18 17:38:49 +00:00
Colin Walters
9711ea6c16 Release 2017.8
Closes: #925
Approved by: jlebon
2017-08-17 21:04:26 +00:00
Colin Walters
fe1be77025 sysroot: Prefix error when loading deployment with index
This would have helped me debug <https://github.com/projectatomic/rpm-ostree/issues/923>.

Closes: #924
Approved by: jlebon
2017-08-17 16:53:48 +00:00
Colin Walters
8bb604ce67 tree-wide: Port to ostree_repo_{open,create}_at()
A lot of code gets nicer.

Closes: #922
Approved by: jlebon
2017-08-17 15:28:14 +00:00
Colin Walters
1f0a76985e daemon: Use journal over syslog
systemd has to go to a bit more effort to integrate `syslog()`, let's
use the journal directly for consistency.  Just happened to be
reading the code.

Closes: #921
Approved by: jlebon
2017-08-17 13:47:33 +00:00
Jonathan Lebon
ef889b0b3a daemon: use new journal-msg signal
Make use of the new journal-msg signal that OstreeSysroot emits. Since
we now also only rely on the output API to print messages, this allows
us to drop the outrageous hacks we had to do to watch our own stdout,
part of which Coverity didn't like.

Coverity CID: 163694

Closes: #919
Approved by: cgwalters
2017-08-16 16:05:06 +00:00
Jonathan Lebon
1fb9dc57c9 daemon: ensure we consistently use output API
There were places where we were relying on the stdout self read hack to
relay messages to clients. Fix those by explicitly using the output API
in all spots where the daemon may pass. Really, we should exclusively be
using the output API in the daemon and libpriv trees, though many other
instances exist for now.

Closes: #919
Approved by: cgwalters
2017-08-16 16:05:06 +00:00
Jonathan Lebon
7b774cee7e output: add support for messages
This is already supported by the D-Bus API, though not in our output
wrapper.

Closes: #919
Approved by: cgwalters
2017-08-16 16:05:06 +00:00
Jonathan Lebon
da2c4ea8ca libglnx: bump for Coverity fixes
Update submodule: libglnx

Closes: #920
Approved by: cgwalters
2017-08-16 15:48:49 +00:00
Jonathan Lebon
35d69c1577 container-builtins: squash a -Wmaybe-uninitialized
Closes: #920
Approved by: cgwalters
2017-08-16 15:48:49 +00:00
Colin Walters
b6705f3feb daemon: Check for updated rpms when upgrading
This closes a longstanding bug - since package layering first
landed, we only checked for newer RPMs if the base tree changed.
In some scenarios like RHELAH, this doesn't matter much by default
since they move at the same cadence.  Except if you use EPEL for example.
In Fedora, today the FAH releases are async of the rpm-md repos, and
there's also COPR which can update more than once a day even.

We should check for both update sources. Luckily we'd already introduced logic
for this in the treecompose case (checksumming the depsolved package sack). We
just need to start using it for client side assembly too.

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

Closes: #911
Approved by: jlebon
2017-08-16 15:33:11 +00:00
Jonathan Lebon
8dddefbad3 unpacker: properly check for glib error
`g_mkdtemp_full` returns a pointer to the template var itself or NULl on
error. We were treating it like an integer.

Coverity CID: 163698

Closes: #918
Approved by: cgwalters
2017-08-15 20:26:14 +00:00
Jonathan Lebon
8ee1385492 scripts: check var before use
We were using the `bwrap` var before checking it for `NULL`.

Coverity CID: 163704

Closes: #918
Approved by: cgwalters
2017-08-15 20:26:14 +00:00
Jonathan Lebon
b4411f5fc0 core: log error to journal
I hesitated on this one. Really, we *could* just explicitly cast the
result to mark it as used, though OTOH, we really should at least drop
something in the journal. It's not fatal, but it shouldn't happen so we
should know about it.

Coverity CID: 163717

Closes: #918
Approved by: cgwalters
2017-08-15 20:26:14 +00:00
Jonathan Lebon
7553b0000b livefs: comment out dead code
The `replacing` var was already checked to be FALSE higher up.

Coverity CID: 163689

Closes: #918
Approved by: cgwalters
2017-08-15 20:26:14 +00:00
Jonathan Lebon
cf410211d2 dbus-helpers: initialize bus name
In the event that we're not on a message bus, we need to make sure we're
passing NULL.

Coverity CID: 163684

Closes: #918
Approved by: cgwalters
2017-08-15 20:26:14 +00:00
Jonathan Lebon
c59c11f789 container-builtins: initialize fds to -1
1. We weren't initializing all fds to -1, but 0 is a valid fd number.
2. We were checking for nonzero rather than explicitly for -1.

Coverity CID: 163691
Coverity CID: 163700
Coverity CID: 163714

Closes: #918
Approved by: cgwalters
2017-08-15 20:26:14 +00:00
Jonathan Lebon
8d92273f3d vmcheck: create vmcheck branch and rebase onto it
I'm working on getting the vmcheck suite working as part of Fedora's new
CI pipeline. In that context, we want to test the deliverable as it is,
i.e. with SKIP_VMOVERLAY=1. For compatibility with the testsuite, we
ensure that the machine is on the vmcheck branch before starting the
tests.

Eventually, we should try to make the vmcheck suite runnable outside of
a configured build directory to make it easier to re-use in such
contexts.

Closes: #917
Approved by: cgwalters
2017-08-15 15:40:35 +00:00
Jonathan Lebon
188b45146c multitest.py: error if no hosts given
Otherwise it'll just hang waiting for a non-existent host.

Closes: #917
Approved by: cgwalters
2017-08-15 15:40:35 +00:00
Ruixin
534fc30308 app: provide command description in a better place
Before, when using rpm-ostree -h command, the command
description was shown together with the command itself

Now, we separate the command description out, providing
user a better view of the description.

Closes: #916
Approved by: jlebon
2017-08-15 13:09:09 +00:00
Ruixin
a2b2758e0f app: add more rpm-ostree -h output
This is brought up by https://github.com/projectatomic/rpm-ostree/issues/806.

When user types in rpm-ostree [subcommands] -h, the user can now see
more useful information for the subcommands.

Closes: #916
Approved by: jlebon
2017-08-15 13:09:09 +00:00
Colin Walters
ee1613e4bf livefs: Stop changing immutable bit on deployment roots
This is no longer necessary since we switched to tracking livefs state in the
origin, and we don't support changing content outside of `/usr` right now
via livefs.

Just noticed this while looking at the livefs code.

Closes: #912
Approved by: jlebon
2017-08-10 13:58:41 +00:00
Colin Walters
f41183e0e5 app/ex-container: Port to new style
Was just looking at this code as part of unified core work. It was an easy port.

Closes: #913
Approved by: jlebon
2017-08-10 13:39:08 +00:00
Colin Walters
0ff4403253 bin/compose: Port to new code style
Move basically everything except early option
processing into a helper function.

Also update a few other misc bits above that to new style.

Closes: #904
Approved by: jlebon
2017-08-08 17:09:13 +00:00
Colin Walters
162b8d4898 bin/compose: Silently ignore --workdir-tmpfs
Down the line when we have a unified core, this will be totally unnecessary.
Even without that, it's not worth the maintenance pain for us. Anyone who wants
this can easily on their own mount a tmpfs and point us at it with --workdir.

Prep for further code cleanup.

Closes: #904
Approved by: jlebon
2017-08-08 17:09:13 +00:00
Colin Walters
39e36db741 postprocess: Port a bit more to new style
Was looking at this file to change how we do kernels, and noticed these two were
straightforward ports.

Closes: #909
Approved by: jlebon
2017-08-08 16:24:45 +00:00
Colin Walters
787c880b64 bin/rebase: Add -b and -m options
The rebase command syntax has confused people a lot.  Let's follow
git here and add a `-b/--branch` option and encourage people to use
that.  The case of switching remotes is `-m/--remote`; it's definitely
unfortunate that `-r` is already taken for `--reboot`.

One thing I'm a little bit unhappy about is how we're doing logic
on the client side here.  Changing the DBus API for this would
also be awkward though.

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

Closes: #890
Approved by: jlebon
2017-08-08 16:02:15 +00:00
Colin Walters
a3250f221d docs: Update admin handbook, mention ex in manpage
- Focus on `rpm-ostree` rather than `atomic host` since...well, a
   lot of stuff isn't exposed there and the whole branding is confusing.
 - Mention `ex`, `rebase` etc.

Closes: #908
Approved by: miabbott
2017-08-07 20:56:55 +00:00
Colin Walters
9b22c2c516 scripts: Journal execution of %post/%posttrans, and times for all scripts
The script delay is annoying; some of them take over half a second here. This
helps with debugging. Another enhancement we could make after this is aborting
scripts that appear to be hung after e.g. 30 seconds, and logging that.

Closes: #905
Approved by: jlebon
2017-08-03 16:58:52 +00:00
Jonathan Lebon
dc24dd3105 rollback: allow users to undo a rollback
The new API to find pending and rollback deployments do so relative to
the booted deployment. This caused an interesting behaviour: the first
time a user uses "rpm-ostree rollback", it would (as expected) move the
previous deployment first. but the second call to "rpm-ostree rollback"
would fail since there were now no more rollback deployments.

We fine tune the logic here to allow this, as well as the more general
case of putting the booted deployment back on top.

This fixes a subtle regression from b7cf58e
(https://github.com/projectatomic/rpm-ostree/pull/767).

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

Closes: #907
Approved by: cgwalters
2017-08-03 14:43:16 +00:00
Jonathan Lebon
d9c1e4a5d3 daemon: use upstreamed function to find rollback
Now that the query_deployment() function was upstreamed in ostree (see
https://github.com/ostreedev/ostree/pull/897), let's just use it from
there and drop our copy here.

Closes: #907
Approved by: cgwalters
2017-08-03 14:43:16 +00:00
Jonathan Lebon
0c9f77ca78 vmsync: overlay /etc only if it exists
This is the same as ddc0f40 but for `vmsync`.

Closes: #907
Approved by: cgwalters
2017-08-03 14:43:16 +00:00
Jonathan Lebon
95d3f36fc4 vmcheck: fix sync and overlay
Fix regression from https://github.com/projectatomic/rpm-ostree/pull/870
which caused `vmsync` and `vmoverlay` to no longer actually overlay
ostree bits.

We go back to using `--files-from`, but just make sure to filter out the
stuff that we don't need (and which previously caused issues).

Closes: #907
Approved by: cgwalters
2017-08-03 14:43:16 +00:00
Colin Walters
0515f59d70 bin/compose: Use autocleanups for context structure
Prep for more code cleanup here and porting to new style.  We
had a mix of owner pointers.  Fix this by consistently having
the `self` struct own the data.

Closes: #903
Approved by: jlebon
2017-08-02 17:41:43 +00:00
Colin Walters
08e3f5de7f lib: Log task output for pre/post scripts
Some of the scripts can be expensive (`shared-mime-info` for example), and we
appear to be hanging for at least a few seconds even on fast hardware. I'd like
to have a lot more logging here...potentially something like showing
individual package names live in the terminal, but this is a start.

Closes: #902
Approved by: jlebon
2017-08-02 17:16:28 +00:00
Ruixin
53c39632d4 Deployment: add endoflife
When commit metadata contains ostree.endoflife attribute,
its information will be added to the deployment Variant,
which will later be shown as a red & bold message when
'rpm-ostree status' command is called.

A test is added for future regression

Closes: #889
Approved by: cgwalters
2017-08-02 13:53:10 +00:00
Colin Walters
0d4d6be94f Implement file triggers (%transfiletriggerin) for layered pkgs
File triggers are a post-RHEL7 thing; more information at
http://rpm.org/user_doc/file_triggers.html

There are two notable users I've been testing this with;
`glib2` and `vagrant`.  The `vagrant` one is more immediately urgent,
since it makes `vagrant-libvirt` work, which I currently rely on
for my workstation dev.

I've tested things successfully with `vagrant`, and I did verify that we run the
`glib2` ones when doing `rpm-ostree ex container`.

Long term, more transaction file triggers are likely to live in
"base" packages like `glib2`.  We don't implement those yet, but
extending this to do that shouldn't be too hard.

There was *significant* what I'd call reverse engineering of the
implementation in librpm.  The file triggers code there is spread out
and abstracted in a few different places in the code.  I found
trying to understand what header values were involved to be quite
tricky.

There are some corner cases like multiple patterns that I *think*
this does correctly, but could use more validation.  The main
question I had was - is it required that the patterns for e.g.
`%transfiletriggerin` and `%transfiletriggerun` be identical?

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

Closes: #869
Approved by: jlebon
2017-07-27 20:58:09 +00:00
Jonathan Lebon
d4effe8f47 dbus: don't register if not active
Follow-up tweak to #894. Make the client smarter so we only register
when we know we can. We could be more sophisticated here and e.g.
introduce the concept of "read-only" clients in the daemon to only allow
access to non-mutating methods, though let's delay that discussion at
least until the daemon learns to auto-exit.

Closes: #898

Closes: #900
Approved by: cgwalters
2017-07-27 20:34:22 +00:00
Colin Walters
34b5a004a8 daemon: Add a sanitycheck(/bin/true) before we deploy a tree
This is a followup to https://github.com/projectatomic/rpm-ostree/pull/888
but more comprehensive; in the layering case, the sanitycheck runs
after all the `%posttrans` scripts, so we'll get a consistent error message
for the `rm -rf /` test.

We also do the sanitycheck for the "pure ostree" case, as well as cases
where we didn't actually layer packages (including `ex override remove` as
well as simply regenerating an initrd).

There's obviously a lot more we could do in a sanitycheck; as I say in the
comment it's tempting to consider trying to boot systemd (in a fully volatile
config), but for now let's do this. In the end of course the admin has rollback
too.

Closes: #892
Approved by: jlebon
2017-07-27 17:58:58 +00:00
Jonathan Lebon
ddc0f40355 overlay.sh: also overlay /etc to /usr/etc
This is needed to test changes to the D-Bus config file.

Closes: #894
Approved by: cgwalters
2017-07-27 17:10:41 +00:00
Jonathan Lebon
95bc93205e vmcheck/test-basic.sh: adjust for new polkit policy
Now that we require clients to have an active session to RegisterClient,
we can't use runuser to check for non-root functionality. Add a new
vm_cmd_as() function to allow connecting as a different user. While
we're there, do some minor cleanups to consistently use `local` when
possible.

Closes: #894
Approved by: cgwalters
2017-07-27 17:10:41 +00:00
Jonathan Lebon
f6c422a6d5 vmcheck/test-basic.sh: strengthen pkg-add test
This test would actually fail even if the bin user were allowed to
install a package because there are no enabled repos to install. Fix it
so that we know we have foo there and explicitly check that the error
message is what we expect.

Closes: #894
Approved by: cgwalters
2017-07-27 17:10:41 +00:00
Jonathan Lebon
577aef98e2 app: spawn polkit authentication agent
Spawn pkttyagent when trying to call a method that may require
authentication to give users a chance to provide auth right from the
terminal.

Since we're now relying on polkit for authorizing most of the OS
interface methods, let's drop the root check on those.

Closes: #894
Approved by: cgwalters
2017-07-27 17:10:41 +00:00