Created
March 5, 2015 17:24
cleanup-org-invites-api knife exec script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OC-11643 | |
# OC-11644 | |
# You can use this script by running `knife exec` | |
# knife exec cleanup_orphaned_invites_via_api.rb -s https://CHEF_SERVER_URL/organizations/ORG_NAME | |
invites = api.get('association_requests') | |
orphaned_invites = invites.select { |invite| invite['username'].nil? } | |
orphaned_invites.each do |invite| | |
api.delete("association_requests/#{invite['id']}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment