MCPcopy Create free account
hub / github.com/apache/mesos / add

Method add

src/tests/containerizer/rootfs.cpp:48–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47
48Try<Nothing> Rootfs::add(const string& path)
49{
50 Option<string> source = None();
51
52 // If we are copying a symlink, follow it and copy the
53 // target instead. While this is a little inefficient on
54 // disk space, it avoids complexity in dealing with chains
55 // of symlinks and symlinks in intermediate path components.
56 if (os::stat::islink(path)) {
57 Result<string> target = os::realpath(path);
58 if (target.isNone()) {
59 return Error("Failed to resolve '" + path + "'");
60 }
61
62 if (target.isError()) {
63 return Error("Failed to resolve '" + path + "': " + target.error());
64 }
65
66 source = target.get();
67 }
68
69 Try<Nothing> copy = copyPath(source.isSome() ? source.get() : path, path);
70 if (copy.isError()) {
71 return Error("Failed to copy '" + path + "' to rootfs: " + copy.error());
72 }
73
74 return Nothing();
75}
76
77
78Try<Nothing> Rootfs::copyPath(const string& source, const string& destination)

Callers 8

foreachkeyFunction · 0.45
TESTFunction · 0.45
TYPED_TESTFunction · 0.45
foreachFunction · 0.45
TESTFunction · 0.45
TEST_FFunction · 0.45
foreachFunction · 0.45
executeMethod · 0.45

Calls 10

NoneClass · 0.85
NothingClass · 0.85
errorMethod · 0.65
islinkFunction · 0.50
realpathFunction · 0.50
ErrorFunction · 0.50
isNoneMethod · 0.45
isErrorMethod · 0.45
getMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected