Exemple #1
0
def _get_tasks(tab_destination, **filter_kwargs):
    """ Generic function to return contents of the tasks table

    Args:
        location: Location for :py:module:`ui_navigate` where to get the data.
        **filter_kwargs: See :py:meth:`_filter`
    Returns: List of dicts.
    """
    navigate_to(Tasks, tab_destination)
    if any([filter_kwargs[key] is not None for key in filter_kwargs.keys()]):
        _filter(**filter_kwargs)
    tasks = []

    if sel.is_displayed(tasks_table):
        for page in paginator.pages():
            for row in tasks_table.rows():
                tasks.append(
                    dict(
                        updated=parsetime.from_american_with_utc(
                            row.updated.text.encode('utf-8').strip()
                        ),
                        started=parsetime.from_american_with_utc(
                            row.started.text.encode('utf-8').strip()
                        ),
                        state=row.state.text.encode('utf-8').strip(),
                        message=row.message.text.encode('utf-8').strip(),
                        task_name=row.task_name.text.encode('utf-8').strip(),
                        user=row.user.text.encode('utf-8').strip()
                    )
                )
    else:
        logger.info('No Tasks collected on {}'.format(tab_destination))
    return tasks
Exemple #2
0
def _get_tasks(location, **filter_kwargs):
    """ Generic function to return contents of the tasks table

    Args:
        location: Location for :py:module:`ui_navigate` where to get the data.
        **filter_kwargs: See :py:meth:`_filter`
    Returns: List of dicts.
    """
    sel.force_navigate(location)
    if any([filter_kwargs[key] is not None for key in filter_kwargs.keys()]):
        _filter(**filter_kwargs)
    tasks = []

    if sel.is_displayed(tasks_table):
        have_next_page = True
        while have_next_page:
            for row in tasks_table.rows():
                tasks.append(
                    dict(updated=parsetime.from_american_with_utc(
                        row.updated.text.encode('utf-8').strip()),
                         started=parsetime.from_american_with_utc(
                             row.started.text.encode('utf-8').strip()),
                         state=row.state.text.encode('utf-8').strip(),
                         message=row.message.text.encode('utf-8').strip(),
                         task_name=row.task_name.text.encode('utf-8').strip(),
                         user=row.user.text.encode('utf-8').strip()))
            if int(paginator.rec_end()) < int(paginator.rec_total()):
                sel.click(paginator.next())
            else:
                have_next_page = False
    return tasks
Exemple #3
0
def _get_tasks(location, **filter_kwargs):
    """ Generic function to return contents of the tasks table

    Args:
        location: Location for :py:module:`ui_navigate` where to get the data.
        **filter_kwargs: See :py:meth:`_filter`
    Returns: List of dicts.
    """
    sel.force_navigate(location)
    if any([filter_kwargs[key] is not None for key in filter_kwargs.keys()]):
        _filter(**filter_kwargs)
    tasks = []

    if sel.is_displayed(tasks_table):
        have_next_page = True
        while have_next_page:
            for row in tasks_table.rows():
                tasks.append(
                    dict(
                        updated=parsetime.from_american_with_utc(row.updated.text.encode("utf-8").strip()),
                        started=parsetime.from_american_with_utc(row.started.text.encode("utf-8").strip()),
                        state=row.state.text.encode("utf-8").strip(),
                        message=row.message.text.encode("utf-8").strip(),
                        task_name=row.task_name.text.encode("utf-8").strip(),
                        user=row.user.text.encode("utf-8").strip(),
                    )
                )
            if int(paginator.rec_end()) < int(paginator.rec_total()):
                sel.click(paginator.next())
            else:
                have_next_page = False
    return tasks
Exemple #4
0
 def __init__(self, path_to_report, run_datetime, queued_datetime, candu=False, appliance=None):
     Navigatable.__init__(self, appliance=appliance)
     self.path = path_to_report
     self.datetime = run_datetime
     self.candu = candu
     self.queued_datetime_in_title = parsetime.from_american_with_utc(
         queued_datetime).to_saved_report_title_format()
     self.datetime_in_tree = parsetime.from_american_with_utc(self.datetime).to_iso_with_utc()
 def __init__(self, path_to_report, datetime, candu=False, appliance=None):
     Navigatable.__init__(self, appliance=appliance)
     self.path = path_to_report
     self.datetime = datetime
     self.candu = candu
     self.datetime_in_tree = version.pick({"5.6": self.datetime,
                     "5.7": parsetime.from_american_with_utc(self.datetime).to_iso_with_utc()})
Exemple #6
0
 def __init__(self, path_to_report, datetime, candu=False, appliance=None):
     Navigatable.__init__(self, appliance=appliance)
     self.path = path_to_report
     self.datetime = datetime
     self.candu = candu
     self.datetime_in_tree = version.pick({"5.6": self.datetime,
                     "5.7": parsetime.from_american_with_utc(self.datetime).to_iso_with_utc()})
Exemple #7
0
    def get_last_collection(self):
        """ Returns the Last Log Collection that is displayed in the InfoBlock.

        Returns: If it is Never, returns `None`, otherwise :py:class:`utils.timeutil.parsetime`.
        """
        d = self.elements.infoblock.text("Basic Info", "Last Log Collection")
        return None if d.strip().lower() == "never" else parsetime.from_american_with_utc(d.strip())