Ability to run cmd scripts directly.

Add a conditional check to call main() in cmd scripts if they're
being invoked directly. Some already had them, but most simply
relied on the entrypoints wrappers declared in setup.py. With this
change, users can more easily test and debug the various command
scripts directly without needing setup magic.

Change-Id: I16c26e954687de8af5f971936fb8eee2072c06bc
Reviewed-on: https://review.openstack.org/26966
Reviewed-by: Paul Belanger <paul.belanger@polybeacon.com>
Reviewed-by: Khai Do <zaro0508@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Jeremy Stanley
2013-04-15 20:18:16 +00:00
committed by Jenkins
parent c8cc7a5091
commit 06efb06f84
8 changed files with 24 additions and 0 deletions

View File

@@ -100,3 +100,6 @@ def main():
completed=True)
issue.create_comment(MESSAGE % vars)
req.edit(state="closed")
if __name__ == "__main__":
main()

View File

@@ -102,3 +102,6 @@ def main():
break
logger.info('End expire review')
if __name__ == "__main__":
main()

View File

@@ -77,3 +77,6 @@ def main():
run_command("git remote add -f upstream %s" % remote_url)
# Fetch new revs from it
run_command("git remote update upstream")
if __name__ == "__main__":
main()

View File

@@ -390,3 +390,6 @@ project=%s
run_command("rm -fr %s" % tmpdir)
finally:
os.unlink(ssh_env['GIT_SSH'])
if __name__ == "__main__":
main()

View File

@@ -89,3 +89,6 @@ def main():
# Process impacts found in git log
if impacted(git_log, args.impact):
process_impact(git_log, args)
if __name__ == "__main__":
main()

View File

@@ -278,3 +278,6 @@ def main():
approve_category, score, options.commit]
SuExec(options, approval["account_id"], ' '.join(gerrit_approve_cmd))
sys.exit(0)
if __name__ == "__main__":
main()

View File

@@ -140,3 +140,6 @@ def main():
conn = MySQLdb.connect(user=DB_USER, passwd=DB_PASS, db=DB_DB)
find_specs(launchpad, conn, args)
if __name__ == "__main__":
main()

View File

@@ -274,3 +274,6 @@ def main():
# Process bugtasks found in git log
for bugtask in find_bugs(launchpad, git_log, args):
process_bugtask(launchpad, bugtask, git_log, args)
if __name__ == "__main__":
main()