Bart Smaalders wrote:

> Should you enhance the actuator str() method, or is this an internal
> impl. detail?

Yeah, hm.  It's a bit of a pain in the ass to get it to print out sanely,
and because the only place the actuators are printed out is with an
"install -v" right after plan creation, it's not in the actuator list at
that point.

However, it does blow up if you try to print the list, so I'm fixing that,
and here's a simple attempt at "sanity":

    --- a/src/modules/actions/driver.py
    +++ b/src/modules/actions/driver.py
    @@ -233,7 +233,7 @@ from %(imgroot)s/etc/driver_aliases." % 
                     if image.is_liveroot():
                             args = ( self.add_drv, "-u" )
                             
image.imageplan.actuators.install["activate-drivers"] = \
    -                                self.__activate_drivers
    +                                [ self.__activate_drivers ]
                     else:
                             args = ( self.add_drv, "-n", "-b", 
image.get_root() )
     
    diff --git a/src/modules/client/actuator.py b/src/modules/client/actuator.py
    --- a/src/modules/client/actuator.py
    +++ b/src/modules/client/actuator.py
    @@ -115,8 +115,14 @@ class Actuator(GenericActuator):
                     self.cmd_path = ""
     
             def __str__(self):
    +                def str_smf(smf):
    +                        if isinstance(smf, basestring):
    +                                return smf
    +                        else:
    +                                return "true"
    +
                     return "\n".join([
    -                    "  %16s: %s" % (fmri, smf)
    +                    "  %16s: %s" % (fmri, str_smf(smf))
                         for d in [self.removal, self.update, self.install]
                         for fmri in d
                         for smf in d[fmri]
    @@ -240,7 +246,7 @@ class Actuator(GenericActuator):
                             self.__call(args + params)
     
                     if "activate-drivers" in self.install:
    -                        self.install["activate-drivers"]()
    +                        self.install["activate-drivers"][0]()
     
             def __smf_svc_get_state(self, fmri):
                     """ return state of smf service """


Without the change to __str__(), you get

      activate-drivers: <bound method type.__activate_drivers of <class 
'pkg.actions.driver.DriverAction'>>

which is ugly, though I could simply stick an "if isinstance(smf, basestr)"
into the list comprehension so that it's skipped entirely.

Other suggestions are welcome.

Thanks,
Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to