# -*- coding: utf-8 -*-
"""Provides custom exceptions for the ``cfme`` module. """
[docs]class CFMEException(Exception):
"""Base class for exceptions in the CFME tree
Used to easily catch errors of our own making, versus errors from external libraries.
"""
pass
[docs]class BugException(CFMEException):
"""Raised by methods inside the framework that are broken due to a bug"""
def __init__(self, bug_no, operation):
self.bug_no = bug_no
self.operation = operation
def __str__(self):
return "Bug {} blocks the operation [{}]".format(self.bug_no, self.operation)
[docs]class ConsoleNotSupported(CFMEException):
"""Raised by functions in :py:mod:`cfme.configure.configuration` when an invalid
console type is given"""
def __init__(self, product_name, version):
self.product_name = product_name
self.version = version
def __str__(self):
return "Console not supported on current version: {} {}".format(
self.product_name,
self.version
)
[docs]class ConsoleTypeNotSupported(CFMEException):
"""Raised by functions in :py:mod:`cfme.configure.configuration` when an invalid
console type is given"""
def __init__(self, console_type):
self.console_type = console_type
def __str__(self):
return "Console type not supported: {}".format(self.console_type)
[docs]class CFMEExceptionOccured(CFMEException):
"""Raised by when there is a Rails exception currently on page."""
pass
[docs]class AddProviderError(CFMEException):
pass
[docs]class AuthModeUnknown(CFMEException):
"""
Raised if an invalid authenctication mode is passed to
:py:func:`cfme.configure.configuration.set_auth_mode`
"""
pass
[docs]class AutomateImportError(CFMEException):
"""Raised by scripts dealing with Automate when importing automate XML fails"""
pass
[docs]class CandidateNotFound(CFMEException):
"""
Raised if there is no candidate found whilst trying to traverse a tree
"""
def __init__(self, d):
self.d = d
@property
def message(self):
return ", ".join("{}: {}".format(k, v) for k, v in self.d.iteritems())
def __str__(self):
return self.message
[docs]class ElementOrBlockNotFound(CFMEException):
"""
Raised if an Element or a Block is not found whilst locating
"""
pass
[docs]class HostStatsNotContains(CFMEException):
"""
Raised if the hosts information does not contain the specified key whilst running
:py:meth:`cfme.cloud.provider.Provider.do_stats_match`.
"""
pass
[docs]class NavigationError(CFMEException):
"""Raised when pytest_selenium.go_to function is unable to navigate to the requested page."""
def __init__(self, page_name):
self.page_name = page_name
def __str__(self):
return 'Unable to navigate to page "{}"'.format(self.page_name)
pass
[docs]class CannotContinueWithNavigation(CFMEException):
"""Used when it is not possible to continue with navigation.
Raising it will recycle the browser, therefore refresh the session. If you pass a string to
the constructor, it will be written to the log.
"""
pass
[docs]class ProviderHasNoKey(CFMEException):
"""
Raised if the :py:meth:`cfme.cloud.provider.Provider.mgmt` method is called
but the Provider instance has no key.
"""
pass
[docs]class ProviderHasNoProperty(CFMEException):
"""
Raised if the provider does not have the property requested whilst running
:py:meth:`cfme.cloud.provider.Provider.do_stats_match`.
"""
pass
[docs]class ScheduleNotFound(CFMEException):
"""
Raised if a schedule was not found in
:py:meth:`cfme.configure.configuration.Schedule.delete_by_name`
"""
pass
[docs]class RequestException(CFMEException):
"""
Raised if a request was not found or multiple rows matched during _request functions in
:py:mod:`cfme.services.requests`
"""
pass
[docs]class VmNotFoundViaIP(CFMEException):
"""
Raised if a specific VM cannot be found.
"""
pass
[docs]class VmOrInstanceNotFound(CFMEException):
pass
[docs]class VmNotFound(VmOrInstanceNotFound):
"""
Raised if a specific VM cannot be found.
"""
pass
[docs]class InstanceNotFound(VmOrInstanceNotFound):
"""
Raised if a specific instance cannot be found.
"""
pass
[docs]class ImageNotFound(VmOrInstanceNotFound):
"""
Raised if a specific image cannot be found
"""
pass
[docs]class TenantNotFound(CFMEException):
"""
Raised if a specific tenant cannot be found
"""
pass
[docs]class TemplateNotFound(CFMEException):
"""
Raised if a specific Template cannot be found.
"""
pass
[docs]class ClusterNotFound(CFMEException):
"""Raised if a cluster is not found"""
pass
[docs]class HostNotFound(CFMEException):
"""Raised if a specific host cannot be found in UI."""
pass
[docs]class NodeNotFound(CFMEException):
"""Raised if a specific container node cannot be found in the UI"""
pass
[docs]class StackNotFound(CFMEException):
"""
Raised if a specific stack cannot be found.
"""
pass
[docs]class FlavorNotFound(CFMEException):
"""
Raised if a specific cloud flavor cannot be found in the UI
"""
pass
[docs]class KeyPairNotFound(CFMEException):
"""
Raised if a specific cloud key pair cannot be found in the UI
"""
pass
[docs]class SecurityGroupsNotFound(CFMEException):
"""
Raised if a specific cloud Security Groups cannot be found in the UI
"""
pass
[docs]class ResourcePoolNotFound(CFMEException):
"""
Raised if a specific cloud key pair cannot be found in the UI
"""
pass
[docs]class AvailabilityZoneNotFound(CFMEException):
"""
Raised if a specific Cloud Availability Zone cannot be found.
"""
pass
[docs]class VolumeNotFoundError(CFMEException):
"""
Raised if a specific cloud volume cannot be found in the UI
"""
pass
[docs]class OptionNotAvailable(CFMEException):
"""
Raised if a specified option is not available.
"""
pass
[docs]class ZoneNotFound(CFMEException):
"""
Raised when a specific Zone cannot be found in the method
:py:mod:`cfme.configure.configuration`.
"""
pass
[docs]class UnknownProviderType(CFMEException):
"""
Raised when the passed provider or provider type is not known or usable in given context
e.g. when getting a provider from yaml and the provider type doesn't match any of known types
or when an infra provider is passed to the cloud's instance_factory method
"""
pass
[docs]class AccordionItemNotFound(CFMEException):
"""Raised when it's not possible to locate and accordion item."""
[docs]class StorageManagerNotFound(CFMEException):
"""Raised when a Storage Manager is not found"""
pass
[docs]class CUCommandException(CFMEException):
"""Raised when one of the commands run to set up a CU VM fails """
pass
[docs]class LabelNotFoundException(Exception):
"Raises when failed to remove label from object via cli"
pass
[docs]class DestinationNotFound(CFMEException):
"""Raised during navigation where the navigator destination is not found"""
[docs]class ItemNotFound(CFMEException):
"""Raised when an item is not found in general."""
[docs]class ManyEntitiesFound(CFMEException):
"""Raised when one or no items were expected but several/many items were obtained instead."""
[docs]class RoleNotFound(CFMEException):
"""Raised when Deployment role not found"""
[docs]class BackupNotFoundError(CFMEException):
"""Raised when volume backup not found"""
[docs]class RBACOperationBlocked(CFMEException):
"""
Raised when a Role Based Access Control operation is blocked from execution due to invalid
permissions. Also thrown when trying to perform actions CRUD operations on roles/groups/users
that are CFME defaults
"""