
    w	                         S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKJr  SSK	J
r
  SSK	Jr  S	 rS
 rS rS r " S S5      rg)z5Extra utility functions for OS Config Troubleshooter.    )absolute_import)division)unicode_literalsN)base)log)
propertiesc                     U[         R                  R                  :w  a  U R                  SUR                  5        SR                  SS/U -   5      $ )zGets the command string for the user to invoke.

Args:
  args: the command args. These should be arguments put after 'gcloud'.
  release_track: The release track.

Returns:
  The command string, formatted as '$ gcloud [args]'.
r    $gcloud)r   ReleaseTrackGAinsertprefixjoin)argsrelease_tracks     Flib/googlecloudsdk/command_lib/compute/os_config/troubleshoot/utils.pyGetCommandStringr      sD     d''***KK=''(	3/D(	))    c                     [         R                  " 5       [        R                  :H  nS[	        U 5      R
                  -   S-   nU(       a&  USR                  [        R                  " SS95      -  nU$ )Nz'Unknown
The troubleshooter encountered z while checking your instance.z
{}
r   )limit)	r   GetVerbosityloggingDEBUGtype__name__format	traceback
format_exc)	exceptiondebug_verbositymessages      r   UnknownMessager$   ,   si    $$&'--7/(*.y/*B*BCF   

 xy33!<==G	.r   c           
          U R                  U R                  R                  SU R                  R	                  U=(       d1    [
        R                  R                  R                  R                  SS9S94/5      S   $ )NGetT)required)projectr   )
MakeRequestsapitools_clientprojectsmessagesComputeProjectsGetRequestr   VALUEScorer(   r&   )clientr(   s     r   
GetProjectr1   8   s    			''11 >""**...= 	2 	@A B
C DE	
F Fr   c                     U R                   R                  " S0 UR                  5       D6nU R                  U R                  R
                  SU4/5      S   $ )Nr&   r    )r,   ComputeInstancesGetRequestAsDictr)   r*   	instances)r0   instance_refrequests      r   GetInstancer9   @   s]    OO66 '			''8: 
;;<
> >r   c                       \ rS rSrSrS rSrg)ResponseG   zBRepresents a response returned by each of the prerequisite checks.c                     Xl         X l        g )Ncontinue_flagresponse_message)selfr?   r@   s      r   __init__Response.__init__J   s    &,r   r>   N)r   
__module____qualname____firstlineno____doc__rB   __static_attributes__r3   r   r   r;   r;   G   s
    J-r   r;   )rG   
__future__r   r   r   r   r   googlecloudsdk.callioper   googlecloudsdk.corer   r   r   r$   r1   r9   r;   r3   r   r   <module>rL      sA    < &  '   ( # **	F>- -r   