Package pulp :: Package client :: Module auth_utils
[hide private]
[frames] | no frames]

Source Code for Module pulp.client.auth_utils

 1  #!/usr/bin/python 
 2  # 
 3  # Pulp Repo management module 
 4  # 
 5  # Copyright (c) 2010 Red Hat, Inc. 
 6  # 
 7  # This software is licensed to you under the GNU General Public License, 
 8  # version 2 (GPLv2). There is NO WARRANTY for this software, express or 
 9  # implied, including the implied warranties of MERCHANTABILITY or FITNESS 
10  # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 
11  # along with this software; if not, see 
12  # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 
13  # 
14  # Red Hat trademarks are not licensed under GPLv2. No permission is 
15  # granted to use or replicate Red Hat trademarks that are incorporated 
16  # in this software or its documentation. 
17   
18  import os 
19   
20   
21  PULP_DIR = '.pulp' 
22  CERT_FILENAME = 'admin-cert.pem' 
23  KEY_FILENAME = 'admin-key.pem' 
24   
25   
26 -def admin_cert_dir():
27 ''' 28 Returns the directory in which admin certificates will be stored, customized 29 for the user executing the client. 30 31 @return: path to the admin certificate directory 32 @rtype: string 33 ''' 34 35 return os.path.join(os.environ['HOME'], PULP_DIR)
36
37 -def admin_cert_paths():
38 ''' 39 Returns the current user's specific location to admin certificates. 40 41 @return: tuple of the full path to the certificate and full path to the private key 42 @rtype: (string, string) 43 ''' 44 45 dest_dir = admin_cert_dir() 46 cert_filename = os.path.join(dest_dir, CERT_FILENAME) 47 key_filename = os.path.join(dest_dir, KEY_FILENAME) 48 49 return cert_filename, key_filename
50