src/modules/actions/driver.py
branchs11u3-sru
changeset 3432 489e5c945d1d
parent 2683 920b995f89b0
equal deleted inserted replaced
3431:986e4ec518b8 3432:489e5c945d1d
    19 #
    19 #
    20 # CDDL HEADER END
    20 # CDDL HEADER END
    21 #
    21 #
    22 
    22 
    23 #
    23 #
    24 # Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
    24 # Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
    25 #
    25 #
    26 
    26 
    27 """module describing a driver packaging object.
    27 """module describing a driver packaging object.
    28 
    28 
    29 This module contains the DriverAction class, which represents a driver-type
    29 This module contains the DriverAction class, which represents a driver-type
   571                 # Also, when removing a policy, there is no way to convince
   571                 # Also, when removing a policy, there is no way to convince
   572                 # update_drv to remove it unless there's a minor node associated
   572                 # update_drv to remove it unless there's a minor node associated
   573                 # with it.
   573                 # with it.
   574                 for i in rem_policy:
   574                 for i in rem_policy:
   575                         spec = i.split()
   575                         spec = i.split()
       
   576                         if not spec:
       
   577                                 continue
       
   578 
   576                         # Test if there is a minor node and if so use it
   579                         # Test if there is a minor node and if so use it
   577                         # for the policy removal. Otherwise, if none is
   580                         # for the policy removal. Otherwise, if none is
   578                         # supplied, then use the wild card to match.
   581                         # supplied, then use the wild card to match.
   579                         if len(spec) == 3:
   582                         if "=" not in spec[0]:
   580                                 minornode = spec[0]
   583                                 minornode = spec[0]
   581                         elif len(spec) == 2:
   584                         else:
   582                                 # This can happen when the policy is defined
       
   583                                 # in the package manifest without an associated
       
   584                                 # minor node.
       
   585                                 minornode = "*"
   585                                 minornode = "*"
   586                         else:
       
   587                                 print "driver (%s) update (removal of " \
       
   588                                     "policy '%s') failed: invalid policy " \
       
   589                                     "spec." % (self.attrs["name"], i)
       
   590                                 continue
       
   591 
   586 
   592                         args = rem_base + ("-p", minornode, self.attrs["name"])
   587                         args = rem_base + ("-p", minornode, self.attrs["name"])
   593                         self.__call(args, "driver (%(name)s) upgrade (removal "
   588                         self.__call(args, "driver (%(name)s) upgrade (removal "
   594                             "of policy '%(policy)s')",
   589                             "of policy '%(policy)s')",
   595                             {"name": self.attrs["name"], "policy": i})
   590                             {"name": self.attrs["name"], "policy": i})