Add more flexible _remote_change() API , expose via 'ostree remote'

For Anaconda, I needed OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
with the GFile *sysroot argument to avoid ugly hacks.  We want to
write the content provided via "ostreesetup" as a remote to the target
chroot only in the case where it isn't provided as part of the tree
content itself.

This is also potentially useful in idempotent systems management tools
like Ansible.

https://bugzilla.gnome.org/show_bug.cgi?id=741577
This commit is contained in:
Colin Walters committed 2014-12-15 21:28:09 -05:00
1 parent 8067e977a7
commit f6a6e68412
4 files changed
+193 -44

No files matched your search

+29 -3
View File
@@ -25,14 +25,26 @@ echo '1..3'
setup_test_repository "bare"
$OSTREE remote add origin http://example.com/ostree/gnome
echo "ok remote add"
assert_file_has_content $test_tmpdir/repo/config "example.com"
$OSTREE remote show-url origin >/dev/null
echo "ok config"
$OSTREE remote add --no-gpg-verify another http://another.com/repo
assert_file_has_content $test_tmpdir/repo/config "gpg-verify=false"
$OSTREE remote show-url another >/dev/null
echo "ok remote no gpg-verify"
if $OSTREE remote add --no-gpg-verify another http://another.example.com/anotherrepo 2>err.txt; then
assert_not_reached "Adding duplicate remote unexpectedly succeeded"
fi
echo "ok"
$OSTREE remote add --if-not-exists --no-gpg-verify another http://another.example.com/anotherrepo
$OSTREE remote show-url another >/dev/null
echo "ok"
$OSTREE remote add --if-not-exists --no-gpg-verify another-noexist http://another-noexist.example.com/anotherrepo
$OSTREE remote show-url another-noexist >/dev/null
echo "ok"
$OSTREE remote delete another
echo "ok remote delete"
@@ -41,4 +53,18 @@ if $OSTREE remote delete nosuchremote 2>err.txt; then
fi
assert_file_has_content err.txt "error: "
$OSTREE remote delete --if-exists nosuchremote
echo "ok"
if $OSTREE remote show-url nosuchremote 2>/dev/null; then
assert_not_reached "Deleting remote unexpectedly failed"
fi
echo "ok"
$OSTREE remote delete --if-exists origin
echo "ok"
if $OSTREE remote show-url origin 2>/dev/null; then
assert_not_reached "Deleting remote unexpectedly failed"
fi
echo "ok"