zephyr_mirror: Add a --no-forward-from-humbug option.

We'll use this to only have one of our shards forward from Humbug.

(imported from commit a6f3c2180b49c1fa826baf1ae9e7e3ba252a5bfa)
This commit is contained in:
Tim Abbott 2012-11-27 10:25:49 -05:00
parent 975c8ef5b0
commit bfec56661e

View file

@ -177,7 +177,8 @@ def maybe_restart_mirroring_script():
logger.warning("")
logger.warning("zephyr mirroring script has been updated; restarting...")
try:
os.kill(child_pid, signal.SIGTERM)
if child_pid is not None:
os.kill(child_pid, signal.SIGTERM)
except OSError:
# We don't care if the child process no longer exists, so just print the error
logging.exception("")
@ -682,10 +683,11 @@ def parse_args():
help=optparse.SUPPRESS_HELP,
default=True,
action='store_false')
parser.add_option('--forward-from-humbug',
default=False,
parser.add_option('--no-forward-from-humbug',
default=True,
dest='forward_from_humbug',
help=optparse.SUPPRESS_HELP,
action='store_true')
action='store_false')
parser.add_option('--verbose',
default=False,
help=optparse.SUPPRESS_HELP,
@ -777,13 +779,16 @@ or specify the --api-key-file option.""" % (options.api_key_file,)))
# We don't care if the child process no longer exists, so just print the error
traceback.print_exc()
child_pid = os.fork()
if child_pid == 0:
# Run the humbug => zephyr mirror in the child
logger = configure_logger("humbug=>zephyr")
zsig_fullname = fetch_fullname(options.user)
humbug_to_zephyr(options)
sys.exit(0)
if options.forward_from_humbug:
child_pid = os.fork()
if child_pid == 0:
# Run the humbug => zephyr mirror in the child
logger = configure_logger("humbug=>zephyr")
zsig_fullname = fetch_fullname(options.user)
humbug_to_zephyr(options)
sys.exit(0)
else:
child_pid = None
import zephyr
while True: