[pkg-discuss] How to validate whether a publisher is reachable or not

3 views
Skip to first unread message

Ervin Yan

unread,
Mar 14, 2012, 5:20:59 AM3/14/12
to pkg-d...@opensolaris.org, Ervin Yan, Venkatesha M.G., Steve Sundstrom
Hi,

Recently, we happened to find 'pkg install' totally failed due to a network issue, the error looks like:

==========
Framework error: code: 7 reason: Failed to connect to 156.151.58.21: Network is unreachable
URL: 'http://pkg.oracle.com/solaris/release/versions/0/'.
==========


So does 'pkg' command have any options to verify whether the configured publishers are reachable or not,
or something other issues which would cause 'pkg install' fail?

We just want to check it in advanced, and ask user to correct the publisher configuration before our utility run 'pkg install' truly.

Thanks,
Ervin.
_______________________________________________
pkg-discuss mailing list
pkg-d...@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Shawn Walker

unread,
Mar 14, 2012, 11:00:10 AM3/14/12
to Ervin Yan, Venkatesha M.G., pkg-d...@opensolaris.org, Steve Sundstrom
On 03/14/12 02:20, Ervin Yan wrote:
> Hi,
>
> Recently, we happened to find 'pkg install' totally failed due to a network issue, the error looks like:
>
> ==========
> Framework error: code: 7 reason: Failed to connect to 156.151.58.21: Network is unreachable
> URL: 'http://pkg.oracle.com/solaris/release/versions/0/'.
> ==========
>
>
> So does 'pkg' command have any options to verify whether the configured publishers are reachable or not,
> or something other issues which would cause 'pkg install' fail?

No, because it could become unreachable at any point during the
operation, so checking ahead of time would be pointless.

> We just want to check it in advanced, and ask user to correct the publisher configuration before our utility run 'pkg install' truly.

The right way to handle this is to perform the install, check the exit
code, and if it isn't zero, assume failure of the operation.

-Shawn

Mike Gerdts

unread,
Mar 14, 2012, 11:52:32 AM3/14/12
to Shawn Walker, Ervin Yan, Venkatesha M.G., pkg-d...@opensolaris.org, Steve Sundstrom
On Wed 14 Mar 2012 at 08:00AM, Shawn Walker wrote:
> On 03/14/12 02:20, Ervin Yan wrote:
> >Hi,
> >
> >Recently, we happened to find 'pkg install' totally failed due to a network issue, the error looks like:
> >
> >==========
> >Framework error: code: 7 reason: Failed to connect to 156.151.58.21: Network is unreachable
> >URL: 'http://pkg.oracle.com/solaris/release/versions/0/'.
> >==========
> >
> >
> >So does 'pkg' command have any options to verify whether the configured publishers are reachable or not,
> >or something other issues which would cause 'pkg install' fail?
>
> No, because it could become unreachable at any point during the
> operation, so checking ahead of time would be pointless.
>
> >We just want to check it in advanced, and ask user to correct the publisher configuration before our utility run 'pkg install' truly.
>
> The right way to handle this is to perform the install, check the
> exit code, and if it isn't zero, assume failure of the operation.

Note that non-zero can mean "nothing to do". See the EXIT STATUS
section in pkg(1).

--
Mike Gerdts
Solaris Core OS / Zones http://blogs.oracle.com/zoneszone/

Steve Sundstrom

unread,
Mar 14, 2012, 2:22:08 PM3/14/12
to Shawn Walker, Ervin Yan, Venkatesha M.G., pkg-d...@opensolaris.org
Checking before the operation would allow any script to verify whether the publisher was reachable and exit gracefully with a "Network is unreachable" message. This is a very realistic scenario.

Otherwise we get "Installing", "Failed", (figure it out) "Network is Unreachable" and a much more unpleasant user experience. Our methodology is to do all possible to guarantee that an action will succeed before we attempt it. It's the same as checking whether a packages dependencies are there instead of installing it to find out what is missing.

--Steve

David Sechrest

unread,
Mar 14, 2012, 2:34:06 PM3/14/12
to Steve Sundstrom, Ervin Yan, Venkatesha M.G., pkg-d...@opensolaris.org

