def _get_fas(url=rfpkgdb2client.FAS_URL, insecure=False): ''' Return a bugzilla object. ''' global FASCLIENT if not FASCLIENT or FASCLIENT.base_url != url: FASCLIENT = AccountSystem(url, username=USERNAME) FASCLIENT.insecure = insecure return FASCLIENT
def _get_fas(url=pkgdb2client.FAS_URL, insecure=False): ''' Return a bugzilla object. ''' global FASCLIENT if not FASCLIENT or FASCLIENT.base_url != url: FASCLIENT = AccountSystem( url, username=USERNAME) FASCLIENT.insecure = insecure return FASCLIENT
print('Adding the following keys:') print(to_add) for key in to_add: add_key(openshift_host, openshift_user, openshift_pass, '%(prefix)s%(username)s' % {'prefix': prefix, 'username': key['username']}, key['type'], key['contents'], verbose=verbose) if verbose: print('Done') if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('-config_file', help='The configuration file to use', default='/etc/sync-openshift-keys.conf') parser.add_argument('--verbose', '-v', help='Make the script more verbose', action='store_true') args = parser.parse_args() config = ConfigParser.ConfigParser() config.read(args.config_file) fas = AccountSystem(config.get('fas', 'url'), username=config.get('fas', 'user'), password=config.get('fas', 'pass')) fas.insecure = True if args.verbose: print('Getting users...') users = get_users_to_have_access(fas, string.split(config.get('general', 'groups'), ',')) if args.verbose: print('Done: %s' % users) print('Getting keys in FAS...') keys_fas = get_users_ssh_keys(fas, users) if args.verbose: print('Done: %s') print('Getting keys in Openshift...') keys_openshift = get_keys(config.get('openshift', 'host'), config.get('openshift', 'user'), config.get('openshift', 'pass')) if args.verbose: print('Done') print('Getting keys to remove...') keys_to_remove = get_keys_to_remove(keys_openshift, keys_fas)