'Wait for the CloudStack service endpoint to accept connections.'

def _wait_for_service(self):

    if self.args.explain:
        return
    client = HttpClient(self.args, always=True)
    endpoint = self.endpoint
    for _ in range(1, 30):
        display.info(('Waiting    for    CloudStack    service:    %s' % endpoint), verbosity=1)
        try:
            client.get(endpoint)
            return
        except SubprocessError:
            pass
        time.sleep(30)
    raise ApplicationError('Timeout    waiting    for    CloudStack    service.')
