How to use the ara.fields.Field function in ara

To help you get started, we’ve selected a few ara examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dmsimard / ara-archive / ara / cli / file.py View on Github external
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with ARA.  If not, see .

import logging

from ara import models
from ara.fields import Field
from cliff.lister import Lister
from cliff.show import ShowOne

FIELDS = (
    Field('ID'),
    Field('Path'),
    Field('Playbook ID', 'playbook.id'),
)


class FileList(Lister):
    """ Returns a list of files """
    log = logging.getLogger(__name__)

    def get_parser(self, prog_name):
        parser = super(FileList, self).get_parser(prog_name)
        g = parser.add_mutually_exclusive_group(required=True)
        g.add_argument(
            '--playbook', '-b',
            metavar='',
            help='Show files associated with a specified playbook',
        )
        g.add_argument(
github ansible-community / ara / ara / cli / result.py View on Github external
)

SHOW_FIELDS = (
    Field('ID'),
    Field('Name', 'task.name'),
    Field('Playbook ID', 'task.playbook.id'),
    Field('Playbook Path', 'task.playbook.path'),
    Field('Play ID', 'task.play.id'),
    Field('Play Name', 'task.play.name'),
    Field('Task ID', 'task.id'),
    Field('Task Name', 'task.name'),
    Field('Host', 'host.name'),
    Field('Action', 'task.action'),
    Field('Status', 'derived_status'),
    Field('Ignore Errors'),
    Field('Time Start'),
    Field('Time End'),
    Field('Duration'),
)

SHOW_FIELDS_LONG = SHOW_FIELDS + (
    Field('Result', 'result|from_json',
          template='{{ value | to_nice_json | safe }}'),
)

SHOW_FIELDS_RAW = SHOW_FIELDS + (
    Field('Result', 'result | from_json'),
)


class ResultList(Lister):
    """ Returns a list of results """
github dmsimard / ara-archive / ara / cli / result.py View on Github external
Field('Playbook Path', 'task.playbook.path'),
    Field('Play ID', 'task.play.id'),
    Field('Play Name', 'task.play.name'),
    Field('Task ID', 'task.id'),
    Field('Task Name', 'task.name'),
    Field('Host', 'host.name'),
    Field('Action', 'task.action'),
    Field('Status', 'derived_status'),
    Field('Ignore Errors'),
    Field('Time Start'),
    Field('Time End'),
    Field('Duration'),
)

SHOW_FIELDS_LONG = SHOW_FIELDS + (
    Field('Result', 'result|from_json',
          template='{{ value | to_nice_json | safe }}'),
)

SHOW_FIELDS_RAW = SHOW_FIELDS + (
    Field('Result', 'result | from_json'),
)


class ResultList(Lister):
    """ Returns a list of results """
    log = logging.getLogger(__name__)

    def get_parser(self, prog_name):
        parser = super(ResultList, self).get_parser(prog_name)

        g = parser.add_mutually_exclusive_group(required=True)
github dmsimard / ara-archive / ara / cli / playbook.py View on Github external
Field('ID'),
    Field('Path'),
    Field('Time Start'),
    Field('Duration'),
    Field('Complete'),
    Field('Ansible Version'),
)

SHOW_FIELDS = (
    Field('ID'),
    Field('Path'),
    Field('Time Start'),
    Field('Time End'),
    Field('Duration'),
    Field('Complete'),
    Field('Ansible Version'),
    Field('Parameters', 'options',
          template='{{ value | to_nice_json | safe }}')
)


class PlaybookList(Lister):
    """ Returns a list of playbooks """
    log = logging.getLogger(__name__)

    def get_parser(self, prog_name):
        parser = super(PlaybookList, self).get_parser(prog_name)
        parser.add_argument(
            '--incomplete', '-I',
            action='store_true',
            help='Only show incomplete playbook runs',
        )
github dmsimard / ara-archive / ara / cli / data.py View on Github external
#  You should have received a copy of the GNU General Public License
#  along with ARA.  If not, see .

import logging

from ara import models
from ara.fields import Field
from cliff.lister import Lister
from cliff.show import ShowOne

LIST_FIELDS = (
    Field('ID'),
    Field('Playbook ID', 'playbook.id'),
    Field('Playbook Path', 'playbook.path'),
    Field('Key'),
    Field('Type')
)

SHOW_FIELDS = (
    Field('ID'),
    Field('Playbook ID', 'playbook.id'),
    Field('Playbook Path', 'playbook.path'),
    Field('Key'),
    Field('Value'),
    Field('Type')
)


class DataList(Lister):
    """ Returns a list of recorded key/value pairs """
    log = logging.getLogger(__name__)
