nodes: 0, module; 1, function_definition; 2, function_name:list_snapshots; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, identifier:config_path; 16, identifier:_DEFAULT_CONFIG_PATH; 17, identifier:sort_by_time; 18, False; 19, string; 20, call; 21, assignment; 22, identifier:sort_by_time; 23, block; 24, else_clause; 25, assignment; 26, assignment; 27, call; 28, identifier:ret; 29, string_content:Get a list of all the existing snapshots.
  
      :param str config_path: The path to the configuration file for the aptly instance.
      :param bool sort_by_time: Whether to sort by creation time instead of by name.
  
      :return: A list of the snapshot names.
      :rtype: list
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' aptly.list_snapshots; 30, identifier:_validate_config; 31, argument_list; 32, identifier:cmd; 33, list; 34, expression_statement; 35, block; 36, identifier:cmd_ret; 37, call; 38, identifier:ret; 39, list_comprehension; 40, attribute; 41, argument_list; 42, identifier:config_path; 43, string; 44, string; 45, call; 46, string; 47, call; 48, expression_statement; 49, identifier:_cmd_run; 50, argument_list; 51, call; 52, for_in_clause; 53, identifier:log; 54, identifier:debug; 55, string; 56, call; 57, string_content:snapshot; 58, string_content:list; 59, attribute; 60, argument_list; 61, string_content:-raw=true; 62, attribute; 63, argument_list; 64, call; 65, identifier:cmd; 66, attribute; 67, argument_list; 68, identifier:line; 69, call; 70, string_content:Found snapshots: %s; 71, identifier:len; 72, argument_list; 73, string; 74, identifier:format; 75, identifier:config_path; 76, identifier:cmd; 77, identifier:append; 78, string; 79, attribute; 80, argument_list; 81, identifier:line; 82, identifier:strip; 83, attribute; 84, argument_list; 85, identifier:ret; 86, string_content:-config={}; 87, string_content:-sort=time; 88, identifier:cmd; 89, identifier:append; 90, string; 91, identifier:cmd_ret; 92, identifier:splitlines; 93, string_content:-sort=name
code: def list_snapshots(config_path=_DEFAULT_CONFIG_PATH, sort_by_time=False):
      '''
      Get a list of all the existing snapshots.
  
      :param str config_path: The path to the configuration file for the aptly instance.
      :param bool sort_by_time: Whether to sort by creation time instead of by name.
  
      :return: A list of the snapshot names.
      :rtype: list
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' aptly.list_snapshots
      '''
      _validate_config(config_path)
  
      cmd = ['snapshot', 'list', '-config={}'.format(config_path), '-raw=true']
  
      if sort_by_time:
          cmd.append('-sort=time')
      else:
          cmd.append('-sort=name')
  
      cmd_ret = _cmd_run(cmd)
      ret = [line.strip() for line in cmd_ret.splitlines()]
  
      log.debug('Found snapshots: %s', len(ret))
      return ret