{"action":"closed","issue":{"url":"https://api.github.com/repos/RedHatSatellite/katello-attach-subscription/issues/8","repository_url":"https://api.github.com/repos/RedHatSatellite/katello-attach-subscription","labels_url":"https://api.github.com/repos/RedHatSatellite/katello-attach-subscription/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/RedHatSatellite/katello-attach-subscription/issues/8/comments","events_url":"https://api.github.com/repos/RedHatSatellite/katello-attach-subscription/issues/8/events","html_url":"https://github.com/RedHatSatellite/katello-attach-subscription/issues/8","id":164858497,"number":8,"title":"Katello 3.0 compatibility","user":{"login":"Klaas-","id":3710192,"avatar_url":"https://avatars.githubusercontent.com/u/3710192?v=3","gravatar_id":"","url":"https://api.github.com/users/Klaas-","html_url":"https://github.com/Klaas-","followers_url":"https://api.github.com/users/Klaas-/followers","following_url":"https://api.github.com/users/Klaas-/following{/other_user}","gists_url":"https://api.github.com/users/Klaas-/gists{/gist_id}","starred_url":"https://api.github.com/users/Klaas-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Klaas-/subscriptions","organizations_url":"https://api.github.com/users/Klaas-/orgs","repos_url":"https://api.github.com/users/Klaas-/repos","events_url":"https://api.github.com/users/Klaas-/events{/privacy}","received_events_url":"https://api.github.com/users/Klaas-/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"evgeni","id":94284,"avatar_url":"https://avatars.githubusercontent.com/u/94284?v=3","gravatar_id":"","url":"https://api.github.com/users/evgeni","html_url":"https://github.com/evgeni","followers_url":"https://api.github.com/users/evgeni/followers","following_url":"https://api.github.com/users/evgeni/following{/other_user}","gists_url":"https://api.github.com/users/evgeni/gists{/gist_id}","starred_url":"https://api.github.com/users/evgeni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evgeni/subscriptions","organizations_url":"https://api.github.com/users/evgeni/orgs","repos_url":"https://api.github.com/users/evgeni/repos","events_url":"https://api.github.com/users/evgeni/events{/privacy}","received_events_url":"https://api.github.com/users/evgeni/received_events","type":"User","site_admin":false},"assignees":[{"login":"evgeni","id":94284,"avatar_url":"https://avatars.githubusercontent.com/u/94284?v=3","gravatar_id":"","url":"https://api.github.com/users/evgeni","html_url":"https://github.com/evgeni","followers_url":"https://api.github.com/users/evgeni/followers","following_url":"https://api.github.com/users/evgeni/following{/other_user}","gists_url":"https://api.github.com/users/evgeni/gists{/gist_id}","starred_url":"https://api.github.com/users/evgeni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evgeni/subscriptions","organizations_url":"https://api.github.com/users/evgeni/orgs","repos_url":"https://api.github.com/users/evgeni/repos","events_url":"https://api.github.com/users/evgeni/events{/privacy}","received_events_url":"https://api.github.com/users/evgeni/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-07-11T14:59:26Z","updated_at":"2016-07-13T08:26:59Z","closed_at":"2016-07-13T08:26:59Z","body":"Hi,\r\nit seems like Katello 3 changed the api, this breaks your tool.\r\n\r\nfor the people that need a quick fix a simple bash script that should do the job with curl & hammer:\r\n\r\n```\r\n#!/bin/bash\r\n## replace grep with something uniq to your hypervisors\r\nhost_ids=`hammer host list |grep esx | awk '{print $1}'`\r\n## replace with id of your subscription (see hammer subscription list --organization YOURORG)\r\nsubscription_id=10\r\nuser=admin\r\npassword=changeme\r\nurl=https://foreman.example.com\r\nfor host_id in ${host_ids}; do\r\n  curl -H \"Accept:application/json,version=2\" -H \"Content-Type:application/json\" -X PUT -u ${user}:${password} -k -d \"{\\\"id\\\":${host_id},\\\"subscriptions\\\":[{\\\"id\\\":${subscription_id},\\\"quantity\\\":1}],\\\"api_version\\\":\\\"v2\\\",\\\"host_id\\\":${host_id},\\\"host_subscription\\\":{\\\"id\\\":\\\"${host_id}\\\",\\\"subscriptions\\\":{\\\"id\\\":${subscription_id},\\\"quantity\\\":1}}}\" ${url}/api/v2/hosts/${host_id}/subscriptions/add_subscriptions\r\ndone\r\n```"}}
{"actor":{"display_login":"Klaas-"}}