
    d<                        d Z  G d de      Z G d de      Z G d de      Z G d de      Z G d	 d
e      Z G d de      Z G d de      Z	 G d de      Z
 G d de
      Z G d de
      Z G d de
      Z G d de
      Z G d de      Z G d de
      Z G d de      Z G d d e      Z G d! d"e      Z G d# d$e      Z G d% d&e      Z G d' d(e      Z G d) d*e      Z G d+ d,e      Z G d- d.e      Z G d/ d0e      Z G d1 d2e      Z G d3 d4e      Z G d5 d6e      Z G d7 d8e      Z G d9 d:e      Z  G d; d<e      Z!y=)>z
Defines all exceptions
c                   "     e Zd ZdZ fdZ xZS )ExitExceptionz*
    Used to exit the agent's process
    c                 8    t         t        |           || _        y N)superr   __init__reason)selfr   	__class__s     B/usr/lib/python3/dist-packages/azurelinuxagent/common/exception.pyr   zExitException.__init__   s    mT+-    __name__
__module____qualname____doc__r   __classcell__r
   s   @r   r   r      s     r   r   c                       e Zd ZdZy)AgentUpgradeExitExceptionz?
    Used to exit the agent's process due to Agent Upgrade
    Nr   r   r   r    r   r   r   r   "       r   r   c                   $     e Zd ZdZd fd	Z xZS )
AgentErrorz$
    Base class of agent error.
    c                     dj                  t        |       j                  |      }|dj                  ||      }t        t        |   |       y )Nz	[{0}] {1}z{0}
Inner error: {1})formattyper   r   r   r   r	   msginnerr
   s      r   r   zAgentError.__init__-   sF    !!$t*"5"5s;*11#u=Cj$(-r   r   r   r   s   @r   r   r   (   s    . .r   r   c                   $     e Zd ZdZd fd	Z xZS )AgentConfigErrorz8
    When configure file is not found or malformed.
    c                 .    t         t        |   ||       y r   )r   r"   r   r   s      r   r   zAgentConfigError.__init__9       .sE:r   NNr   r   s   @r   r"   r"   4       ; ;r   r"   c                   $     e Zd ZdZd fd	Z xZS )AgentMemoryExceededExceptionz*
    When Agent memory limit reached.
    c                 .    t         t        |   ||       y r   )r   r(   r   r   s      r   r   z%AgentMemoryExceededException.__init__A   s    *D:3Fr   r%   r   r   s   @r   r(   r(   =   s    G Gr   r(   c                   $     e Zd ZdZd fd	Z xZS )AgentNetworkErrorz(
    When network is not available.
    c                 .    t         t        |   ||       y r   )r   r+   r   r   s      r   r   zAgentNetworkError.__init__J       /U;r   r%   r   r   s   @r   r+   r+   E       < <r   r+   c                   $     e Zd ZdZd fd	Z xZS )CGroupsExceptionz:
    Exception to classify any cgroups related issue.
    c                 .    t         t        |   ||       y r   )r   r0   r   r   s      r   r   zCGroupsException.__init__S   r$   r   r%   r   r   s   @r   r0   r0   N   r&   r   r0   c                   $     e Zd ZdZd fd	Z xZS )ExtensionErrorz-
    When failed to execute an extension
    c                 <    t         t        |   ||       || _        y r   )r   r3   r   code)r	   r   r    r5   r
   s       r   r   zExtensionError.__init__\   s    nd,S%8	r   )NNr   r   s   @r   r3   r3   W   s     r   r3   c                   $     e Zd ZdZd fd	Z xZS )ExtensionOperationErrorzI
    When the command times out or returns with a non-zero exit_code
    c                 J    t         t        |   ||       || _        || _        y r   )r   r8   r   r5   	exit_code)r	   r   r    r5   r:   r
   s        r   r   z ExtensionOperationError.__init__f   s#    %t5c5A	"r   )NNr6   r6   r   r   s   @r   r8   r8   a   s    # #r   r8   c                       e Zd ZdZy)ExtensionUpdateErrorz9
    Error raised when failed to update an extension
    Nr   r   r   r   r<   r<   l   r   r   r<   c                       e Zd ZdZy)ExtensionDownloadErrorzE
    Error raised when failed to download and setup an extension
    Nr   r   r   r   r>   r>   r   r   r   r>   c                       e Zd ZdZy)ExtensionsGoalStateErrorz@
    Error raised when the ExtensionsGoalState is malformed
    Nr   r   r   r   r@   r@   x   r   r   r@   c                       e Zd ZdZy)ExtensionsConfigErrorz=
    Error raised when the ExtensionsConfig is malformed
    Nr   r   r   r   rB   rB   ~   r   r   rB   c                       e Zd ZdZy)MultiConfigExtensionEnableErrorzK
    Error raised when enable for a Multi-Config extension is failing.
    Nr   r   r   r   rD   rD      r   r   rD   c                   $     e Zd ZdZd fd	Z xZS )ProvisionErrorz
    When provision failed
    c                 .    t         t        |   ||       y r   )r   rF   r   r   s      r   r   zProvisionError.__init__   s    nd,S%8r   r%   r   r   s   @r   rF   rF      s    9 9r   rF   c                   $     e Zd ZdZd fd	Z xZS )ResourceDiskErrorz$
    Mount resource disk failed
    c                 .    t         t        |   ||       y r   )r   rI   r   r   s      r   r   zResourceDiskError.__init__   r-   r   r%   r   r   s   @r   rI   rI      r.   r   rI   c                   $     e Zd ZdZd fd	Z xZS )	DhcpErrorz(
    Failed to handle dhcp response
    c                 .    t         t        |   ||       y r   )r   rL   r   r   s      r   r   zDhcpError.__init__       i'U3r   r%   r   r   s   @r   rL   rL          4 4r   rL   c                   $     e Zd ZdZd fd	Z xZS )OSUtilErrorz9
    Failed to perform operation to OS configuration
    c                 .    t         t        |   ||       y r   )r   rQ   r   r   s      r   r   zOSUtilError.__init__       k4)#u5r   r%   r   r   s   @r   rQ   rQ          6 6r   rQ   c                   $     e Zd ZdZd fd	Z xZS )ProtocolErrorz
    Azure protocol error
    c                 .    t         t        |   ||       y r   )r   rV   r   r   s      r   r   zProtocolError.__init__   s    mT+C7r   r%   r   r   s   @r   rV   rV      s    8 8r   rV   c                       e Zd ZdZy)ProtocolNotFoundErrorz=
    Error raised when Azure protocol endpoint not found
    Nr   r   r   r   rY   rY      r   r   rY   c                   $     e Zd ZdZd fd	Z xZS )	HttpErrorz
    Http request failure
    c                 .    t         t        |   ||       y r   )r   r[   r   r   s      r   r   zHttpError.__init__   rN   r   r%   r   r   s   @r   r[   r[      rO   r   r[   c                       e Zd ZdZy)InvalidContainerErrorzF
    Error raised when Container id sent in the header is invalid
    Nr   r   r   r   r^   r^      r   r   r^   c                   $     e Zd ZdZd fd	Z xZS )
EventErrorz
    Event reporting error
    c                 .    t         t        |   ||       y r   )r   r`   r   r   s      r   r   zEventError.__init__       j$(e4r   r%   r   r   s   @r   r`   r`          5 5r   r`   c                   $     e Zd ZdZd fd	Z xZS )
