Commit Graph

214 Commits

Author SHA1 Message Date
Alexander Larsson
dbf717ac4b Add local-pull archive-z2 <=> bare-user roundtrip test
This creates a archive-z2 repo, pull-locals it to bare-user and then
again back to archive-z2 making sure things fsck along the way.
Then it checks out all repos and makes sure each one reproduces
the same result.

Unfortunately we can't install this as a real test because
it doesn't work in the test-runner because tmpfs doesn't support
user xattrs.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 12:03:27 +01:00
Alexander Larsson
fcd3caf6dd Add test-basic-user.sh testing for bare-user repos
This just does whatever test-basic.sh does, but on a bare-user
repo.

This works standalone, but unfortunately it breaks in
gnome-desktop-testing-runner as /tmp doesn't support
xattrs, so it is not installed atm.

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:44 +01:00
Alexander Larsson
a3422791d4 Split out basic tests from test-basic.sh
This will let us reuse them with other repo types

https://bugzilla.gnome.org/show_bug.cgi?id=741125
2014-12-08 10:39:44 +01:00
Colin Walters
038ba3dade tests: Fix u-boot test failure
This bit needs to be specific to syslinux.
2014-11-25 15:21:12 -05:00
Giuseppe Scrivano
bbd3fd7a22 tests: fix intermittent failure for test-sysroot
libtestExec doesn't run twice the same process now.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-11-10 19:48:45 +01:00
Colin Walters
97519b6c22 admin-test: Fix two typos in bootloader UI change
Based on a patch from Giuseppe Scrivano <gscrivan@redhat.com>
2014-11-06 18:22:20 -05:00
Matthew Barnes
e5b147c643 libostree: Reformat bootloader titles
Use the pattern:

  $PRETTY_NAME [$COMMIT_VERSION] (ostree[:$OSNAME][:$DEPLOYMENT_INDEX])

$OSNAME is only shown if there are multiple values.

$COMMIT_VERSION refers to the version tag in the commit's metadata.

$DEPLOYMENT_INDEX is only shown if no $COMMIT_VERSION is available.

https://bugzilla.gnome.org/show_bug.cgi?id=739416
2014-11-03 20:43:36 -05:00
Colin Walters
bcf40b4902 pull: Add depth support
For mirroring in particular, we really want to be able to traverse
all history.

$ ostree --repo=repo pull --mirror --depth=-1

https://bugzilla.gnome.org/show_bug.cgi?id=739240
2014-10-28 11:16:55 -04:00
Giuseppe Scrivano
7973a58607 checkout: permit checkout of a single file
fixes a coredump when using a command like:

$ ostree --repo=repo checkout -U --subpath=/usr/lib/passwd \
  fedora-atomic/rawhide/x86_64/docker-host usrlib-new

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-24 11:18:45 -04:00
Colin Walters
b43ce2329e tests: Add some versioning metadata and test it appears in status output
Followup to previous commits.
2014-10-23 11:24:44 -04:00
Giuseppe Scrivano
49de180191 corrupt-repo-ref.js: more aggressive file corruption
changing only a byte may not generate a corrupted file, so play very
safe and change 10 bytes.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-22 20:02:06 +02:00
Giuseppe Scrivano
c4b7717076 tests: test-admin-deploy-switch doesn't use deprecated "current" symlink
commit dfeb27eca5 removed it, so change
the test to not use it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-21 16:18:30 -04:00
Giuseppe Scrivano
22a82341b1 tests: fix --help test
Check for "Usage" only in the root command, builtins may not output
it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-21 16:18:30 -04:00
Colin Walters
cdfcf09316 Add "ostree remote delete" and corresponding API
For Anaconda, we have an ugly bootstrapping problem where we need to
add the remote to the repository's config, then do a pull+deploy, then
remove and re-add the config, because /etc/ostree/remotes.d doesn't
exist yet in the target system.

https://bugzilla.gnome.org/show_bug.cgi?id=738698
2014-10-17 19:09:42 -04:00
Colin Walters
d546abfa2a libostree: Add initial GRUB2 support
In this approach, we drop a /etc/grub.d/15_ostree file which is a
hybrid of shell/C that picks up bits from the GRUB2 library (e.g. the
block device script generation), and then calls into libostree's
GRUB2 code which knows about the BLS entries.

