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