
    #                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  \R                  " \R                  R                  5       " S	 S
\R                   5      5       rSSSS.\l        \R                  " \R                  R&                  5       " S S\R                   5      5       rSSSS.\l        g)z9Command for troubleshooting problems with the VM Manager.    )absolute_import)division)unicode_literals)base_classes)base)flags)troubleshooterc                   4    \ rS rSrSrS r\S 5       rS rSr	g)Troubleshoot   zTroubleshoot VM Manager issues.c                     UR                   n[        R                  R                  UU[        R                  " U5      S9nU$ zResolves the arguments into an instance.

Args:
  holder: the api holder
  compute_client: the compute client
  args: The command line arguments.

Returns:
  An instance reference to a VM.
)scope_lister	resourcesr   INSTANCE_ARGResolveAsResourceGetInstanceZoneScopeListerselfholdercompute_clientargsr   instance_refs         -lib/surface/compute/os_config/troubleshoot.py_ResolveInstanceTroubleshoot._ResolveInstance   G       I%%7755nE 8 GL     c                 B    [         R                  R                  U 5        g N)r   r   AddArgumentparsers    r   ArgsTroubleshoot.Args1   s    	""6*r   c                     [         R                  " U R                  5       5      nUR                  nU R	                  X#U5      n[
        R                  " UUU R                  5       5        g r!   )r   ComputeApiHolderReleaseTrackclientr   r	   r   r   r   r   r   r   s        r   RunTroubleshoot.Run5   sZ    **4+<+<+>?F]]N((FL , $ 1 1 35 r    N
__name__
__module____qualname____firstlineno____doc__r   staticmethodr%   r,   __static_attributes__r.   r   r   r   r      s#    '$ + +r   r   zKTroubleshoot issues with the setup of VM Manager on a specified VM instancea  
    *{command}* troubleshoots issues with the setup of VM Manager on a specified
    VM instance

    The troubleshoot command investigates the following settings or configurations for your VM Manager setup:

    - Checks if the OS Config API is enabled in the project.
    - Checks if the required metadata is set up correctly in the VM instance.
    - Checks if the latest version of the OS Config agent is running on the VM instance.
    - Checks if a service account is attached to the VM instance.
    - Checks if the VM Manager service agent is enabled.
    - Checks if the VM instance has a public IP or Private Google Access.
    z
    To troubleshoot an instance named `my-instance` in zone `us-west1-a`, run

        $ {command} my-instance --zone=us-west1-a
    )briefDESCRIPTIONEXAMPLESc                   4    \ rS rSrSrS r\S 5       rS rSr	g)TroubleshootAlphaX   z'(ALPHA) Troubleshoot VM Manager issues.c                     UR                   n[        R                  R                  UU[        R                  " U5      S9nU$ r   r   r   s         r   r   "TroubleshootAlpha._ResolveInstance\   r   r   c                 f    [         R                  R                  U 5        U R                  SSSSS9  g )Nz--enable-log-analysisF
store_truezEnable the checking of audit logs created by Cloud Logging. The troubleshooter checks the VM's Cloud Logging logs and serial log output for errors, provides you with the analysis data, and allows you to download the logs.)requiredactionhelp)r   r   r"   add_argumentr#   s    r   r%   TroubleshootAlpha.Argsn   s7    	""6*
/!&+?	  	r   c                     [         R                  " U R                  5       5      nUR                  nU R	                  X#U5      n[
        R                  " UUU R                  5       UR                  S9  g )N)analyze_logs)r   r(   r)   r*   r   r	   r   enable_log_analysisr+   s        r   r,   TroubleshootAlpha.Run|   sd    **4+<+<+>?F]]N((FL , $ 1 1 3-1-E-EG r   r.   Nr/   r.   r   r   r;   r;   X   s#    /$  	r   r;   a  
    *{command}* troubleshoots issues with the setup of VM Manager on a specified
    VM instance

    The troubleshoot command investigates the following settings or configurations for your VM Manager setup:

    - Checks if the OS Config API is enabled in the project.

    - Checks if the required metadata is set up correctly in the VM instance.

    - Checks if the latest version of the OS Config agent is running on the VM instance.

    - Checks if a service account is attached to the VM instance.

    - Checks if the VM Manager service agent is enabled.

    - Checks if the VM instance has a public IP or Private Google Access.
    a  
    To troubleshoot an instance named `my-instance` in zone `us-west1-a`, run

        $ {command} my-instance --zone=us-west1-a

    To troubleshoot the same instance in the same zone with log analysis, run

        $ {command} my-instance --zone=us-west1-a --enable-log-analysis
    N)r4   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   ,googlecloudsdk.command_lib.compute.instancesr   ,googlecloudsdk.command_lib.compute.os_configr	   ReleaseTracksr)   GACommandr   detailed_helpALPHAr;   r.   r   r   <module>rT      s    @ &  ' 7 ( > G D%%(()!4<< ! *!J		# 2 D%%++,, , -,`		##  r   