On Mar 14, 2012, at 11:22 AM, Steve Sundstrom wrote:

> Checking before the operation would allow any script to verify whether the publisher was reachable and exit gracefully with a "Network is unreachable" message. This is a very realistic scenario.

Yes, we have need for this as well, especially for non-interactive/remote/distributed installs, and have been using
'pkg refresh <pub>' for this for lack of a more specific test.

thanks
Dave

---
David Sechrest Phone: (408)276-5800 x15800
Systems Management Email: david.s...@oracle.com
Oracle Corporation

Shawn Walker

unread,
Mar 14, 2012, 2:38:29 PM3/14/12
to Steve Sundstrom, Ervin Yan, Venkatesha M.G., pkg-d...@opensolaris.org
On 03/14/12 11:22, Steve Sundstrom wrote:
> Checking before the operation would allow any script to verify
> whether the publisher was reachable and exit gracefully with a
> "Network is unreachable" message. This is a very realistic
> scenario.

Yes, however, network operations can fail for a variety of reasons and
at any time so attempting to determine if failure will happen before the
operation is executed is not the correct solution.

The packaging system already provides appropriate error messaging for
the failure cases. If that failure messaging is inadequate or needs
improvement, please feel free to file a request for enhancement through
the appropriate support channel.

> Otherwise we get "Installing", "Failed", (figure it out) "Network is
> Unreachable" and a much more unpleasant user experience. Our
> methodology is to do all possible to guarantee that an action will
> succeed before we attempt it. It's the same as checking whether a
> packages dependencies are there instead of installing it to find out
> what is missing.

So what happens when you check that the network is reachable before you
execute the operation, and then a network failure happens later during
the operation? You've just moved the point of failure without actually
improving the user experience.

As I said above, the packaging system already provides the appropriate
error messaging and handling for this scenario. If you feel that it
needs improvement, please provide specific feedback as to how.

Thanks,

Steve Sundstrom

unread,
Mar 14, 2012, 4:47:12 PM3/14/12
to Shawn Walker, Ervin Yan, Venkatesha M.G., pkg-d...@opensolaris.org
> So what happens when you check that the network is reachable before you
> execute the operation, and then a network failure happens later during
> the operation? You've just moved the point of failure without actually
> improving the user experience.

I agree that is a possible scenario, but as far as network intermittency is concerned, probably in the 0.01% range of occurrence, if not less. The other 99.99% of the time we would discover the problem before firing a doomed install request at a dead or unreachable address. In the case you describe, we would figure out that the network *became* unreachable checking the error as you suggest.

Steve

-----Original Message-----
From: Shawn Walker [mailto:shawn....@oracle.com]
Sent: Wednesday, March 14, 2012 11:38 AM
To: Steve Sundstrom
Cc: Ervin Yan; pkg-d...@opensolaris.org; Venkatesha M.G.
Subject: Re: [pkg-discuss] How to validate whether a publisher is reachable or not

joha...@opensolaris.org

unread,
Mar 15, 2012, 7:47:59 PM3/15/12
to Steve Sundstrom, Ervin Yan, Venkatesha M.G., pkg-d...@opensolaris.org
On Wed, Mar 14, 2012 at 01:47:12PM -0700, Steve Sundstrom wrote:
> > So what happens when you check that the network is reachable before you
> > execute the operation, and then a network failure happens later during
> > the operation? You've just moved the point of failure without actually
> > improving the user experience.
>
> I agree that is a possible scenario, but as far as network
> intermittency is concerned, probably in the 0.01% range of occurrence,
> if not less. The other 99.99% of the time we would discover the
> problem before firing a doomed install request at a dead or
> unreachable address. In the case you describe, we would figure out
> that the network *became* unreachable checking the error as you
> suggest.

I don't understand your use case. If the publisher is unreachable, pkg
already exits gracefully with a "Network Unreachable" message. What
problem are you actually trying to solve? More than that, I'm not
convinced that a network unreachable error implies publisher
misconfiguration. More likely than not, you have a routing problem that
needs to be fixed.

-j

Reply all
Reply to author
Forward
0 new messages