def detach_role_policy(policy_name, role_name, region=None, key=None, keyid=None, profile=None):
 conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
 policy_arn = _get_policy_arn(policy_name, region, key, keyid, profile)
 try:
  conn.detach_role_policy(policy_arn, role_name)
  log.info('Detached {0} policy to role {1}.'.format(policy_name, role_name))
 except boto.exception.BotoServerError as e:
  log.debug(e)
  msg = 'Failed to detach {0} policy to role {1}.'
  log.error(msg.format(policy_name, role_name))
  return False
 return True

def detach_role_policy ( policy_name , role_name , region = None , key = None , keyid = None , profile = None ) : conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) policy_arn = _get_policy_arn ( policy_name , region , key , keyid , profile ) try : conn . detach_role_policy ( policy_arn , role_name ) log . info ( 'Detached {0} policy to role {1}.' . format ( policy_name , role_name ) ) except boto . exception . BotoServerError as e : log . debug ( e ) msg = 'Failed to detach {0} policy to role {1}.' log . error ( msg . format ( policy_name , role_name ) ) return False return True
detach a managed policy to a role .