Part of lp.soyuz.scripts.ftpmasterbase View In Hierarchy
Known subclasses: lp.soyuz.scripts.add_missing_builds.AddMissingBuilds, lp.soyuz.scripts.obsolete_distroseries.ObsoleteDistroseries, lp.soyuz.scripts.populate_archive.ArchivePopulator
LaunchpadScript
extended for Soyuz related use.
Possible exceptions raised are:
PackageLocationError
: specified package or distro does not exist
LaunchpadScriptError
: only raised if entering via main(), ie thiscode is running as a genuine script. In this case, this is also the _only_ exception to be raised.
The test harness doesn't enter via main(), it calls mainTask(), so it does not see LaunchpadScriptError.
Each script can extend:
usage
: string describing the expected command-line format;description
: string describing the tool;success_message
: string to be presented on successful runs;mainTask
: a method to actually perform a specific task.
See add_my_options
for the default SoyuzScript
command-line options.
Method | add_my_options | Adds SoyuzScript default options. |
Method | add_transaction_options | Add SoyuzScript transaction-related options. |
Method | add_distro_options | Add SoyuzScript distro-related options. |
Method | add_package_location_options | Add SoyuzScript package location-related options. |
Method | add_archive_options | Add SoyuzScript archive-related options. |
Method | waitForUserConfirmation | Blocks the script flow waiting for a user confirmation. |
Method | setupLocation | Setup PackageLocation for context distribution and suite. |
Method | finishProcedure | Script finalization procedure. |
Method | main | LaunchpadScript entry point. |
Method | mainTask | Main task to be performed by the script |
Method | _getUserConfirmation | Use raw_input to collect user feedback. |
Inherited from LaunchpadScript:
Method | __init__ | Construct new LaunchpadScript. |
Method | handle_options | Undocumented |
Method | name | Enable subclasses to override with command-line arguments. |
Method | dbuser | Enable subclasses to override with command-line arguments. |
Method | login | Super-convenience method that avoids the import. |
Method | lockfilename | Return lockfilename. |
Method | lockfilepath | Undocumented |
Method | setup_lock | Create lockfile. |
Method | lock_or_die | Attempt to lock, and sys.exit(1) if the lock's already taken. |
Method | unlock | Release the lock. Do this before going home. |
Method | run | Actually run the script, executing zcml and initZopeless. |
Method | record_activity | Hook to record script activity. |
Method | lock_and_run | Call lock_or_die(), and then run() the script. |
Method | _init_zca | Initialize the ZCA, this can be overridden for testing purposes. |
Method | _init_db | Initialize the database transaction. |
Any subclass may override this method and call the add_*_options individually to reduce the number of available options as necessary.
Return True if the user typed the first value of the given 'valid_answers' (defaults to 'yes') or False otherwise.
Return True immediately if options.confirm_all was passed or after getting a valid confirmation, False otherwise.
PackageLocation
for context distribution and suite.'dry-run' command-line option will case the transaction to be immediatelly aborted.
In normal mode it will ask for user confirmation (see
waitForUserConfirmation
) and will commit the transaction or abort
it according to the user answer.
Returns True if the transaction was committed, False otherwise.
Can only raise LaunchpadScriptFailure - other exceptions are absorbed into that.