On 03/26/10 07:35 AM, William Schumann wrote:
Shawn,
On 03/23/10 06:04 PM, Shawn Walker wrote:
On 03/23/10 11:50 AM, William Schumann wrote:
I have been experimenting with the pkg.client.api API to get the
expected disk usage for the installer, given a set of packages. There
are no examples in the documentation, which is in "pydoc
pkg.client.api", but I came up with this (some code removed):
api_inst = api.ImageInterface(img_dir, CLIENT_API_VERSION,
progresstracker, None, PKG_CLIENT_NAME)
api.image_create(PKG_CLIENT_NAME, CLIENT_API_VERSION, img_dir,
IMG_TYPE_ENTIRE, False,
repo_uri="http://ipkg.sfbay/dev",
progtrack=progress.QuietProgressTracker(), mirrors = mirrors,
force=True)
image_create() returns an ImageInterface object for the image that was
created, so there's no reason for the first assignment line.
The first line you have would only be used if the image already
existed, and the image_create() only if the image did not already exist.
Well, if I omit the ImageInterface call, this assertion results:
Traceback (most recent call last):
...
assert self.client_name is not None
AssertionError
[I've already responded to the poster off-line in detail, but for those
curious]
That's because pkg.client.global_settings.client_name must be set first
before using pkg.client.api. That's an oversight in the documentation.
I've filed this bug for that:
15373 pydoc pkg.client.api should include setup example and client
requirements
Cheers,
--
Shawn Walker
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss