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

Method CreateSlaveFlags

src/tests/mesos.cpp:161–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159
160
161slave::Flags MesosTest::CreateSlaveFlags()
162{
163 slave::Flags flags;
164
165 // Create a temporary work directory (removed by Environment).
166 Try<string> workDir = environment->mkdtemp();
167 CHECK_SOME(workDir) << "Failed to create temporary directory";
168 flags.work_dir = workDir.get();
169
170 // Create a temporary runtime directory (removed by Environment).
171 Try<string> runtimeDir = environment->mkdtemp();
172 CHECK_SOME(runtimeDir) << "Failed to create temporary directory";
173 flags.runtime_dir = runtimeDir.get();
174
175 Try<string> agentDir = os::mkdtemp(path::join(sandbox.get(), "XXXXXX"));
176 CHECK_SOME(agentDir) << "Failed to create temporary directory";
177
178 flags.fetcher_cache_dir = path::join(agentDir.get(), "fetch");
179
180 flags.launcher_dir = getLauncherDir();
181
182 flags.appc_store_dir = path::join(agentDir.get(), "store", "appc");
183
184 flags.docker_store_dir = path::join(agentDir.get(), "store", "docker");
185
186 flags.frameworks_home = path::join(agentDir.get(), "frameworks");
187
188 {
189 // Create a default credential file for master/agent authentication.
190 const string& path = path::join(agentDir.get(), "credential");
191
192 Try<int_fd> fd = os::open(
193 path,
194 O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
195 S_IRUSR | S_IWUSR | S_IRGRP);
196
197 CHECK_SOME(fd);
198
199 Credential credential;
200 credential.set_principal(DEFAULT_CREDENTIAL.principal());
201 credential.set_secret(DEFAULT_CREDENTIAL.secret());
202
203 CHECK_SOME(os::write(fd.get(), stringify(JSON::protobuf(credential))))
204 << "Failed to write agent credential to '" << path << "'";
205
206 CHECK_SOME(os::close(fd.get()));
207
208 flags.credential = path;
209
210 // Set default (permissive) ACLs.
211 flags.acls = ACLs();
212 }
213
214 flags.authenticate_http_readonly = true;
215 flags.authenticate_http_readwrite = true;
216
217#ifdef USE_SSL_SOCKET
218 // Executor authentication currently has SSL as a dependency, so we

Callers 6

TEST_PFunction · 0.45
TEST_FFunction · 0.45
TYPED_TESTFunction · 0.45
foreachFunction · 0.45
TEST_FFunction · 0.45

Calls 15

getLauncherDirFunction · 0.85
protobufFunction · 0.85
MillisecondsClass · 0.85
randomFunction · 0.85
checkFunction · 0.85
mkdtempMethod · 0.80
principalMethod · 0.80
mkdtempFunction · 0.50
joinFunction · 0.50
openFunction · 0.50
writeFunction · 0.50
stringifyFunction · 0.50

Tested by

no test coverage detected