github ansible-community / ara / ara / cli / result.py View on Github external
SHOW_FIELDS = (
    Field('ID'),
    Field('Name', 'task.name'),
    Field('Playbook ID', 'task.playbook.id'),
    Field('Playbook Path', 'task.playbook.path'),
    Field('Play ID', 'task.play.id'),
    Field('Play Name', 'task.play.name'),
    Field('Task ID', 'task.id'),
    Field('Task Name', 'task.name'),
    Field('Host', 'host.name'),
    Field('Action', 'task.action'),
    Field('Status', 'derived_status'),
    Field('Ignore Errors'),
    Field('Time Start'),
    Field('Time End'),
    Field('Duration'),
)

SHOW_FIELDS_LONG = SHOW_FIELDS + (
    Field('Result', 'result|from_json',
          template='{{ value | to_nice_json | safe }}'),
)

SHOW_FIELDS_RAW = SHOW_FIELDS + (
    Field('Result', 'result | from_json'),
)


class ResultList(Lister):
    """ Returns a list of results """
    log = logging.getLogger(__name__)
github ansible-community / ara / ara / cli / result.py View on Github external
Field('Duration'),
)

SHOW_FIELDS = (
    Field('ID'),
    Field('Name', 'task.name'),
    Field('Playbook ID', 'task.playbook.id'),
    Field('Playbook Path', 'task.playbook.path'),
    Field('Play ID', 'task.play.id'),
    Field('Play Name', 'task.play.name'),
    Field('Task ID', 'task.id'),
    Field('Task Name', 'task.name'),
    Field('Host', 'host.name'),
    Field('Action', 'task.action'),
    Field('Status', 'derived_status'),
    Field('Ignore Errors'),
    Field('Time Start'),
    Field('Time End'),
    Field('Duration'),
)

SHOW_FIELDS_LONG = SHOW_FIELDS + (
    Field('Result', 'result|from_json',
          template='{{ value | to_nice_json | safe }}'),
)

SHOW_FIELDS_RAW = SHOW_FIELDS + (
    Field('Result', 'result | from_json'),
)


class ResultList(Lister):
github dmsimard / ara-archive / ara / cli / result.py View on Github external
LIST_FIELDS = (
    Field('ID'),
    Field('Name', 'task.name'),
    Field('Host', 'host.name'),
    Field('Action', 'task.action'),
    Field('Status', 'derived_status'),
    Field('Ignore Errors'),
    Field('Time Start'),
    Field('Duration'),
)

SHOW_FIELDS = (
    Field('ID'),
    Field('Name', 'task.name'),
    Field('Playbook ID', 'task.playbook.id'),
    Field('Playbook Path', 'task.playbook.path'),
    Field('Play ID', 'task.play.id'),
    Field('Play Name', 'task.play.name'),
    Field('Task ID', 'task.id'),
    Field('Task Name', 'task.name'),
    Field('Host', 'host.name'),
    Field('Action', 'task.action'),
    Field('Status', 'derived_status'),
    Field('Ignore Errors'),
    Field('Time Start'),
    Field('Time End'),
    Field('Duration'),
)

SHOW_FIELDS_LONG = SHOW_FIELDS + (
    Field('Result', 'result|from_json',
          template='{{ value | to_nice_json | safe }}'),
github dmsimard / ara-archive / ara / cli / play.py View on Github external
#  You should have received a copy of the GNU General Public License
#  along with ARA.  If not, see .

import logging

from ara import models
from ara.fields import Field
from cliff.lister import Lister
from cliff.show import ShowOne

LIST_FIELDS = (
    Field('ID'),
    Field('Name'),
    Field('Playbook', 'playbook.path'),
    Field('Time Start'),
    Field('Duration'),
)

SHOW_FIELDS = (
    Field('ID'),
    Field('Name'),
    Field('Playbook ID', 'playbook.id'),
    Field('Playbook Path', 'playbook.path'),
    Field('Time Start'),
    Field('Time End'),
    Field('Duration'),
)


class PlayList(Lister):
    """ Returns a list of plays """
    log = logging.getLogger(__name__)
github ansible-community / ara / ara / cli / file.py View on Github external
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with ARA.  If not, see .

import logging

from ara import models
from ara.fields import Field
from cliff.lister import Lister
from cliff.show import ShowOne

FIELDS = (
    Field('ID'),
    Field('Path'),
    Field('Playbook ID', 'playbook.id'),
)


class FileList(Lister):
    """ Returns a list of files """
    log = logging.getLogger(__name__)

    def get_parser(self, prog_name):
        parser = super(FileList, self).get_parser(prog_name)
        g = parser.add_mutually_exclusive_group(required=True)
        g.add_argument(
            '--playbook', '-b',
            metavar='',
            help='Show files associated with a specified playbook',