GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/publish/cmd_info.cc
Date: 2026-04-19 02:41:37
Exec Total Coverage
Lines: 0 22 0.0%
Branches: 0 82 0.0%

Line Branch Exec Source
1 /**
2 * This file is part of the CernVM File System.
3 */
4
5
6 #include "cmd_info.h"
7
8 #include <ctime>
9 #include <string>
10
11 #include "options.h"
12 #include "publish/repository.h"
13 #include "publish/settings.h"
14 #include "util/logging.h"
15 #include "whitelist.h"
16
17 namespace publish {
18
19 int CmdInfo::Main(const Options &options) {
20 SettingsBuilder builder;
21 SettingsRepository settings = builder.CreateSettingsRepository(
22 options.plain_args().empty() ? "" : options.plain_args()[0].value_str);
23
24 if (options.Has("keychain")) {
25 settings.GetKeychain()->SetKeychainDir(options.GetString("keychain"));
26 }
27 Repository repository(settings);
28
29 LogCvmfs(kLogCvmfs, kLogStdout, "Repository name: %s",
30 settings.fqrn().c_str());
31 if (builder.IsManagedRepository()) {
32 std::string creator_version;
33 if (builder.options_mgr()->GetValue("CVMFS_CREATOR_VERSION",
34 &creator_version)) {
35 LogCvmfs(kLogCvmfs, kLogStdout, "Created by CernVM-FS %s",
36 creator_version.c_str());
37 } else {
38 LogCvmfs(kLogCvmfs, kLogStderr,
39 "Configuration error: CVMFS_CREATOR_VERSION missing");
40 }
41 }
42 LogCvmfs(kLogCvmfs, kLogStdout, "Stratum1 replication allowed: %s",
43 repository.IsMasterReplica() ? "yes" : "no");
44 if (repository.whitelist()->IsExpired()) {
45 LogCvmfs(kLogCvmfs, kLogStdout, "Whitelist is expired");
46 } else {
47 const double delta_s = difftime(repository.whitelist()->expires(),
48 time(NULL));
49 const int delta_d = static_cast<int>(delta_s / 86400);
50 LogCvmfs(kLogCvmfs, kLogStdout, "Whitelist is valid for another %d days",
51 delta_d);
52 }
53
54 LogCvmfs(kLogCvmfs, kLogStdout,
55 "\nClient configuration:\n"
56 "Add %s to CVMFS_REPOSITORIES in /etc/cvmfs/default.local\n"
57 "Create /etc/cvmfs/config.d/%s.conf and set\n"
58 " CVMFS_SERVER_URL=%s\n"
59 " CVMFS_PUBLIC_KEY=%s\n"
60 "Copy %s to the client",
61 settings.fqrn().c_str(), settings.fqrn().c_str(),
62 settings.url().c_str(),
63 settings.keychain().master_public_key_path().c_str(),
64 settings.keychain().master_public_key_path().c_str());
65
66 if (options.Has("meta-info")) {
67 LogCvmfs(kLogCvmfs, kLogStdout, "\nMeta info:\n%s",
68 repository.meta_info().c_str());
69 }
70
71 return 0;
72 }
73
74 } // namespace publish
75