def remove_all_auto_profiles(filePath):
"""
remove all profiles from the credentials file that contain 'auto-refresh-'
"""
log.info('Removing all autoAwsume profiles')
#remove the auto-awsume profiles from the credentials file
autoAwsumeProfileParser = ConfigParser.ConfigParser()
autoAwsumeProfileParser.read(filePath)
#scan all profiles to find auto-refresh profiles
for profile in autoAwsumeProfileParser._sections:
if 'auto-refresh-' in profile:
log.debug('Removing profile ' + profile + ' from credentials file')
autoAwsumeProfileParser.remove_section(profile)
#save changes
autoAwsumeProfileParser.write(open(filePath, 'w'))
评论列表
文章目录