This is admittedly ugly.  There exists another approach for GRUB2 to
learn the BLS specification.  However, the spec has a few issues:

https://www.redhat.com/archives/anaconda-devel-list/2014-July/msg00002.html

This approach also gives a bit more control to the admin via the
naming of the 15_ostree symlink; they can easily disable it:

Or reorder the ostree entries ahead of 10_linux:

Also, this approach doesn't require patches for grub2, which is an
issue with the pressure to backport (rpm-)OSTree to EL7.
2014-10-16 14:15:00 -04:00
Giuseppe Scrivano
7b0e70b72f tests: do not leave running httpd after tests exit
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-10-07 12:05:59 +02:00
Colin Walters
1dceb99056 Add missing file from previous commit 2014-10-03 14:38:30 -04:00
Colin Walters
b3ad113f78 Add "unconfigured-state" concept to origin files
Some operating systems may come with external tools for subscription
management that drive access to the content.  In that case, the origin
file may not be useful (for example, it could refer to an installer
ISO).

This patch will allow OS installers to inject that state, with a
useful error message, directing the system administrator to an
external tool.

See: https://github.com/projectatomic/rpm-ostree/issues/31

https://bugzilla.gnome.org/show_bug.cgi?id=737686
2014-10-03 14:03:55 -04:00
Owen W. Taylor
cc180f5d38 Test 'ostree admin --print-current-dir'
Add a test for the --print-current-dir option

https://bugzilla.gnome.org/show_bug.cgi?id=731051
2014-09-26 11:55:11 -04:00
Owen W. Taylor
c3f8019c19 Add test case for 'admin instutil set-kargs'
Test out the newly added options to 'instutil set-kargs' along with
the existing functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=731051
2014-09-26 11:55:11 -04:00
Owen W. Taylor
7fce7e0338 Add test for the behavior of --help
Recursive over ostree and all subcommands, and check that --help
is supported, properly outputs to standard out, and exits
with a 0 exit status. Check that for commands with subcommands,
they produce the help output to standard error when run with no arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=737194
2014-09-25 14:28:58 -04:00
Colin Walters
8f4ffa6950 deploy: Copy parent directories for modified config files
Previously, in the case where a parent directory of a modified config
file was removed, we would throw an exception.  This happens when
switching from a tree that has some software (e.g. firewalld), to one
that does not.

While it's nice to have this warning that your config file probably no
longer applies, there's no need to make it so...fatal.

It's particularly problematic that the only easy workaround is to
remove the config files from your current tree - which breaks
rollback.

The solution then is for for us to take ownership of the parent
directories too into the new /etc.  Admins can clean up these files
afterwards at any time.

https://bugzilla.gnome.org/show_bug.cgi?id=734293
2014-09-16 12:06:10 -04:00
Colin Walters
7b01bd2e43 deploy: Consistently use fd-relative API
While looking to fix a different bug here, I found the current
state of things where we had a mix of fd-relative API versus not
frustrating.

Change the code around to consistently use *at, and also add some more
tests.
2014-09-13 10:41:59 -04:00
Colin Walters
f8f5da219e Add repository "summary" file and metalink support
For Fedora and potentially other distributions which use globally
distributed mirrors, metalink is a popular solution to redirect
clients to a dynamic set of mirrors.

