7072842 update install gate for pkg5 API version bump to 66
authorDrew Fisher <drew.fisher@oracle.com>
Tue, 09 Aug 2011 14:34:48 -0600
changeset 1380 2f3830b79568
parent 1379 c41058d1a083
child 1381 6a009cae3466
7072842 update install gate for pkg5 API version bump to 66 7076306 slim source needs a common import for pkg5 API number
usr/src/cmd/installadm/image.py
usr/src/cmd/js2ai/modules/conv.py
usr/src/lib/install_common/__init__.py
usr/src/lib/install_ict/__init__.py
usr/src/lib/install_ict/cleanup_cpio_install.py
usr/src/lib/install_transfer/ips.py
--- a/usr/src/cmd/installadm/image.py	Tue Aug 09 11:37:55 2011 -0400
+++ b/usr/src/cmd/installadm/image.py	Tue Aug 09 14:34:48 2011 -0600
@@ -58,7 +58,7 @@
 import osol_install.auto_install.installadm_common as com
 
 from osol_install.auto_install.installadm_common import _, cli_wrap as cw
-from solaris_install import Popen 
+from solaris_install import Popen, PKG5_API_VERSION
 
 
 _FILE = '/usr/bin/file'
@@ -192,7 +192,6 @@
     '''Handles creation of a pkg(5)-based InstalladmImage'''
 
     _PKG_CLIENT_NAME = "installadm"
-    PKG_API_VERSION = 62
     DEFAULT_PKG_NAME = 'install-image/solaris-auto-install'
     ARCH_VARIANT = u'variant.arch'
     SVC_NAME_ATTR = 'com.oracle.install.service_name'
@@ -207,7 +206,7 @@
         logging.debug("image_create, install from=%s", fmri_or_p5i)
         tracker = pkg.client.progress.CommandLineProgressTracker()
         root_img = pkg.client.api.ImageInterface(
-            "/", cls.PKG_API_VERSION, tracker, None, cls._PKG_CLIENT_NAME)
+            "/", PKG5_API_VERSION, tracker, None, cls._PKG_CLIENT_NAME)
         
         # In the future, handle:
         #    * SSL repos (keys/certs may need explicit flags from user)
@@ -237,7 +236,7 @@
         
         pkgimg = pkg.client.api.image_create(
                         cls._PKG_CLIENT_NAME,
-                        cls.PKG_API_VERSION,
+                        PKG5_API_VERSION,
                         targetdir,
                         pkg.client.imagetypes.IMG_USER,
                         is_zone=False,
@@ -271,7 +270,7 @@
             cancel_state_callable = None
             self._pkgimg = pkg.client.api.ImageInterface( 
                                 self.path,
-                                self.PKG_API_VERSION,
+                                PKG5_API_VERSION,
                                 tracker,
                                 cancel_state_callable,
                                 self._PKG_CLIENT_NAME)
@@ -317,12 +316,11 @@
         try:
             pkg_list = self.pkg_image.get_pkg_list(
                 pkg.client.api.ImageInterface.LIST_INSTALLED,
-                raise_unmatched=True, return_fmris=True,
-                variants=True)
+                raise_unmatched=True, return_fmris=True)
 
-            for pfmri, summ, cats, states in pkg_list:
-                manifest = self.pkg_image.get_manifest(pfmri, all_variants=True)
-                for action in manifest.gen_actions(self.pkg_image.excludes):
+            for pfmri, summ, cats, states, attrs in pkg_list:
+                manifest = self.pkg_image.get_manifest(pfmri)
+                for action in manifest.gen_actions_by_type("set"):
                     for attrval in action.attrlist("name"):
                         if attrval == self.SVC_NAME_ATTR:
                             basename = action.attrs["value"].strip()
--- a/usr/src/cmd/js2ai/modules/conv.py	Tue Aug 09 11:37:55 2011 -0400
+++ b/usr/src/cmd/js2ai/modules/conv.py	Tue Aug 09 14:34:48 2011 -0600
@@ -49,9 +49,8 @@
 from lxml import etree
 from StringIO import StringIO
 
-# This is defined here since we can't collect this information from the
-# pkg api. This is needed to make the calls into the pkg api.
-CLIENT_API_VERSION = 62
+from solaris_install import PKG5_API_VERSION
+
 
 # These validation patterns were taken directly from the jumpstart
 # check script
