def run(self):
        try:

            #
            # - workaround to fetch the master IP and credentials as there does not seem to
            #   be a way to use 10.0.0.2 from within the pod
            #
            assert 'KUBERNETES_MASTER' in os.environ, '$KUBERNETES_MASTER not specified (check your portal pod)'
            assert 'KUBERNETES_USER' in os.environ, '$KUBERNETES_USER not specified (check your portal pod)'
            assert 'KUBERNETES_PWD' in os.environ, '$KUBERNETES_PWD not specified (check your portal pod)'

            auth = HTTPBasicAuth(os.environ['KUBERNETES_USER'], os.environ['KUBERNETES_PWD'])

            def _query(zk):
                replies = fire(zk, self.cluster, 'info')
                return len(replies), {key: hints for key, (_, hints, code) in replies.items() if code == 200}

            #
            # - each pod refers to its controller via the 'application' hint
            #
            total, js = run(self.proxy, _query)
            assert total == len(js), 'failure to communicate with one or more pods'
            for key in set([hints['application'] for hints in js.values()]):

                #
                # - HTTP DELETE the controller via the master API
                #
                url = 'https://%s/api/v1beta3/namespaces/default/replicationcontrollers/%s' % (os.environ['KUBERNETES_MASTER'], key)
                reply = requests.delete(url, auth=auth,verify=False)
                code = reply.status_code
                logger.debug('-> DELETE %s (HTTP %d)' % (url, code))
                assert code == 200 or code == 201, 'replication controller deletion failed (HTTP %d)' % code

            #
            # - the 'task' hint is the pod's identifier
            #
            for key, hints in js.items():

                #
                # - HTTP DELETE the pod via the master API
                #
                url = 'https://%s/api/v1beta3/namespaces/default/pods/%s' % (os.environ['KUBERNETES_MASTER'], hints['task'])
                reply = requests.delete(url, auth=auth,verify=False)
                code = reply.status_code
                logger.debug('-> DELETE %s (HTTP %d)' % (url, code))
                assert code == 200 or code == 201, 'pod deletion failed (HTTP %d)' % code

            self.killed = len(js)
            self.ok = 1

        except __HOLE__ as failure:

            logger.debug('%s : failed to deploy -> %s' % (self.cluster, failure))

        except YAMLError as failure:

            if hasattr(failure, 'problem_mark'):
                mark = failure.problem_mark
                logger.debug('%s : invalid deploy.yml (line %s, column %s)' % (self.cluster, mark.line+1, mark.column+1))

        except Exception as failure:

            logger.debug('%s : failed to deploy -> %s' % (self.cluster, diagnostic(failure)))
dataset/ETHPy150Open autodesk-cloud/ochonetes/images/portal/resources/toolset/toolset/commands/kill.py/_Automation.run