Message3747

Author wesleys
Recipients fwierzbicki, wesleys, zyasoft
Date 2008-11-04.10:41:58
SpamBayes Score 1.692324e-10
Marked as misclassified No
Message-id <1225795321.01.0.486081753152.issue1109@psf.upfronthosting.co.za>
In-reply-to
Content
I saw the bug got closed because you haven't received an update from me.
These are the classes which are involved and how I can trigger the bug. 

baseclass.py:

#!/usr/bin/env bljython

import sys
import inspect

class baseclass:
    '''baseclass, abstract class'''

    def __init__(self, jli = None):
        '''Initialize the class'''
        self.debug = 0
        self.jli(jli)
        self.cmd_prefix = self.__module__.split('.')[-1]

    def jli(self, jli = None):
        """Set a jli component so we can call it"""
        if jli != None:
            self.jli = jli

        if self.debug:
            self.debug(self.debug)

        return self.jli

    def _cmd(self, *args):
        '''Executes the JLI command'''
        print "%s %s" % (self.cmd_prefix, " ".join(args));
#        return self.jli.cmd(self.cmd_prefix, *args)

    def debug(self, debug):
        '''Enable debuggin on the jli'''
        self.debug = debug
        if self.jli != None:
            self.jli['debug'] = debug

    def _log_error(self, msg):
        '''Log an error in case we need to log it..'''
        print msg
        sys.exit(4);

    def _unsupported(self):
        '''Function which tells the user the called function is not
        supported..'''
        print "Unsupported function '%s.%s()' called" % (self.cmd_prefix,
                inspect.stack()[1][3])

    def print_me(self):
        '''Function just here for testing.. to be removed'''
        print self.cmd_prefix
        print dir(self)

DepotSoftware.py:

#!/usr/bin/env bljython

import baseclass
import inspect

class DepotSoftware(baseclass.baseclass):
    '''The DepotSoftware name space contains commands to add software to
the Depot.
       The commands in this name space sometimes refer to software
packages. A
       software package is a BLPackage containing one or more software
items.
    '''

    def _add2(self, *args):
        calling = [ k.capitalize() for k in
inspect.stack()[1][3].split('_') ]
        return self._cmd("add" + "".join(calling) +
"ToDepotByGroupName", *args)

    def os_hotfix(self, *args):
        return self._add2(*args)

    def rpm(self, *args):
        return self._add2(*args)

    def service_pack(self, *args):
        return self._add2(*args)

    def solaris_package(self, *args):
        return self._add2(*args)

    def solaris_patch(self, *args):
        return self._add2(*args)

    def solaris_patch_cluster(self, *args):
        return self._add2(*args)

    def aix_package(self, *args):
        return self._add2(*args)

    def aix_patch(self, *args):
        return self._add2(*args)

    def custom_software(self, *args):
        return self._add2(*args)

    def hpux_bundle(self, *args):
        return self._add2(*args)

    def hpux_patch(self, *args):
        return self._add2(*args)

    def hpux_product(self, *args):
        return self._add2(*args)

    def install_shield_package(self, *args):
        return self._add2(*args)

    def msi_package(self, *args):
        return self._add2(*args)


In pylogic.py (testscript) I have the following functions, calling all
the public functions from the class:

def test_depot_software():

    k = DepotSoftware.DepotSoftware()
    k.jli(cli) # cli can be a anything, as long as it is set. You don't
have the Bladelogic cli class I assume :)

    k.aix_package()
    k.aix_patch()
    k.custom_software()
    k.hpux_bundle()
    k.hpux_patch()
    k.hpux_product()
    k.install_shield_package()
    k.msi_package()
    k.os_hotfix()
    k.rpm()
    k.service_pack()
    k.solaris_package()
    k.solaris_patch()
    k.solaris_patch_cluster()

When this code is run with Jython 2.5a1:
Traceback (most recent call last):
  File "./pylogic.py", line 160, in <module>
    test_depot_software()
  File "./pylogic.py", line 109, in test_depot_software
    k.aix_package()
  File "./../lib/OSS/bladelogic/DepotSoftware.py", line 35, in aix_package
    return self._add2(*args)
  File "./../lib/OSS/bladelogic/DepotSoftware.py", line 13, in _add2
    calling = [ k.capitalize() for k in inspect.stack()[1][3].split('_') ]
  File "/opt/bladelogic/jython.2.5a1/Lib/inspect.py", line 888, in stack
    return getouterframes(sys._getframe(1), context)
  File "/opt/bladelogic/jython.2.5a1/Lib/inspect.py", line 869, in
getouterframes
    framelist.append((frame,) + getframeinfo(frame, context))
  File "/opt/bladelogic/jython.2.5a1/Lib/inspect.py", line 844, in
getframeinfo
    lines, lnum = findsource(frame)
  File "/opt/bladelogic/jython.2.5a1/Lib/inspect.py", line 510, in
findsource
    if pat.match(lines[lnum]): break
IndexError: index out of range: 747

Jython 2.2.1:
DepotSoftware addAixPackageToDepotByGroupName
DepotSoftware addAixPatchToDepotByGroupName
DepotSoftware addCustomSoftwareToDepotByGroupName
DepotSoftware addHpuxBundleToDepotByGroupName
DepotSoftware addHpuxPatchToDepotByGroupName
DepotSoftware addHpuxProductToDepotByGroupName
DepotSoftware addInstallShieldPackageToDepotByGroupName
DepotSoftware addMsiPackageToDepotByGroupName
DepotSoftware addOsHotfixToDepotByGroupName
DepotSoftware addRpmToDepotByGroupName
DepotSoftware addServicePackToDepotByGroupName
DepotSoftware addSolarisPackageToDepotByGroupName
DepotSoftware addSolarisPatchToDepotByGroupName
DepotSoftware addSolarisPatchClusterToDepotByGroupName
History
Date User Action Args
2008-11-04 10:42:01wesleyssetmessageid: <1225795321.01.0.486081753152.issue1109@psf.upfronthosting.co.za>
2008-11-04 10:42:01wesleyssetrecipients: + wesleys, fwierzbicki, zyasoft
2008-11-04 10:42:00wesleyslinkissue1109 messages
2008-11-04 10:41:59wesleyscreate