@@ -950,7 +949,7 @@
         """
         orig_pwd = os.getcwd()
         prog_tracker = progress.CommandLineProgressTracker()
-        api_inst = api.ImageInterface("/", CLIENT_API_VERSION,
+        api_inst = api.ImageInterface("/", PKG5_API_VERSION,
                                       prog_tracker, False, "js2ai")
         pkg_query = ":legacy:legacy_pkg:" + package
         query = [api.Query(pkg_query, False, True)]
--- a/usr/src/lib/install_common/__init__.py	Tue Aug 09 11:37:55 2011 -0400
+++ b/usr/src/lib/install_common/__init__.py	Tue Aug 09 14:34:48 2011 -0600
@@ -63,6 +63,10 @@
 DC_LABEL = "DC specific"
 DC_PERS_LABEL = "DC specific persistent"
 
+# global version number for all of the consumers of the pkg5 API in the source
+# tree
+PKG5_API_VERSION = 66
+
 
 class CalledProcessError(subprocess.CalledProcessError):
     '''Expansion of subprocess.CalledProcessError that may optionally
--- a/usr/src/lib/install_ict/__init__.py	Tue Aug 09 11:37:55 2011 -0400
+++ b/usr/src/lib/install_ict/__init__.py	Tue Aug 09 14:34:48 2011 -0600
@@ -66,7 +66,6 @@
 VFSTAB = 'etc/vfstab'
 
 # Variables associated with the package image
-CLIENT_API_VERSION = 62
 DEF_REPO_URI = "http://pkg.oracle.com/solaris/release"
 PKG_CLIENT_NAME = "ICT"
 
--- a/usr/src/lib/install_ict/cleanup_cpio_install.py	Tue Aug 09 11:37:55 2011 -0400
+++ b/usr/src/lib/install_ict/cleanup_cpio_install.py	Tue Aug 09 14:34:48 2011 -0600
@@ -35,6 +35,7 @@
 
 from stat import S_IREAD, S_IRGRP, S_IROTH
 
+from solaris_install import PKG5_API_VERSION
 from solaris_install.data_object import ObjectNotFoundError
 from solaris_install.transfer.info import Args
 from solaris_install.transfer.info import CPIOSpec
@@ -205,7 +206,7 @@
         if not dry_run:
             try:
                 api_inst = api.ImageInterface(self.target_dir,
-                               ICT.CLIENT_API_VERSION,
+                               PKG5_API_VERSION,
                                progress.CommandLineProgressTracker(),
                                None,
                                ICT.PKG_CLIENT_NAME)
--- a/usr/src/lib/install_transfer/ips.py	Tue Aug 09 11:37:55 2011 -0400
+++ b/usr/src/lib/install_transfer/ips.py	Tue Aug 09 14:34:48 2011 -0600
@@ -42,8 +42,9 @@
 
 from pkg.client import global_settings
 from pkg.client.api import IMG_TYPE_ENTIRE, IMG_TYPE_PARTIAL
+from solaris_install import PKG5_API_VERSION
+from solaris_install.data_object import ObjectNotFoundError
 from solaris_install.engine.checkpoint import AbstractCheckpoint as Checkpoint
-from solaris_install.data_object import ObjectNotFoundError
 from solaris_install.engine import InstallEngine
 from solaris_install.transfer.info import Args
 from solaris_install.transfer.info import Destination
@@ -238,7 +239,6 @@
     __metaclass__ = abc.ABCMeta
 
     # Variables associated with the package image
-    CLIENT_API_VERSION = 62
     DEF_REPO_URI = "http://pkg.opensolaris.org/release"
     DEF_PROG_TRACKER = progress.CommandLineProgressTracker()
 
@@ -387,7 +387,7 @@
                         for pkg in trans_val.get(CONTENTS):
                             if "entire" in pkg:
                                 sysinst = api.ImageInterface(self.SYSTEM_IMAGE,
-                                                       self.CLIENT_API_VERSION,
+                                                       PKG5_API_VERSION,
                                                        self.prog_tracker,
                                                        False,
                                                        self.SYSTEM_CLIENT_NAME)
@@ -740,8 +740,7 @@
 
             try:
                 self.api_inst = api.ImageInterface(self.dst,
-                    self.CLIENT_API_VERSION, self.prog_tracker, None,
-                    PKG_CLIENT_NAME)
+                    PKG5_API_VERSION, self.prog_tracker, None, PKG_CLIENT_NAME)
             except api_errors.VersionException, ips_err:
                 raise ValueError("The IPS API version specified, "
                                        + str(ips_err.received_version) +
@@ -773,7 +772,7 @@
             try:
                 self.api_inst = api.image_create(
                     pkg_client_name=PKG_CLIENT_NAME,
-                    version_id=self.CLIENT_API_VERSION, root=self.dst,
+                    version_id=PKG5_API_VERSION, root=self.dst,
                     imgtype=self.completeness, is_zone=self.is_zone,
                     force=True, **self._image_args)
 
@@ -785,11 +784,11 @@
 
                 if self.is_zone:
                     # If installing a zone image, attach its image as a
-                    # linked image to the global zone.  
+                    # linked image to the global zone.
 
                     # Get an api object for the current global system image.
                     gz_api_inst = api.ImageInterface(self.SYSTEM_IMAGE,
-                        self.CLIENT_API_VERSION, self.prog_tracker, False,
+                        PKG5_API_VERSION, self.prog_tracker, False,
                         self.SYSTEM_CLIENT_NAME)
 
                     # For a zone's linked image name, we construct it as:
@@ -799,8 +798,8 @@
                     self.logger.debug("Linked image name: %s" % lin)
 
                     # Attach the zone image as a linked image.
-                    (ret, err) = gz_api_inst.attach_linked_child(lin, self.dst,
-                        force=True, li_md_only=True)
+                    (ret, err, _none) = gz_api_inst.attach_linked_child(lin,
+                        self.dst, force=True, li_md_only=True)
                     if err != None:
                         raise ValueError("Linked image error while attaching "
                                          "zone image '%s':\n%s" %
@@ -936,7 +935,7 @@
                 raise ValueError("The following components are specified "
                                  "twice in the manifest: %s" % str(overlap))
 
-            # Update the image args with the current image args being 
+            # Update the image args with the current image args being
             # processed.
             self.image_args.update(args.arg_dict)