This file is indexed.

/usr/lib/python2.7/dist-packages/proliantutils/exception.py is in python-proliantutils 2.5.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

"""Exception Class for proliantutils module."""


class ProliantUtilsException(Exception):
    """Parent class for all Proliantutils exceptions."""
    pass


class InvalidInputError(Exception):

    message = "Invalid Input: %(reason)s"

    # Note(deray): Not mandating the user to provide the ``reason`` attribute
    # parameter while raising InvalidInputError exception. This is because of
    # backward-compatibility reasons. See its unit test file to know about its
    # different ways of usage.
    def __init__(self, message=None, **kwargs):

        if not message:
            message = self.message

            if 'reason' not in kwargs:
                kwargs['reason'] = 'Unknown'

        message = message % kwargs
        super(InvalidInputError, self).__init__(message)


class IloError(ProliantUtilsException):
    """Base Exception.

    This exception is used when a problem is encountered in
    executing an operation on the iLO.
    """
    def __init__(self, message, errorcode=None):
        super(IloError, self).__init__(message)


class IloClientInternalError(IloError):
    """Internal Error from IloClient.

    This exception is raised when iLO client library fails to
    communicate properly with the iLO.
    """
    def __init__(self, message, errorcode=None):
        super(IloClientInternalError, self).__init__(message)


class IloCommandNotSupportedError(IloError):
    """Command not supported on the platform.

    This exception is raised when iLO client library fails to
    communicate properly with the iLO
    """
    def __init__(self, message, errorcode=None):
        super(IloCommandNotSupportedError, self).__init__(message)


class IloCommandNotSupportedInBiosError(IloCommandNotSupportedError):
    """Command not supported on the bios boot mode.

    This exception is raised when iLO client library fails to
    communicate properly with the iLO
    """
    def __init__(self, message, errorcode=None):
        super(IloCommandNotSupportedInBiosError, self).__init__(message)


class IloLoginFailError(IloError):
    """iLO Login Failed.

    This exception is used to communicate a login failure to
    the caller.
    """
    messages = ['User login name was not found',
                'Login failed', 'Login credentials rejected']
    statuses = [0x005f, 0x000a]
    message = 'Authorization Failed'

    def __init__(self, message, errorcode=None):
        super(IloLoginFailError, self).__init__(message)


class IloConnectionError(IloError):
    """Cannot connect to iLO.

    This exception is used to communicate an HTTP connection
    error from the iLO to the caller.
    """
    def __init__(self, message):
        super(IloConnectionError, self).__init__(message)

# This is not merged with generic InvalidInputError because
# of backward-compatibility reasons. If we changed this,
# use-cases of excepting 'IloError' to catch 'IloInvalidInputError'
# will be broken.


class IloInvalidInputError(IloError):
    """Invalid Input passed.

    This exception is used when invalid inputs are passed to
    the APIs exposed by this module.
    """
    def __init__(self, message):
        super(IloInvalidInputError, self).__init__(message)


class HPSSAException(ProliantUtilsException):

    message = "An exception occured in ssa module"

    def __init__(self, message=None, **kwargs):
        if not message:
            message = self.message

        message = message % kwargs
        super(HPSSAException, self).__init__(message)


class PhysicalDisksNotFoundError(HPSSAException):

    message = ("Not enough physical disks were found to create logical disk "
               "of size %(size_gb)s GB and raid level %(raid_level)s")


class HPSSAOperationError(HPSSAException):

    message = ("An error was encountered while doing ssa configuration: "
               "%(reason)s.")


class ImageExtractionFailed(ProliantUtilsException):
    message = "Failed to extract image %(image_ref)s, reason: %(reason)s"

    def __init__(self, message=None, **kwargs):
        if not message:
            message = self.message % kwargs

        super(ImageExtractionFailed, self).__init__(message)


class IloSNMPInvalidInputFailure(IloError):
    message = "Failed to do SNMP retreival %(reason)s"

    def __init__(self, message=None, **kwargs):
        if not message:
            message = self.message % kwargs

        super(IloSNMPInvalidInputFailure, self).__init__(message)


class IloSNMPExceptionFailure(IloError):
    message = "SNMP library failed %(reason)s"

    def __init__(self, message=None, **kwargs):
        if not message:
            message = self.message % kwargs

        super(IloSNMPExceptionFailure, self).__init__(message)


class ImageRefValidationFailed(ProliantUtilsException):
    message = ("Validation of image href %(image_href)s failed, "
               "reason: %(reason)s")

    def __init__(self, message=None, **kwargs):
        if not message:
            message = self.message % kwargs

        super(ImageRefValidationFailed, self).__init__(message)


class SUMOperationError(ProliantUtilsException):
    """SUM based firmware update operation error.

    This exception is used when a problem is encountered in
    executing a SUM operation.
    """

    message = ("An error occurred while performing SUM based firmware "
               "update, reason: %(reason)s")

    def __init__(self, message=None, **kwargs):
        if not message:
            message = self.message % kwargs

        super(SUMOperationError, self).__init__(message)


class RedfishError(ProliantUtilsException):
    """Basic exception for errors raised by Redfish operations."""

    message = None

    def __init__(self, **kwargs):
        if self.message and kwargs:
            self.message = self.message % kwargs

        super(RedfishError, self).__init__(self.message)


class MissingAttributeError(RedfishError):
    message = ('The attribute %(attribute)s is missing from the '
               'resource %(resource)s')