Example #1
0
    def list(self, json_, quiet_=False):
        """
        :param json_: output json if True
        :type json_: bool
        :returns: process return code
        :rtype: int
        """

        client = self._create_marathon_client()
        apps = client.get_apps()

        if quiet_:
            for app in apps:
                emitter.publish(app.get('id'))
        elif json_:
            emitter.publish(apps)
        else:
            deployments = client.get_deployments()
            queued_apps = client.get_queued_apps()
            _enhance_row_with_overdue_information(apps, queued_apps)
            table = tables.app_table(apps, deployments)
            output = six.text_type(table)
            if output:
                emitter.publish(output)

        return 0
Example #2
0
def _list(json_):
    """
    :param json_: output json if True
    :type json_: bool
    :returns: process return code
    :rtype: int
    """

    client = marathon.create_client()
    apps = client.get_apps()

    if json_:
        emitter.publish(apps)
    else:
        deployments = client.get_deployments()
        table = tables.app_table(apps, deployments)
        output = six.text_type(table)
        if output:
            emitter.publish(output)

    return 0
Example #3
0
    def list(self, json_):
        """
        :param json_: output json if True
        :type json_: bool
        :returns: process return code
        :rtype: int
        """

        client = self._create_marathon_client()
        apps = client.get_apps()

        if json_:
            emitter.publish(apps)
        else:
            deployments = client.get_deployments()
            queued_apps = client.get_queued_apps()
            _enhance_row_with_overdue_information(apps, queued_apps)
            table = tables.app_table(apps, deployments)
            output = six.text_type(table)
            if output:
                emitter.publish(output)

        return 0
Example #4
0
def test_app_table():
    apps = [app_fixture()]
    deployments = []
    table = tables.app_table(apps, deployments)
    with open('tests/unit/data/app.txt') as f:
        assert str(table) == f.read()
Example #5
0
def test_app_table():
    apps = [app_fixture()]
    deployments = []
    table = tables.app_table(apps, deployments)
    with open('tests/unit/data/app.txt') as f:
        assert str(table) == f.read()