Project

General

Profile

Bug #99

onu should not hardcode opensolaris.org, shaft the unsuspecting

Added by Rich Lowe over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
-
Start date:
2010-08-26
Due date:
% Done:

100%

Estimated time:
Difficulty:
Tags:
Gerrit CR:

Description

When used with the -d option, onu(1) disables the on-nightly publisher in the target boot environment, to avoid pkg complaints about the (now non-running) depot backing the on-nightly publisher being down.

However, in doing so (and in various other cases), it explicitly prefers the 'opensolaris.org' publisher instead, which is now incorrect for many of us, and is only going to get more incorrect.

In cases where pkg mucks around with opensolaris.org, it should either use the publisher from which the prior ON packages were installed, or otherwise restore "the prior configuration" in this respect.

It certainly should not do things that run us directly into pkg bug 16785 (which will be fixed in pkg b147, but that doesn't help us right now).

#1

Updated by Piotr Jasiukajtis over 10 years ago

  • % Done changed from 0 to 10

On an updated IPS bits onu fails into following error if you use '-d' option:

estibi@os-devel:/code/illumos-gate# ./usr/src/tools/scripts/onu -d /code/illumos-gate/packages/i386/nightly/ -vOt illumos_147_05 -U on-nightly
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "/usr/lib/python2.6/ConfigParser.py", line 531, in get
    raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'publisher'
starting pkg.depotd -d /code/illumos-gate/packages/i386/nightly//repo.redist -p 13000
beadm create illumos_147_05
[27/Aug/2010:13:02:13] INDEX Checking for updated package data.
[27/Aug/2010:13:02:13] INDEX Updating search indexes
beadm mount illumos_147_05 /tmp/onu.xAaaQJ
pkg -R /tmp/onu.xAaaQJ set-publisher --no-refresh --non-sticky opensolaris.org
pkg -R /tmp/onu.xAaaQJ set-publisher -e --no-refresh -P -O http://localhost:13000/
pkg set-publisher: requires a publisher name
Usage:
        pkg set-publisher [-Ped] [-k ssl_key] [-c ssl_cert]
            [-g origin_to_add|--add-origin=origin_to_add ...]
            [-G origin_to_remove|--remove-origin=origin_to_remove ...]
            [-m mirror_to_add|--add-mirror=mirror_to_add ...]
            [-M mirror_to_remove|--remove-mirror=mirror_to_remove ...]
            [-p repo_uri] [--enable] [--disable] [--no-refresh]
            [--reset-uuid] [--non-sticky] [--sticky]
            [--search-after=publisher]
            [--search-before=publisher]
            [--approve-ca-cert=path_to_CA]
            [--revoke-ca-cert=hash_of_CA_to_revoke]
            [--unset-ca-cert=hash_of_CA_to_unset]
            [--set-property name_of_property=value]
            [--add-property-value name_of_property=value_to_add]
            [--remove-property-value name_of_property=value_to_remove]
            [--unset-property name_of_property_to_delete]
            [publisher]
pkg -R /tmp/onu.xAaaQJ set-publisher -e --no-refresh -P -O http://localhost:13000/ failed: exit code 2

So.. onu needs to be updated to understand new repo format.
Seems like cfg_cache is no longer created and 'onu' is looking for that:

if [ -n "$repodir" ]; then
        redistdir=$repodir/repo.redist
        [ -d $redistdir ] || exit_error "$redistdir not found" 
        redistpub=$(python2.6 <<# EOF
                import ConfigParser
                p = ConfigParser.SafeConfigParser()
                p.read("$redistdir/cfg_cache")
                pp = p.get("publisher", "prefix")
                print "%s" % pp
                EOF)

Updated IPS bits are here: http://91.194.74.82:10000

#2

Updated by Rich Lowe over 10 years ago

Piotr Jasiukajtis wrote:

On an updated IPS bits onu fails into following error if you use '-d' option:
[...]

So.. onu needs to be updated to understand new repo format.
Seems like cfg_cache is no longer created and 'onu' is looking for that:
[...]

Updated IPS bits are here: http://91.194.74.82:1000

The right thing to do here is for onu to use set-publisher -p in the -d case (as you see, -U seems to be ignored when -d is used).
I'll try and get that done too. Ideally, we'd use -p whenever a name is not explicitly specified.

If the URL you give is your production repo, do you have a way to roll it back to bits that work?

#3

Updated by Rich Lowe over 10 years ago

It turns out that set-publisher -p is not usable for this, and nor, at present, is pkgrepo(1).
It seems like the untested diff below should work.

Seems I was wrong about this change not really affecting us, I was only thinking that any pkg
that would create a new repo would also be able to read one, I forgot onu did something this twisted.

diff -r 469a56ad4b3b usr/src/tools/scripts/onu.sh
--- a/usr/src/tools/scripts/onu.sh    Fri Aug 27 21:10:45 2010 -0400
+++ b/usr/src/tools/scripts/onu.sh    Fri Aug 27 22:08:32 2010 -0400
@@ -239,10 +244,12 @@
 if [ -n "$repodir" ]; then
     redistdir=$repodir/repo.redist
     [ -d $redistdir ] || exit_error "$redistdir not found" 
+    typeset cfgfile=$redistdir/cfg_cache
+    [[ ! -e $cfgfile ]] && cfgfile=$redistdir/pkg5.repository
     redistpub=$(python2.6 <<# EOF
         import ConfigParser
         p = ConfigParser.SafeConfigParser()
-        p.read("$redistdir/cfg_cache")
+        p.read("$cfgfile")
         pp = p.get("publisher", "prefix")
         print "%s" % pp
         EOF)
#4

Updated by Piotr Jasiukajtis over 10 years ago

The repo URL was wrong (missing 0)
http://91.194.74.82:10000

Sorry about that.

#5

Updated by Rich Lowe over 10 years ago

  • % Done changed from 10 to 90

Webrev: http://richlowe.net/webrevs/il-onu

Including the simple method of handling the new pkg repo format, from comment #3

#6

Updated by Rich Lowe over 10 years ago

It seems that with new pkg5 bits (after the repo layout change) onu now loses the race between depot startup and repo refresh, and fails routinely for both Piotr and myself.

I've chosen to fix this by using file:// URIs with -d, the only mode in which onu runs a depot. This also makes things faster, removes the major annoyances with publisher order cleanup, and generally makes things better, I think.

The downside is that the 134 pkg client doesn't understand file:// URIs, given we depend on newer pieces to build, and realistically as the target BE for an installation, this seems reasonable to me.

#7

Updated by Rich Lowe over 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 90 to 100

Fixed in r13160 commit:fe1e90cb470e

Also available in: Atom PDF