Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update gitosis-admin repository BEFORE writing key in file

  • Loading branch information...
commit 1540808834cead7fade6ef8e5c978ccc324aba99 1 parent 41befa9
@dr4Ke authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 0.11/tracgitosis/tracgitosis.py
View
12 0.11/tracgitosis/tracgitosis.py
@@ -115,16 +115,18 @@ def setsshkey(self, req, username, key):
status = 1
message = 'malformed key (must begin with \'ssh-rsa \' followed by a BASE64 encoded chain)'
if status == 0:
- relkeyfile = 'keydir/'+username+'.pub'
- keyfile = self.env.path+'/'+self.admrepo+'/'+relkeyfile
- f = open(keyfile, 'w')
- f.write(key+'\n')
- f.close()
+ # Update gitosis-admin repository
tracname = self.config.get('project', 'name')
self.log.debug('update admin repository')
result, message = gitpull(self.env.path+'/'+self.admrepo)
if result != 0:
add_warning('Admin repository update failed. Message: '+message)
+ # Save key in the file
+ relkeyfile = 'keydir/'+username+'.pub'
+ keyfile = self.env.path+'/'+self.admrepo+'/'+relkeyfile
+ f = open(keyfile, 'w')
+ f.write(key+'\n')
+ f.close()
self.log.debug('set ' + username + ' public key')
status, message = gitcommit(self.env.path+'/'+self.admrepo, relkeyfile, tracname)
if status == 0:
Please sign in to comment.
Something went wrong with that request. Please try again.