
    v                     p    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  S	rS
rS rS rg)zGUtility function for OS Config Troubleshooter to check agent freshness.    )absolute_import)division)unicode_literals)
exceptions)apis)base)utilsosconfigzUnknown
The version of OS Config agent running on this instance is unknown. Visit https://cloud.google.com/compute/docs/manage-os#check-install on how to check if the agent is installed and running.c                 F    U [         R                  R                  :X  a  S$ S$ )Nv1alphav1)r   ReleaseTrackALPHA)release_tracks    Plib/googlecloudsdk/command_lib/compute/os_config/troubleshoot/agent_freshness.py_GetReleaseTrackr   "   s     #t'8'8'>'>>HDH    c                    SnSn[         R                  " [        [        U5      5      nUR                  nSR                  U R                  X!R                  5      nSn	 UR                  UR                  R                  UUR                  R                  R                  R                  S95      n	U	R&                  R(                  (       d  U[        -  n[        R                   " XE5      $ SnU	R&                  R(                   H@  nUR*                  nUR-                  S5      (       d  M'  UR/                  S5      S:w  d  M>  S	n  O   U(       d  US
-  n[        R                   " XE5      $ U	R&                  R(                   HY  nUR*                  nUR-                  S5      (       d  M'  UR/                  S5      S:w  d  M>  US-  n[        R                   " XE5      s  $    S	nUS-  n[        R                   " XE5      $ ! [        R                   a"    U[        -  n[        R                   " XE5      s $ [        R"                   a9  n
U[        R$                  " U
5      -  n[        R                   " XE5      s Sn
A
$ Sn
A
ff = f)z1Checks whether the OS Config agent is up to date.Fz%> Is the OS Config agent up to date? z/projects/{}/locations/{}/instances/{}/inventoryN)nameviewinstalledPackagezgoogle-osconfig-agentTzNo
The OS Config agent is not installed on this VM. See https://cloud.google.com/compute/docs/manage-os#agent-install on how to install the agent.availablePackagezNo
The version of OS Config agent running on this VM instance is not the latest version. See https://cloud.google.com/compute/docs/manage-os/upgrade-vm-manager#update-agent on how to update the agent.Yes)r   GetClientInstance_API_CLIENT_NAMEr   (projects_locations_instances_inventoriesformatr   GetMESSAGES_MODULE7OsconfigProjectsLocationsInstancesInventoriesGetRequestViewValueValuesEnumFULLr   HttpNotFoundError_UNKNOWN_MESSAGEr	   ResponseHttpForbiddenErrorUnknownMessageitemsadditionalPropertieskey
startswithfind)projectinstancezoner   continue_flagresponse_messageclientinventory_servicer   	inventoryeinstalled_flagitemr+   s                 r   Checkr9   &   s2   -<!!"2"2="AC&EE	:	A	AllD--
)$);!%%	@	@''DD  	 
A 
'(I 
	-	-((>>-:: .oo22d
((C
~~  #)@ AR Gn 3 
	'
 >>-:: oo22d
((C
~~  #)@ AR G) ^^M<< 3 -e		88[ 
	%	% ;((>>-::		&	& ;,,Q//>>-::;s%   AG7 73I8,I8?.I3-I83I8N)__doc__
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   9googlecloudsdk.command_lib.compute.os_config.troubleshootr	   r   r%   r   r9    r   r   <module>rA      s<    N &  ' ' , ( K = IA9r   