contrib/automation/hgautomation/aws.py
changeset 42303 fcb97cb91ff8
parent 42302 730edbd836d8
child 42304 dd6a9723ae2b
equal deleted inserted replaced
42302:730edbd836d8 42303:fcb97cb91ff8
   503         if profile.name.startswith(prefix):
   503         if profile.name.startswith(prefix):
   504             delete_instance_profile(profile)
   504             delete_instance_profile(profile)
   505 
   505 
   506     for role in iamresource.roles.all():
   506     for role in iamresource.roles.all():
   507         if role.name.startswith(prefix):
   507         if role.name.startswith(prefix):
       
   508             for p in role.attached_policies.all():
       
   509                 print('detaching policy %s from %s' % (p.arn, role.name))
       
   510                 role.detach_policy(PolicyArn=p.arn)
       
   511 
   508             print('removing role %s' % role.name)
   512             print('removing role %s' % role.name)
   509             role.delete()
   513             role.delete()
   510 
   514 
   511 
   515 
   512 def wait_for_ip_addresses(instances):
   516 def wait_for_ip_addresses(instances):