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

Function main

src/examples/test_csi_plugin.cpp:2026–2140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2024
2025
2026int main(int argc, char** argv)
2027{
2028 Flags flags;
2029 Try<flags::Warnings> load = flags.load("CSI_", argc, argv);
2030
2031 if (flags.help) {
2032 cout << flags.usage() << endl;
2033 return EXIT_SUCCESS;
2034 }
2035
2036 if (load.isError()) {
2037 cerr << flags.usage(load.error()) << endl;
2038 return EXIT_FAILURE;
2039 }
2040
2041 mesos::internal::logging::initialize(argv[0], true, flags);
2042
2043 // Log any flag warnings.
2044 foreach (const flags::Warning& warning, load->warnings) {
2045 LOG(WARNING) << warning.message;
2046 }
2047
2048 Try<Nothing> mkdir = os::mkdir(flags.work_dir);
2049 if (mkdir.isError()) {
2050 cerr << "Failed to create working directory '" << flags.work_dir
2051 << "': " << mkdir.error() << endl;
2052 return EXIT_FAILURE;
2053 }
2054
2055 hashmap<string, string> createParameters;
2056
2057 if (flags.create_parameters.isSome()) {
2058 foreachpair (const string& param,
2059 const vector<string>& values,
2060 strings::pairs(flags.create_parameters.get(), ";", "=")) {
2061 if (values.size() != 1) {
2062 cerr << "Parameter key '" << param << "' is not unique" << endl;
2063 return EXIT_FAILURE;
2064 }
2065
2066 createParameters.put(param, values[0]);
2067 }
2068 }
2069
2070 hashmap<string, string> volumeMetadata;
2071
2072 if (flags.volume_metadata.isSome()) {
2073 foreachpair (const string& prop,
2074 const vector<string>& values,
2075 strings::pairs(flags.volume_metadata.get(), ";", "=")) {
2076 if (values.size() != 1) {
2077 cerr << "Metadata key '" << prop << "' is not unique" << endl;
2078 return EXIT_FAILURE;
2079 }
2080
2081 volumeMetadata.put(prop, values[0]);
2082 }
2083 }

Callers

nothing calls this directly

Calls 11

errorMethod · 0.65
runMethod · 0.65
initializeFunction · 0.50
mkdirFunction · 0.50
removeFunction · 0.50
existsFunction · 0.50
loadMethod · 0.45
usageMethod · 0.45
isErrorMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected