Skip to content

Commit

Permalink
Fix adding default users.
Browse files Browse the repository at this point in the history
  • Loading branch information
yqiang committed May 27, 2008
1 parent e304893 commit 1b85be8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sage/dsage/scripts/dsage_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ def add_default_client(Session):
username = getuser()
pubkey_file = os.path.join(DSAGE_DIR, 'dsage_key.pub')
pubkey = keys.Key.fromFile(pubkey_file)
pubkey_str = pubkey.toString(type='openssh')
if clientdb.get_client(username) is None:
clientdb.add_client(username, pubkey.toString(type='openssh'))
clientdb.add_client(username, pubkey_str)
print 'Added user %s.\n' % (username)
else:
client = clientdb.get_client(username)
if client.public_key != pubkey:
if client.public_key != pubkey_str:
clientdb.del_client(username)
clientdb.add_client(username, pubkey)
clientdb.add_client(username, pubkey_str)
print "User %s's pubkey changed, setting to new one." % (username)
else:
print 'User %s already exists.' % (username)
Expand Down

0 comments on commit 1b85be8

Please sign in to comment.