CryptErrorz
    Encrypt/Decrypt error
    c                 .    t         t        |   ||       y r   )r   re   r   r   s      r   r   zCryptError.__init__   rb   r   r%   r   r   s   @r   re   re      rc   r   re   c                   $     e Zd ZdZd fd	Z xZS )UpdateErrorz"
    Update Guest Agent error
    c                 .    t         t        |   ||       y r   )r   rh   r   r   s      r   r   zUpdateError.__init__   rS   r   r%   r   r   s   @r   rh   rh      rT   r   rh   c                   $     e Zd ZdZd fd	Z xZS )ResourceGoneErrorzH
   The requested resource no longer exists (i.e., status code 410)
    c                 6    |d}t         t        |   ||       y )NzResource is gone)r   rk   r   r   s      r   r   zResourceGoneError.__init__   s    ;$C/U;r   r%   r   r   s   @r   rk   rk      s    < <r   rk   c                   0     e Zd ZdZdZdZdZd fd	Z xZS )InvalidExtensionEventErrorzq
    Error thrown when the extension telemetry event is invalid as defined per the contract with extensions.
    MissingKeyErrorEmptyMessageErrorOversizeEventErrorc                 .    t         t        |   ||       y r   )r   rn   r   r   s      r   r   z#InvalidExtensionEventError.__init__   s    ($8eDr   r%   )	r   r   r   r   ro   rp   rq   r   r   r   s   @r   rn   rn      s'     (O+-E Er   rn   c                   $     e Zd ZdZd fd	Z xZS )ServiceStoppedErrorzG
    Error thrown when trying to access a Service which is stopped
    c                 .    t         t        |   ||       y r   )r   rt   r   r   s      r   r   zServiceStoppedError.__init__  s    !41#u=r   r%   r   r   s   @r   rt   rt      s    > >r   rt   c                   N    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZd Zy)ExtensionErrorCodesz
    Common Error codes used across by Compute RP for better understanding
    the cause and clarify common occurring errors
    r6       i  i  i  i  i  i  i  i  i  i  i  i  c                      y r   r   )r	   s    r   r   zExtensionErrorCodes.__init__8  s    r   N)r   r   r   r   PluginUnknownFailurePluginSuccessPluginProcessingErrorPluginManifestDownloadErrorPluginHandlerManifestNotFound)PluginHandlerManifestDeserializationErrorPluginPackageDownloadFailedPluginPackageExtractionFailedPluginInstallProcessingFailedPluginUpdateProcessingFailedPluginEnableProcessingFailedPluginDisableProcessingFailedPluginHandlerScriptTimedoutPluginSettingsStatusInvalidr   r   r   r   rw   rw     s{      M ! #' %)! 15- #' %)! %)! $(  $(  %)! #' #'r   rw   c                       e Zd ZdZdZdZy)GoalStateAggregateStatusCodesrx   r6   i  N)r   r   r   SuccessGoalStateUnknownFailure$GoalStateUnsupportedRequiredFeaturesr   r   r   r   r   <  s     G ! ,0(r   r   N)"r   BaseExceptionr   r   	Exceptionr   r"   r(   r+   r0   r3   r8   r<   r>   r@   rB   rD   rF   rI   rL   rQ   rV   rY   r[   r^   r`   re   rh   rk   rn   rt   objectrw   r   r   r   r   <module>r      sx  (
M  	. 	.;z ;G: G<
 <;z ;Z #n #> ^ ~ 4 n 9Z 9<
 <4
 46* 68J 8M 4
 4I 5 55 56* 6<	 <
E 
E>* >1& 1h	0F 	0r   