grr/test_lib/vfs_test_lib.py
def CreateDirectory(client_path, token=None):
  """Creates a directory in datastore-agnostic way.

  Args:
    client_path: A `ClientPath` instance specifying location of the file.
    token: A GRR token for accessing the data store.
  """
  precondition.AssertType(client_path, db.ClientPath)

  stat_entry = rdf_client_fs.StatEntry(
      pathspec=rdf_paths.PathSpec(
          pathtype=client_path.path_type,
          path="/".join(client_path.components)),
      st_mode=16895)

  if data_store.RelationalDBWriteEnabled():

    path_info = rdf_objects.PathInfo()
    path_info.path_type = client_path.path_type
    path_info.components = client_path.components
    path_info.stat_entry = stat_entry

    data_store.REL_DB.WritePathInfos(client_path.client_id, [path_info])

  urn = aff4.ROOT_URN.Add(client_path.client_id).Add(client_path.vfs_path)
  with aff4.FACTORY.Create(
      urn, aff4_standard.VFSDirectory, token=token) as filedesc:
    filedesc.Set(filedesc.Schema.STAT, stat_entry)
    filedesc.Set(filedesc.Schema.PATHSPEC, stat_entry.pathspec)
Creates a directory in datastore-agnostic way.

  Args:
    client_path: A `ClientPath` instance specifying location of the file.
    token: A GRR token for accessing the data store.
  
Creates a directory in datastore-agnostic way.
Creates a directory in datastore - agnostic way .
def CreateDirectory(client_path, token=None):
  precondition.AssertType(client_path, db.ClientPath)
  stat_entry = rdf_client_fs.StatEntry(
      pathspec=rdf_paths.PathSpec(
          pathtype=client_path.path_type,
          path="/".join(client_path.components)),
      st_mode=16895)
  if data_store.RelationalDBWriteEnabled():
    path_info = rdf_objects.PathInfo()
    path_info.path_type = client_path.path_type
    path_info.components = client_path.components
    path_info.stat_entry = stat_entry
    data_store.REL_DB.WritePathInfos(client_path.client_id, [path_info])
  urn = aff4.ROOT_URN.Add(client_path.client_id).Add(client_path.vfs_path)
  with aff4.FACTORY.Create(
      urn, aff4_standard.VFSDirectory, token=token) as filedesc:
    filedesc.Set(filedesc.Schema.STAT, stat_entry)
    filedesc.Set(filedesc.Schema.PATHSPEC, stat_entry.pathspec)
def CreateDirectory ( client_path , token = None ) : precondition . AssertType ( client_path , db . ClientPath ) stat_entry = rdf_client_fs . StatEntry ( pathspec = rdf_paths . PathSpec ( pathtype = client_path . path_type , path = "/" . join ( client_path . components ) ) , st_mode = 16895 ) if data_store . RelationalDBWriteEnabled ( ) : path_info = rdf_objects . PathInfo ( ) path_info . path_type = client_path . path_type path_info . components = client_path . components path_info . stat_entry = stat_entry data_store . REL_DB . WritePathInfos ( client_path . client_id , [ path_info ] ) urn = aff4 . ROOT_URN . Add ( client_path . client_id ) . Add ( client_path . vfs_path ) with aff4 . FACTORY . Create ( urn , aff4_standard . VFSDirectory , token = token ) as filedesc : filedesc . Set ( filedesc . Schema . STAT , stat_entry ) filedesc . Set ( filedesc . Schema . PATHSPEC , stat_entry . pathspec )
Creates a directory in datastore-agnostic way.
Creates a directory in datastore - agnostic way .
"""Creates a directory in datastore-agnostic way.

  Args:
    client_path: A `ClientPath` instance specifying location of the file.
    token: A GRR token for accessing the data store.
  """
client_path
A `ClientPath` instance specifying location of the file.
A ` ClientPath ` instance specifying location of the file .
token
A GRR token for accessing the data store.
A GRR token for accessing the data store .