In order to make metalink work though, it needs *one* file which can
be checksummed.  (Well, potentially we could explode all refs into the
metalink.xml, but that would be a lot more invasive, and a bit weird
as we'd end up checksumming the checksum file).

This commit adds a new command:

$ ostree summary -u

To regenerate the summary file.  Can only be run by one process at a
time.

After that's done, the metalink can be generated based on it, and the
client fetch code will parse and load it.

https://bugzilla.gnome.org/show_bug.cgi?id=729585
2014-09-03 13:21:52 -04:00
Anne LoVerso
3742c32945 repo-pull: Allow pulling only one directory
Changes the pull API to allow pulling only a single directory instead
of the whole deployment.  This option is utilized by the check-diff
option in rpm-ostree.

Add a new state directory to hold <checksum>.commitpartial files, so
we know that we've only downloaded partial state.
2014-08-20 15:09:32 -04:00
Colin Walters
82fb07e4ae deploy: Also honor multiply-specified kernel args with existing config
If we deployed a new tree inside an existing OS, inheriting kernel
args, we need to use append() instead of replace() to avoid collapsing
multiply specified kernel arguments like console=/dev/foo
console=/dev/bar.

Reported-by: Dusty Mabe <dusty@dustymabe.com>
2014-08-03 14:34:28 -04:00
Colin Walters
9bd229dff5 pull-local: Write detached metadata into the correct repository
We want to write to the dest repo, not src.

Noticed while reviewing this code for some other bug.

https://bugzilla.gnome.org/show_bug.cgi?id=733579
2014-07-22 15:43:33 -04:00
Colin Walters
cdaa9517af repofile: Avoid segfault if querying child in non-directory
The user might "ostree ls /usr/bin/bash/blah", which previously would
segfault.

A somewhat related future enhancement here would be for "ostree ls" to
follow symbolic links.

Reported-by: Dusty Mabe <dustymabe@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=733476
2014-07-21 07:58:07 -04:00
Colin Walters
e392820541 core: Do enumerate ff/ objects as well
An embarassing off-by-one here.  I noticed we weren't pruning them.

https://bugzilla.gnome.org/show_bug.cgi?id=733458
2014-07-21 07:25:51 -04:00
Anne LoVerso
fd56952d6b ostree-repo-resolve-rev: Add function to accept a partial checksum
This patch adds a function that will parse a partial checksum when
resolving a refspec.  If the inputted refspec matches a truncated
existing checksum, it will return that checksum to be parsed.  If
multiple truncated checksums match the partial refspec, it is not
unique and will return false.  This addition is inspired by the same
functionality in Docker, which allows a user to reference a specific
commit without typing the entire checksum.

partial checksums: Add function to abstract comparison

This modifies the list_objects and list_objects_at functions
to take an additional argument for the string that a commit starts
with.  If this string arg is not null, it will only list commit
objects beginning with that string.  This allows for a new function
ostree_repo_list_commit_objects_starting_with to pass a partial string
and return a list of all matching commits.  This improves on the
previous strategy of listing refs because it will list all commit objects,
even ones in past history.  This update also includes bugfixes on
error handling and string comparison, and changes the output structure
of resolve_partial_checksum. The new strcuture will no longer return FALSE
without error.  Also, the hashtable foreach now uses iter.  Also
includes modified test file
2014-07-18 15:15:44 -04:00
Colin Walters
b2329cf875 tests: Add a test for an empty /etc directory gaining content
https://bugzilla.gnome.org/show_bug.cgi?id=731924
2014-06-20 13:43:12 -04:00
Colin Walters
3d5ff5b542 tests: Add a test which exercises --fsync=false 2014-06-18 18:24:41 -04:00
Colin Walters
6a5e66b152 pull: Support --mirror option
There's several use cases for calling into ostree itself to do
mirroring, instead of using bare rsync.  For example, it's a bit more
efficient as it doesn't require syncing the objects/ directory.

https://bugzilla.gnome.org/show_bug.cgi?id=728351
2014-06-16 17:14:13 -04:00
Colin Walters
47610b45c2 Limit metadata to 10 MiB
If fetching GPG-signed commits over plain HTTP, a MitM attacker can
fill up the drive of targets by simply returning an enormous stream
for the commit object.

Related to this, an attacker can also cause OSTree to perform large
memory allocations by returning enormous GVariants in the metadata.

This helps close that attack by limiting all metadata objects to 10
MiB, so the initial fetch will be truncated.

But now the attack is only slightly more difficult as the attacker
will have to return a correctly formed commit object, then return a
large stream of < 10 MiB dirmeta/dirtree objects.

https://bugzilla.gnome.org/show_bug.cgi?id=725921
2014-05-27 14:15:27 -04:00
Colin Walters
a864190a04 admin switch: Allow switching just remote names
This is a followup to the previous commit; for the installation media
case we want to keep the current origin ref, and only switch remotes.
2014-05-15 08:58:44 -04:00
Colin Walters
24e1bf2552 admin switch: Support switching remotes as well
Say I have an installation from CDROM; the remote name may be
"installmedia" or something like that.  We want to allow also
switching remotes.
2014-05-12 17:31:34 -04:00
Colin Walters
a10ddca1da test-sysroot: Use GSystem to spawn subprocess
I was getting a weird hang in the installed tests with the shell as a
zombie process, not reaped by the parent, which was just stuck in
select() on the output pipes.  The thing is we don't actually want to
capture stdout/stderr, we just want to inherit.

GSystem.Subprocess makes that possible, so let's just use it now that
it's a proper installed library.
2014-03-19 09:15:38 -04:00
Colin Walters
f2e0162846 upgrade: Refuse chronologically older commits unless --allow-downgrade
We don't want to allow MITM attackers to intercept upgrade requests
and provide clients with older OS versions vulnerable to security
flaws.

Only "ostree admin upgrade" gets this behavior for now - whether we
want to do it for "ostree admin switch" is another question.
2014-02-20 18:25:56 -05:00
Colin Walters
26d5db696b tests: Fix up GPG tests for more strict EL7 GPG
These GPG tests were failing for me on EL7 - it appears to be because
we had only one directory for both private and public keys, and we
were giving that to ostree for verification, which passed them onto
gpgv.

In EL7 beta at least, gpgv now barfs if it finds a private key where
it is just expecting to find public keys.

Fix this by splitting out the public trusted directory from the
private key directory.  Except now for signing, we still need the
public key there, so symlink it.  Whee!
2014-02-10 09:40:35 -05:00
Colin Walters
2d6374822b Initial basic static delta code drop
This has a very basic level of functionality (deltas can be generated,
and applied offline).  There is only some stubbed out pull code to
fetch them via HTTP.

But, better to commit this now and improve it from a known starting
point, rather than have it languish in a branch.
2014-02-04 10:31:44 -05:00
Colin Walters
844c5ea652 core: Import bup's "rollsum" code, add a test case
For static deltas, one strategy that will be employed is to split each
object into chunks, and only include changed chunks in the deltas.
2014-02-04 10:12:56 -05:00
Colin Walters
390b781d3a pull: Add remotename:ref syntax
This is really the common case.
2014-01-21 08:57:34 +00:00
Colin Walters
3802a0679b tests/pull-corruption: Ensure we corrupt an object to be pulled
This test had some nondeterminism because we chose a random
object to corrupt, but because there were multiple commits, it
was possible that we chose an object that was not being pulled.

Fix this by writing some custom GJS code to find an explicitly random
object that exists in a given ref, an change a random byte offset.
This adds a lot more randomness to the testing too.
2014-01-19 13:19:10 -05:00
Colin Walters
0a9f246016 tests: Small tweaks to pull corruption test
This one is failing here, I suspect it's the generic pull race
condition, but these fixes should make it slightly more reliable.
2014-01-19 11:48:27 -05:00
Colin Walters
1a20ab4420 test-sysroot: Update for API change 2014-01-18 17:50:22 -05:00
Colin Walters
878a43411e admin/switch: New builtin to switch between trees
This is something I want to make easier, as it better showcases the
flexibility of OSTree.
2014-01-18 17:47:16 -05:00
Colin Walters
5034bf3a9d commit: Reject non-regular/non-symlinks earlier with better error message
Also avoid _NOT_SUPPORTED as that triggers the --help behavior from
the commandline; just use _FAILED.

https://bugzilla.gnome.org/show_bug.cgi?id=722410
2014-01-17 10:39:36 -05:00
Colin Walters
b2d0ba7ac1 deploy: Rework kernel arguments, add --karg-append to "admin deploy"
The "ordered hash" code was really just for kernel arguments.  And it
turns out it needs to be a multihash (for e.g. multiple console=
arguments).

So turn the OstreeOrderedHash into OstreeKernelArgs, and move the bits
to split key=value and such into there.

Now we're not making this public API yet - the public OstreeSysroot
just takes char **kargs.  To facilitate code reuse between ostree/ and
libostree/, make it a noinst libtool library.  It'll be duplicated in
the binary and library, but that's OK for now.  We can investigate
making OstreeKernelArgs public later.

https://bugzilla.gnome.org/show_bug.cgi?id=721136
2014-01-16 15:07:55 -05:00
Colin Walters
5bf6099a8b Unify uboot and syslinux test cases
The test-admin-deploy-1 was copied into -uboot at some point.  But
really they should be testing exactly the same thing, except for
the bootloader backend.

Unify these tests by extracting a common test core.
2014-01-15 09:48:04 -05:00
Colin Walters
108546c08c admin: Add --karg-proc-cmdline argument
When installing a new tree inside an existing OS, this is a convenient
way to include the command line arguments one needs (such as root=).
2014-01-15 09:19:32 -05:00