parameters: ()
docstring: Command line interface for module.
docstring_summary: Command line interface for module.
docstring_tokens: Command line interface for module .
function: def main():
      """Command line interface for module."""
      parser = argparse.ArgumentParser(
          description=__doc__,
          formatter_class=argparse.RawDescriptionHelpFormatter)
      parser.add_argument("-c",
                          "--custom-metadata-keys",
                          type=str,
                          nargs="+",
                          help="VM custom metadata to add to machine ClassAd")
      parser.add_argument("--protocol",
                          type=str,
                          dest="scheme",
                          default="http",
                          help="Protocol for instance metadata host")
      parser.add_argument("--host",
                          type=str,
                          default="metadata.google.internal",
                          help="VM instance metadata server name")
      parser.add_argument("--path",
                          type=str,
                          default="/computeMetadata/v1/",
                          help="VM instance metadata URL path")
      parser.add_argument(
          "--no-short-id",
          action='store_true',
          help="Disable advertising short resource IDs in favor of long names")
      args = parser.parse_args()
  
      try:
          metadata = query_google_cloud_metadata(scheme=args.scheme,
                                                 host=args.host,
                                                 path=args.path)
      except Exception as err:
          # But, for now, we don't really care about the why of failure
          raise SystemExit("Metadata server did not return valid JSON!") from err
  
      classad = convert_metadata_to_classad(
          metadata,
          use_short_id=not args.no_short_id,
          custom_metadata_keys=args.custom_metadata_keys)
  
      for attr, val in classad.items():
          print(f"{attr}={val}")
      print("- update:true")
function_tokens: def main ( ) : parser = argparse . ArgumentParser ( description = __doc__ , formatter_class = argparse . RawDescriptionHelpFormatter ) parser . add_argument ( "-c" , "--custom-metadata-keys" , type = str , nargs = "+" , help = "VM custom metadata to add to machine ClassAd" ) parser . add_argument ( "--protocol" , type = str , dest = "scheme" , default = "http" , help = "Protocol for instance metadata host" ) parser . add_argument ( "--host" , type = str , default = "metadata.google.internal" , help = "VM instance metadata server name" ) parser . add_argument ( "--path" , type = str , default = "/computeMetadata/v1/" , help = "VM instance metadata URL path" ) parser . add_argument ( "--no-short-id" , action = 'store_true' , help = "Disable advertising short resource IDs in favor of long names" ) args = parser . parse_args ( ) try : metadata = query_google_cloud_metadata ( scheme = args . scheme , host = args . host , path = args . path ) except Exception as err : # But, for now, we don't really care about the why of failure raise SystemExit ( "Metadata server did not return valid JSON!" ) from err classad = convert_metadata_to_classad ( metadata , use_short_id = not args . no_short_id , custom_metadata_keys = args . custom_metadata_keys ) for attr , val in classad . items ( ) : print ( f"{attr}={val}" ) print ( "- update:true" )