Skip to content

Commit

Permalink
write_live_config: Fail correctly if there is an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
rram authored and bsimpson63 committed Feb 19, 2013
1 parent a9b5d2a commit 4aec961
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/write_live_config
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import ConfigParser

import kazoo.client
from kazoo.security import make_acl, make_digest_acl
from kazoo.exceptions import NoAuthException

from r2.lib.zookeeper import connect_to_zookeeper
from r2.lib.app_globals import extract_live_config, LIVE_CONFIG_NODE
Expand Down Expand Up @@ -121,9 +122,16 @@ def main():

password = getpass.getpass("Password: ")

write_config_to_zookeeper(LIVE_CONFIG_NODE,
USERNAME, password,
config, live)
try:
write_config_to_zookeeper(LIVE_CONFIG_NODE,
USERNAME, password,
config, live)
except NoAuthException:
print >> sys.stderr, "%s: incorrect password" % progname
return 1
except Exception as e:
print >> sys.stderr, "%s: %s" % (progname, e)
return 1

print "Succesfully updated live config!"

Expand Down

0 comments on commit 4aec961

Please sign in to comment.