diff options
author | Rob Austein <sra@hactrn.net> | 2009-06-04 19:47:44 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-06-04 19:47:44 +0000 |
commit | 301b7871a1875cc22eb821cac43b1666dfef8269 (patch) | |
tree | bb9ea80e013f311cf0ebc92a1f7318e8725c9a78 | |
parent | dd2273377096e100a97e001af3327b0911ef6e7c (diff) |
Update for _id -> _handle transition. Turns out irbe_cli didn't need
any changes, so this was the only current tool that needed fixing.
svn path=/rpkid/extract-key.py; revision=2495
-rw-r--r-- | rpkid/extract-key.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/rpkid/extract-key.py b/rpkid/extract-key.py index 74db1c02..0944b3ce 100644 --- a/rpkid/extract-key.py +++ b/rpkid/extract-key.py @@ -9,14 +9,13 @@ that couldn't be done via the mysql command line tool. While we're at this we also extract the corresponding certificate. -Usage: python extract-key.py [ { -s | --self } self_id ] - [ { -b | --bsc } bsc_id ] +Usage: python extract-key.py [ { -s | --self } self_handle ] + [ { -b | --bsc } bsc_handle ] [ { -u | --user } mysql_user_id ] [ { -d | --db } mysql_database ] [ { -p | --password } mysql_password ] [ { -h | --help } ] -Default for both self_id and bsc_id is 1. Default for both user and db is "rpki". $Id$ @@ -46,8 +45,8 @@ def usage(code): print __doc__ sys.exit(code) -self_id = 1 -bsc_id = 1 +self_handle = None +bsc_handle = None user = "rpki" passwd = "fnord" @@ -59,9 +58,9 @@ for o, a in opts: if o in ("-h", "--help", "-?"): usage(0) elif o in ("-s", "--self"): - self_id = int(a) + self_handle = a elif o in ("-b", "--bsc"): - bsc_id = int(a) + bsc_handle = a elif o in ("-u", "--user"): user = a elif o in ("-p", "--password"): @@ -73,8 +72,13 @@ if argv: cur = MySQLdb.connect(user = user, db = db, passwd = passwd).cursor() -cur.execute("SELECT private_key_id, signing_cert FROM bsc WHERE self_id = %s AND bsc_id = %s", - (self_id, bsc_id)) +cur.execute( + """ + SELECT bsc.private_key_id, bsc.signing_cert + FROM bsc, self + WHERE self.self_handle = %s AND self.self_id = bsc.self_id AND bsc_handle = %s + """, + (self_handle, bsc_handle)) key, cer = cur.fetchone() |