
/Pc           @   s  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z m Z e d  Z e e d  Z e d  Z e j d    Z d e f d	     YZ d
 e f d     YZ d e f d     YZ d e j f d     YZ d e f d     YZ  d e f d     YZ! d e f d     YZ" d e f d     YZ# d e f d     YZ$ d e f d     YZ% d e f d     YZ& d e f d     YZ' d  e f d!     YZ( d" e f d#     YZ) d$ e f d%     YZ* d& e f d'     YZ+ d( e f d)     YZ, d* e f d+     YZ- d, e f d-     YZ. d S(.   s   
Object model for querying information and manipulating deployments
of autoinstalls.  Every :class:`Deployment` has an :class:`app.ApplicationVersion`
which in turn has an :class:`app.Application`.
iN(   t   appt   gitt   old_logt   shellt   sqlt   utilc         C   sw   t  j j |   r" t j |  g  S| r@ t j |  d | g  St j g  t t  j |    D] } |  d | ^ q\  S(   s   
    Low level function that retrieves a list of lines from the
    :term:`versions store` that can be passed to :meth:`Deployment.parse`.
    t   /(   t   ost   patht   isfilet	   fileinputt   inputt   sortedt   listdir(   t   versions_storet   usert   f(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   get_install_lines   s
    c         c   sS  |  s t  j   }  n- t |  t  r6 t |  g  }  n t |   }  x
t | |  D] } y t j |  } | j j	 } Wn t  j
 k
 r } | j s y | j d  d | _ Wq t k
 r | | _ q Xn  | rR | VqR qR n+ t k
 rt j d | j    qR n X| d t j t | j   |  k sF| |  k rR n qR | VqR Wd S(   s_  
    Generator function for iterating through all autoinstalls.
    Each item is an instance of :class:`Deployment`, or possibly
    a :class:`wizard.deploy.Error` if ``yield_errors`` is ``True``.  You can
    filter out applications and versions by specifying ``app``
    or ``app-1.2.3`` in ``show``.  This function may generate
    log output.
    t   :i    s   Error with '%s't   -N(   R    t   applicationst
   isinstancet   strt	   frozensetR   t
   Deploymentt   parset   applicationt   namet   NoSuchApplicationt   locationt   splitt
   IndexErrort   Errort   loggingt   warningt   rstripR   t   truncatet   version(   t   showR   t   yield_errorsR   t   linet   dR   t   e(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   parse_install_lines$   s2    		2c         c   sI  | r@ t  | t  r' t j |  } n  t j d |  | Vd Sx t j d  D]o } t j d |  | j   } xJ | |   D]< } t  | t  r t j |  } n  t j d |  | Vq WqP Wt	 j
 d  } t	 j
 d  } | d k	 r8| d k	 r8t j d | | j d	  d
 d
 d
  } t j d |  | Vn  t j d  d S(   s  
    Attempts to determine the URL a directory would be web-accessible at.
    If ``url`` is specified, automatically use it.  Returns a generator which
    produces a list of candidate urls.

    This function implements a plugin interface named :ref:`wizard.deploy.web`.
    s'   wizard.deploy.web: Using default URL %sNs   wizard.deploy.webs    wizard.deploy.web: Processing %ss/   wizard.deploy.web: Using plugin-supplied URL %st   WIZARD_WEB_HOSTt   WIZARD_WEB_PATHt   httpR   t    s+   wizard.deploy.web: Using environment URL %ss!   wizard.deploy.web: Exhausted URLs(   R   R   t   urlparseR!   t   infot   pkg_resourcest   iter_entry_pointst   debugt   loadR   t   getenvt   Nonet   ParseResultR#   (   t   dirt   urlt   entryR   t   rt   hostR   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   webN   s2    c         O   s-   t  j | j   |  | | |  SWd QXd S(   sa   
    Decorator for making a function have working directory
    :attr:`Deployment.location`.
    N(   R   t   ChangeDirectoryR   (   R   t   selft   argst   kwargs(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   chdir_to_locationv   s    R   c           B   s  e  Z d  Z d Z d d  Z d   Z d   Z e d  Z	 d   Z
 e d  Z d   Z d   Z d	   Z e d
    Z e d    Z e e d     Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z  e d    Z! e d    Z" d   Z# e$ d    Z% RS(   sR  
    Represents a deployment of an autoinstall, e.g. directory that has a
    ``.wizard`` directory in it.  Supply ``version`` with an
    :class:`ApplicationVersion` only if you were reading from the
    :term:`versions store` and care about speed (data from there can be
    stale).

    The Deployment interface is somewhat neutered, so you may
    want to use :class:`WorkingCopy` or :class:`ProductionCopy` for
    more powerful operations.

    .. note::

        For legacy purposes, deployments can also be marked by a
        ``.scripts`` directory or a ``.scripts-version`` file.
    c         C   sX   t  j j |  |  _ | |  _ i  |  _ d  |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ d  S(   N(   R   R   t   abspathR   t   _app_versiont   _read_cacheR7   t   _old_logt   _dsnt   _urlt   _urlGent   _wizard_dir(   R@   R   R%   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   __init__   s    						c         C   s   d |  _ i  |  _ d |  _ d S(   s   
        Invalidates all cached variables.  This currently applies to
        :attr:`app_version`, :attr:`old_log` and :meth:`read`.
        N(   R7   RE   RF   RG   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   invalidateCache   s    		c         C   s   | |  _  d S(   s   
        Manually resets the application version; useful if the working
        copy is off in space (i.e. not anchored to something we can
        git describe off of) or there is no metadata to be heard of.
        N(   RE   (   R@   t   app_version(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   setAppVersion   s    c         C   s^   | s | |  j  k rS t t j j |  j |   } | j   |  j  | <| j   n  |  j  | S(   sd   
        Reads a file's contents, possibly from cache unless ``force``
        is ``True``.
        (   RF   t   openR   R   t   joinR   t   readt   close(   R@   t   filet   forceR   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRR      s
    c         C   s   |  j  j |   S(   s   
        Extracts all the values of all variables from deployment.
        These variables may be used for parametrizing generic parent
        commits and include things such as database access credentials
        and local configuration.
        (   R   t   extract(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRV      s    c         C   s   t  j |  j   t j j d  } t j j d  } | ri t j j d  ri t j d d  t } n  | r | r t |  j   nc | r | r t	 |  j   nD | r | r t j j
 d  r t |  j   q t |  j   n  Wd QXd S(   s   
        Checks if this is an autoinstall, throws an exception if there
        are problems.  If ``no_touch`` is ``True``, it will not attempt
        edit the installation.
        s   .gits   .wizards   .scriptss   .scripts-versionN(   R   R?   R   R   R   t   isdirt   symlinkt   Truet   CorruptedAutoinstallErrort   AlreadyVersionedErrorR	   t   NotMigratedErrort   NotAutoinstallError(   R@   t   no_toucht   has_gitt
   has_wizard(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   verify   s    	c         C   se   |  j  j |  } y& t j d d | d |  j j d  Wn& t j k
 r` t |  j j   n Xd S(   sm   
        Checks if the purported version has a corresponding tag
        in the upstream repository.
        R   s	   --git-dirs	   rev-parses   --N(   R   t
   repositoryR   t   evalRN   t
   wizard_tagt	   CallErrort
   NoTagError(   R@   t   srv_patht   repo(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt	   verifyTag   s
    &c            s   t  j |  j   |  j j |      f d    d      f d   } | |  j j  sv t |  j j   n  | |  j j  s t	 |  j j   n   |  j j  } t
 j d d | d d t } | | k r t |  j j   n  Wd QXd S(	   s   
        Checks if the autoinstall's Git repository makes sense,
        checking if the tag is parseable and corresponds to
        a real application, and if the tag in this repository
        corresponds to the one in the remote repository.
        c            s   t  j d d   d |   S(   NR   s	   --git-dirs	   rev-parse(   R   Rc   (   t   tag(   Rh   (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   repo_rev_parse   s    c         S   sD   y t  j d d |  d t SWn  t  j k
 r? t |    n Xd  S(   NR   s	   rev-parset   strip(   R   t   safeCallRY   Re   t   NoLocalTagError(   Rj   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   self_rev_parse   s    c            s     |    |   k S(   N(    (   Rj   (   Rk   Ro   (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   compare_tags   s    R   s
   merge-baset   HEADRl   N(   R   R?   R   R   Rb   RN   t   pristine_tagt   InconsistentPristineTagErrorRd   t   InconsistentWizardTagErrorR   Rm   RY   t   HeadNotDescendantError(   R@   Rg   Rp   t   parentt
   merge_base(    (   Rh   Rk   Ro   s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt	   verifyGit   s    	c         C   s   |  j  s t |  j   n  d S(   sB   
        Checks if the autoinstall is configured running.
        N(   t
   configuredt   NotConfiguredErrorR   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   verifyConfigured   s    	c         C   sJ   |  j    } t |  |  j j j d  d k sF t | |  j   n  d S(   si   
        Checks if our version and the version number recorded in a file
        are consistent.
        R   i   N(   t   detectVersionR   RN   Rr   t	   partitiont   VersionMismatchErrorR%   (   R@   t   real(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   verifyVersion  s    %c         C   s%   |  j  j |   } | s! t  n  | S(   s   
        Returns the real version, based on filesystem, of install.

        Throws a :class:`VersionDetectionError` if we couldn't figure out
        what the real version was.
        (   R   R|   t   VersionDetectionError(   R@   R   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR|     s    	c         C   s   |  j  j |   S(   sD   Whether or not an autoinstall has been configured/installed for use.(   R   t   checkConfig(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRy     s    c         C   s   t  j j |  j  S(   s2   Whether or not the autoinstalls has been migrated.(   R   R   RW   t
   wizard_dir(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   migrated!  s    c         C   s   t  j j |  j d  S(   s*   The absolute path of the Wizard directory.s   .wizard(   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   %  s    c         C   s   t  j j |  j d  S(   s)   The absolute path to ``.wizard/backups``.t   backups(   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt
   backup_dir)  s    c         C   s   t  j j |  j d  S(   sC   
        The absolute path of either ``.scripts-version``.
        s   .scripts-version(   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   old_version_file.  s    c         C   s   t  j j |  j d  S(   s6   The absolute path of the ``.wizard/blacklisted`` file.t   blacklisted(   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   blacklisted_file4  s    c         C   s   t  j j |  j d  S(   s2   The absolute path of the ``.wizard/pending`` file.t   pending(   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   pending_file8  s    c         C   s   t  j j |  j d  S(   s2   The absolute path of the ``.wizard/version`` file.R%   (   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   version_file<  s    c         C   s   t  j j |  j d  S(   s;   The absolute path of the :file:`.wizard/dsn` override file.t   dsn(   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   dsn_file@  s    c         C   s   t  j j |  j d  S(   s;   The absolute path of the :file:`.wizard/url` override file.R:   (   R   R   RQ   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   url_fileD  s    c         C   s
   |  j  j S(   s0   The :class:`app.Application` of this deployment.(   RN   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   H  s    c         C   s(   |  j  s! t j j |   |  _  n  |  j  S(   s   
        The :class:`wizard.old_log.Log` of this deployment.  This
        is only applicable to un-migrated autoinstalls.
        (   RG   R   t	   DeployLogR5   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   L  s    	c         C   s
   |  j  j S(   sY   
        The :class:`distutils.version.LooseVersion` of this
        deployment.
        (   RN   R%   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR%   U  s    c         C   s1  |  j  s t j j t j j |  j d   r yS t j |  j  # t j	   j
 d  \ } } } Wd QXt j j | |  |  _  Wq t j k
 r q Xq n  |  j  s y |  j d j |  _  Wq t j k
 r q Xn  |  j  s*t j d d d  j d  d	 j
 d
  d } t j j | d  |  _  n  |  j  S(   s7   The :class:`app.ApplicationVersion` of this deployment.s   .gitR   NiR   t   configs   remote.origin.urlR   i   t   .i    t   unknown(   RE   R   R   RW   RQ   R   R   R?   R   t   describeR}   R    t   ApplicationVersiont   makeR   Re   R   R%   t   ScriptsVersionNoSuchFileRc   t
   rpartition(   R@   t   appnamet   _R%   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRN   \  s"    	$$
		/c         C   s1   |  j  s* t j |  j j |    |  _  n  |  j  S(   s;   The :class:`sqlalchemy.engine.url.URL` for this deployment.(   RH   R   t   authR   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   q  s    	!c         C   s   |  j  s |  j   n  |  j  S(   s6   The :class:`urlparse.ParseResult` for this deployment.(   RI   t   nextUrl(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR:   w  s    	c         C   sh   |  j  s- t |  j |  j j |    |  _  n  y |  j  j   |  _ |  j SWn t k
 rc t  n Xd S(   s   
        Initializes :attr:`url` with a possible URL the web application may
        be located at.  It may be called again to switch to another possible
        URL, usually in the event of a web access failure.
        N(	   RJ   R>   R   R   R:   t   nextRI   t   StopIterationt   UnknownWebPath(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   }  s    	$c         C   s   |  j    }  y |  j d  \ } } Wn t k
 r? t |   SXy  t | d t j j |  SWn" t k
 r } | | _ |  n Xd S(   s  
        Parses a line from the :term:`versions store`.

        .. note::

            Use this method only when speed is of the utmost
            importance.  You should prefer to directly create a deployment
            with only a ``location`` when possible.
        R   R%   N(	   R#   R   t
   ValueErrort   ProductionCopyR    R   R   R    R   (   R(   R   t	   deploydirR*   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s     	N(&   t   __name__t
   __module__t   __doc__R7   R   RL   RM   RO   t   FalseRR   RV   Ra   Ri   Rx   R{   RC   R   R|   t   propertyRy   R   R   R   R   R   R   R   R   R   R   R   R%   RN   R   R:   R   t   staticmethodR   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR      s@   
		
					
		R   c           B   sh   e  Z d  Z e d    Z e d    Z e d    Z e d    Z d   Z d   Z	 d d  Z RS(	   s   
    Represents the production copy of a deployment.  This copy
    is canonical, and is the only one guaranteed to be accessible
    via web, have a database, etc.
    c         C   s   |  j  j |  | |  S(   sW   
        Performs an upgrade of database schemas and other non-versioned data.
        (   R   t   upgrade(   R@   R%   t   options(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    c      	   C   s  t  j j |  j  sZ y t  j |  j  WqZ t k
 rV } | j t j k rP qW   qZ Xn  t j	   } y |  j
 j |  | |  Wn$ t j k
 r t j |    n Xd } t j t  j j |  j d    x t |  j  d t j j   j d  } t  j j |  j |  } t  j j |  rEt j d  t j d  q n  y t j | |  Wn/ y t j |  Wn t k
 rn X  n XPq WWd QX| S(   sU   
        Performs a backup of database schemas and other non-versioned data.
        t   lockR   s   %Y-%m-%dT%H%M%SsI   Backup: A backup occurred in the last second. Trying again in a second...i   N(   R   R   t   existsR   t   mkdirt   OSErrort   errnot   EEXISTt   tempfilet   mkdtempR   t   backupR    t   BackupFailuret   shutilt   rmtreeR7   R   t   LockDirectoryRQ   R   R%   t   datetimet   todayt   strftimeR!   R"   t   timet   sleept   move(   R@   R   R*   t   tmpdirR   t   outdir(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s@    
")c         C   s(   |  j  j |  t j j |  j |  |  S(   s)  
        Restores a backup. Destroys state, so be careful! Also, this does
        NOT restore the file-level backup, which is what 'wizard restore'
        does, so you probably do NOT want to call this elsewhere unless
        you know what you're doing (call 'wizard restore' instead).
        (   R   t   restoreR   R   RQ   R   (   R@   R   R   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    c         C   s   |  j  j |  |  d S(   sv   
        Deletes all non-local or non-filesystem data (such as databases) that
        this application uses.
        N(   R   t   remove(   R@   R   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    c         C   s   |  j  j |   s t  n  d S(   sO   
        Checks if the autoinstall has a properly configured database.
        N(   R   t   checkDatabaset   DatabaseVerificationError(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   verifyDatabase  s    c         C   sO   xH t  rJ |  j j |   sF y |  j   WqG t k
 rB t  qG Xq Pq Wd S(   s   
        Checks if the autoinstall is viewable from the web.  If you do not run
        this, there is no guarantee that the url returned by this application
        is the correct one.
        N(   RY   R   t   checkWebR   R   t   WebVerificationError(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt	   verifyWeb  s    	c         C   s"   t  j |  j j |  j j | |  S(   s9   
        Performs a HTTP request on the website.
        (   R   t   fetchR:   t   netlocR   (   R@   R   t   post(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    N(   R   R   R   RC   R   R   R   R   R   R   R7   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s   +			t   WorkingCopyc           B   sJ   e  Z d  Z e d    Z e d    Z e d    Z e d    Z RS(   s   
    Represents a temporary clone of a deployment that we can make
    modifications to without fear of interfering with a production
    deployment.  More operations are permitted on these copies.
    c         C   s   |  j  j |  |  S(   s   
        Edits files in ``dir`` to replace WIZARD_* variables with literal
        instances based on ``deployment``.  This is used for constructing
        virtual merge bases, and as such ``deployment`` will generally not
        equal ``self``.
        (   R   t   parametrize(   R@   t
   deployment(    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    c         C   s   |  j  j |   S(   s   
        Edits files in the deployment such that any user-specific configuration
        is replaced with generic WIZARD_* variables.
        (   R   t   prepareConfig(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    c         C   s   |  j  j |   S(   s   
        Resolves conflicted files in this working copy.  Returns whether or
        not all conflicted files were resolved or not.  Fully resolved
        files are added to the index, but no commit is made.
        (   R   t   resolveConflicts(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    c         C   s   |  j  j |   S(   s   
        Performs various edits to files in the current working directory in
        order to make a merge go more smoothly.  This is usually
        used to fix botched line-endings.
        (   R   t   prepareMerge(   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    (   R   R   R   RC   R   R   R   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s
   	R    c           B   s   e  Z d  Z RS(   s    Base error class for this module(   R   R   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR    *  s   R\   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   s`   
    The deployment contains a .scripts-version file, but no .git
    or .wizard directory.
    c         C   s   | |  _  d  S(   N(   R9   (   R@   R9   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL   6  s    c         C   s   d S(   Ns"   This installation was not migrated(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   __str__8  s    N(   R   R   R   R7   R9   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR\   /  s   	R[   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   sC   The deployment contained a .git directory but no .wizard directory.c         C   s   | |  _  d  S(   N(   R9   (   R@   R9   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL   ?  s    c         C   s   d S(   Ns   

ERROR: Directory contains a .git directory, but not
a .wizard directory.  If this is not a corrupt
migration, this means that the user was versioning their
install using Git.(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   A  s    N(   R   R   R   R7   R9   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR[   ;  s   	Rz   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   s0   The install was missing essential configuration.c         C   s   | |  _  d  S(   N(   R9   (   R@   R9   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL   M  s    c         C   s   d S(   Nsh   

ERROR: The install was well-formed, but not configured
(essential configuration files were not found.)(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   O  s    N(   R   R   R   R7   R9   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRz   I  s   	RZ   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   sF   The install was missing a .git directory, but had a .wizard directory.c         C   s   | |  _  d  S(   N(   R9   (   R@   R9   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL   Y  s    c         C   s   d S(   NsJ   

ERROR: Directory contains a .wizard directory,
but not a .git directory.(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   [  s    N(   R   R   R   R7   R9   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRZ   U  s   	R]   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   s"   Application is not an autoinstall.c         C   s   | |  _  d  S(   N(   R9   (   R@   R9   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL   e  s    c         C   s   d |  j  S(   Ns   

ERROR: The directory

    %s

does not appear to be an autoinstall.  If you are in a
subdirectory of an autoinstall, you need to use the root
directory for the autoinstall.(   R9   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   g  s    	N(   R   R   R   R7   R9   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR]   a  s   	Rf   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   sM   Deployment has a tag that does not have an equivalent in upstream repository.c         C   s   | |  _  d  S(   N(   Rj   (   R@   Rj   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL   v  s    c         C   s   d |  j  S(   Ns-   

ERROR: Could not find tag %s in repository.(   Rj   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR   x  s    N(   R   R   R   R7   Rj   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRf   r  s   	Rn   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   s'   Could not find tag in local repository.c         C   s   | |  _  d  S(   N(   Rj   (   R@   Rj   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL     s    c         C   s   d |  j  S(   Ns3   

ERROR: Could not find tag %s in local repository.(   Rj   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    N(   R   R   R   R7   Rj   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRn   }  s   	Rs   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   sF   Pristine tag commit ID does not match upstream pristine tag commit ID.c         C   s   | |  _  d  S(   N(   Rj   (   R@   Rj   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL     s    c         C   s   d |  j  S(   Nsk   

ERROR: Local pristine tag %s did not match repository's.  This
probably means an upstream rebase occured.(   Rj   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    N(   R   R   R   R7   Rj   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRs     s   	Rt   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   sB   Wizard tag commit ID does not match upstream wizard tag commit ID.c         C   s   | |  _  d  S(   N(   Rj   (   R@   Rj   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL     s    c         C   s   d |  j  S(   Ns   

ERROR: Local wizard tag %s did not match repository's.  This
probably means an upstream rebase occurred.  Try
'git fetch --tags && wizard remaster'.(   Rj   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    N(   R   R   R   R7   Rj   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRt     s   	Ru   c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   s   HEAD is not connected to tag.c         C   s   | |  _  d  S(   N(   Rj   (   R@   Rj   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL     s    c         C   s   d |  j  S(   Ns   

ERROR: HEAD is not a descendant of %s.  This probably
means that an upstream rebase occurred, and new tags were
pulled, but local user commits were never rebased.  Try
running 'wizard remaster'.(   Rj   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    N(   R   R   R   R7   Rj   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRu     s   	R   c           B   s   e  Z d  Z d   Z RS(   s-   Could not detect real version of application.c         C   s   d S(   Ns>   

ERROR: Could not detect the real version of the application.(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    (   R   R   R   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s   R~   c           B   s,   e  Z d  Z d Z d Z d   Z d   Z RS(   s;   Git version of application does not match detected version.c         C   s   | |  _  | |  _ d  S(   N(   t   real_versiont   git_version(   R@   R   R   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyRL     s    	c         C   s   d |  j  |  j f S(   NsB   

ERROR: The detected version %s did not match the Git
version %s.(   R   R   (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    N(   R   R   R   R7   R   R   RL   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR~     s
   	R   c           B   s   e  Z d  Z d   Z RS(   s+   Could not access the application on the webc         C   s   d S(   Ns   

ERROR: We were not able to access the application on the
web.  This may indicate that the website is behind
authentication on the htaccess level.  You can find
the contents of the page from the debug backtraces.(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    (   R   R   R   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s   R   c           B   s   e  Z d  Z d   Z RS(   s   Could not access the databasec         C   s   d S(   Ns   

ERROR: We were not able to access the database for
this application; this probably means that your database
configuration is misconfigured.(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    (   R   R   R   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s   R   c           B   s   e  Z d  Z d   Z RS(   s+   Could not determine application's web path.c         C   s   d S(   Ns   

ERROR: We were not able to determine what the application's
host and path were in order to perform a web request
on the application.  You can specify this manually using
the WIZARD_WEB_HOST and WIZARD_WEB_PATH environment
variables.(    (   R@   (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s    (   R   R   R   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyR     s   (/   R   t   os.pathR   R
   R!   t	   decoratorR   R   R   t	   tracebackR   R   R2   R0   t   wizardR    R   R   R   R   R   R7   R   R   R+   R>   RC   t   objectR   R   R   R    R\   R[   Rz   RZ   R]   Rf   Rn   Rs   Rt   Ru   R   R~   R   R   R   (    (    (    s;   /afs/athena.mit.edu/contrib/scripts/wizard/wizard/deploy.pyt   <module>   sL   .*(	 "a)
	