
    L                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddZy)z/Main function for the OS Config Troubleshooter.    )absolute_import)division)unicode_literals)
exceptions)agent_freshness)log_analysis)metadata_setup)network_config)service_account)service_enablement)utils)logc                    t        j                  d       t        j                  ||      }t        j                  |j                         |j
                  syd}d}d}	 t        j                  | |j                        }t        j                  | |      }t        j                  ||||      }	t        j                  |	j                         |	j
                  syt        j                  |||j                  |      }
t        j                  |
j                         |
j
                  syt        j                   |      }t        j                  |j                         |j
                  syt        j"                  |      }t        j                  |j                         |j
                  syt%        j                  | |      }t        j                  |j                         |j
                  sy|rlt         j&                  j                          t)        j*                  ||       t)        j,                  | |||j                         t        j                  d       yy# t        j                  $ r}|}Y d}~d}~ww xY w)z5Main troubleshoot function for testing prerequisites.znOS Config troubleshooter tool is checking if there are issues with the VM Manager setup for this VM instance.
Nz
Log analysis finished.)r   Printr   Checkresponse_messagecontinue_flagr   
GetProjectprojectGetInstanceapitools_exceptions	HttpErrorr	   r   zoner   CheckExistenceCheckEnablementr
   statusr   CheckCloudLogsCheckSerialLogOutput)clientinstance_refrelease_trackanalyze_logsservice_enablement_response	exceptionr   instanceemetadata_setup_responseagent_freshness_response"service_account_existence_response#service_account_enablement_responsenetwork_config_responses                 Blib/googlecloudsdk/command_lib/compute/os_config/troubleshooter.pyTroubleshootr-       s   ))AC
 !3 8 8M!#))'889	$	2	2
)'(v|';';<G  6H
 +00(1>	K))#445	 	.	.
 -227H3?3D3D3@B ))$556	!	/	/
 (7'E'Eh'O$)).??@	+	9	9
 )8(G(G(P%))/@@A	,	:	:
 +00B))#445	 	.	.
 JJ2%%fgx&2&7&79II() U 
	&	& Is   6I I:-I55I:N)F)__doc__
__future__r   r   r   apitools.base.pyr   r   9googlecloudsdk.command_lib.compute.os_config.troubleshootr   r   r	   r
   r   r   r   googlecloudsdk.corer   r-        r,   <module>r5      s4    6 &  ' > U R T T U X K #C*r4   