# Path: gocdapi/custom_exceptions.py
# class GoCdApiException(Exception):
#     """
#     Base class for all errors
#     """
#     pass
# 
# Path: gocdapi/go.py
# class Go(object):
#     """
#     Class that represents Go Server environment.
#     """
#     def __init__(self, baseurl, username=None, password=None):
#         """Inits Go objects.
# 
#         Args:
#             baseurl (str): The base url of Go Server
#             username (str): The username to login in the Go Server
#             password (str): The username's password
#         """
#         self.baseurl = baseurl
#         self.username = username
#         self.password = password
# 
#     @property
#     def agents(self):
#         """Return agents of the Go Server
#         """
#         return Agents(self)
# 
#     @property
#     def pipeline_groups(self):
#         """Return Pipeline Groups of the Go Server
#         """
#         return PipelineGroups(self)
# 
#     @property
#     def pipelines(self):
#         """Return Pipeline Groups of the Go Server
#         """
#         return dict(self._iter_through_pipelines())
# 
#     @property
#     def admin(self):
#         """Return an Admin object
#         """
#         return Admin(self)
# 
#     def pipeline_exist(self, name):
#         """ Check if pipeline exists.
# 
#         Args:
#             name (str): name of the pipeline to find
# 
#         Returns:
#             bool: True if pipeline with the given name exists
#         """
#         return name in self.pipelines
# 
#     def get_pipeline(self, name):
#         """ Return pipeline if exists.
# 
#         Args:
#             name (str): name of the pipeline to get
# 
#         Returns:
#             pipeline: Pipeline with the given name or None if it doesn't exist.
#         """
#         return self.pipelines.get(name, None)
# 
#     def _iter_through_pipelines(self):
#         """ Return a iterable containing every pair pipeline_name, pipeline
# 
#         Generator: Yields a pair pipeline_name, pipeline
#         """
#         for pipeline_group in self.pipeline_groups.values():
#             for pipeline_name, pipeline in pipeline_group.iteritems():
#                 yield pipeline_name, pipeline


import Queue
import datetime
import logging
import os
import subprocess
import sys
import threading
import time
import urllib
import zipfile
from gocdapi.custom_exceptions import GoCdApiException
from gocdapi.go import Go


logging.basicConfig()
log = logging.getLogger(__name__)


GO_VERSION = "14.3.0-1186"


def dlProgress(count, blockSize, totalSize):
    percentage = (blockSize * count * 100) / totalSize
    sys.stdout.write("\r%s%%" % percentage)


def get_default_configuration():
    systests_dir, _ = os.path.split(__file__)
    return "%s/%s" % (systests_dir, "cruise-config.xml")



# Path: gocdapi/custom_exceptions.py
# class GoCdApiException(Exception):
#     """
#     Base class for all errors
#     """
#     pass
# 
# Path: gocdapi/go.py
# class Go(object):
#     """
#     Class that represents Go Server environment.
#     """
#     def __init__(self, baseurl, username=None, password=None):
#         """Inits Go objects.
# 
#         Args:
#             baseurl (str): The base url of Go Server
#             username (str): The username to login in the Go Server
#             password (str): The username's password
#         """
#         self.baseurl = baseurl
#         self.username = username
#         self.password = password
# 
#     @property
#     def agents(self):
#         """Return agents of the Go Server
#         """
#         return Agents(self)
# 
#     @property
#     def pipeline_groups(self):
#         """Return Pipeline Groups of the Go Server
#         """
#         return PipelineGroups(self)
# 
#     @property
#     def pipelines(self):
#         """Return Pipeline Groups of the Go Server
#         """
#         return dict(self._iter_through_pipelines())
# 
#     @property
#     def admin(self):
#         """Return an Admin object
#         """
#         return Admin(self)
# 
#     def pipeline_exist(self, name):
#         """ Check if pipeline exists.
# 
#         Args:
#             name (str): name of the pipeline to find
# 
#         Returns:
#             bool: True if pipeline with the given name exists
#         """
#         return name in self.pipelines
# 
#     def get_pipeline(self, name):
#         """ Return pipeline if exists.
# 
#         Args:
#             name (str): name of the pipeline to get
# 
#         Returns:
#             pipeline: Pipeline with the given name or None if it doesn't exist.
#         """
#         return self.pipelines.get(name, None)
# 
#     def _iter_through_pipelines(self):
#         """ Return a iterable containing every pair pipeline_name, pipeline
# 
#         Generator: Yields a pair pipeline_name, pipeline
#         """
#         for pipeline_group in self.pipeline_groups.values():
#             for pipeline_name, pipeline in pipeline_group.iteritems():
#                 yield pipeline_name, pipeline


# Path: gocdapi_utils/go_launcher.py
import Queue
import datetime
import logging
import os
import subprocess
import sys
import threading
import time
import urllib
import zipfile
from gocdapi.custom_exceptions import GoCdApiException
from gocdapi.go import Go



logging.basicConfig()
log = logging.getLogger(__name__)


GO_VERSION = "14.3.0-1186"


def dlProgress(count, blockSize, totalSize):
    percentage = (blockSize * count * 100) / totalSize
    sys.stdout.write("\r%s%%" % percentage)


def get_default_configuration():
    systests_dir, _ = os.path.split(__file__)
    return "%s/%s" % (systests_dir, "cruise-config.xml")



class StreamThread(threading.Thread):