Note: it is probably better to raise a ServiceRuntimeError in
Serviceinfo.execute instead of Package.commit because "execute"
has all the information about the failing service...
This is needed for backward compatibility. New plugins
(which do not care about "old" osc versions) should not
use "self.<imported modname>.<something>" anymore
to refer to the imported module. Instead use
"<imported modname>.<something>" (this will only work with
osc > 0.140.1).
This way other python scripts can execute osc commands via the
babysitter. Example:
>>> from osc import babysitter, commandline
>>> cli = commandline.Osc()
>>> babysitter.run(cli, ['osc', 'ls', '<project>'])
this is left-over from 87d354e1a0
Addressing:
Traceback (most recent call last):
File "/usr/bin/osc", line 26, in <module>
r = babysitter.run(osccli)
File "/usr/lib/python2.7/site-packages/osc/babysitter.py", line 60, in run
return prg.main()
File "/usr/lib/python2.7/site-packages/osc/cmdln.py", line 335, in main
self.postoptparse()
File "/usr/lib/python2.7/site-packages/osc/commandline.py", line 136, in postoptparse
override_verbose = self.options.verbose)
File "/usr/lib/python2.7/site-packages/osc/conf.py", line 873, in get_config
add_section(conffile, url, user, passwordx)
File "/usr/lib/python2.7/site-packages/osc/conf.py", line 712, in add_section
except OscConfigParser.ConfigParser.DuplicateSectionError:
AttributeError: class OscConfigParser has no attribute 'ConfigParser'
If http_debug is set we redirect sys.stdout to an StringIO
instance in order to do some header filtering (see conf module)
so we have to use the "original" stdout for printing the certificate
information.
Using the "old" exec approach isn't possible anymore because it'll break all
plugins which aren't compatible with python3 (for instance the usage of
python2's "print" statement will lead to an error). In order to circumvent
this problem we do the following:
- import the plugin/module
- update the module's global symbol table with the "globals()" of the
commandline module
- bind the module's "do_*" functions to the "Osc" class
This basically mimics the old "exec" semantics.
Two issues:
- There is no _find() member in ConfigLineOrder. Use _find_section()
instead
- Use 'key' instead of 'line' as argument for _find_section() since
'line' is used before assignment.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>