CernVM-FS  2.11.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
repository_abort.cc
Go to the documentation of this file.
1 
5 #include "cvmfs_config.h"
6 #include "publish/repository.h"
7 
8 #include <unistd.h>
9 
10 #include <string>
11 
12 #include "publish/except.h"
14 #include "publish/settings.h"
15 #include "util/logging.h"
16 #include "util/posix.h"
17 
18 namespace publish {
19 
21  // TODO(jblomer): implement for enter shell etc.
22  if (!managed_node_.IsValid())
23  return;
24 
25  managed_node_->ClearScratch();
26 }
27 
30 
31  if (!in_transaction_.IsSet()) {
32  if (session_->has_lease()) {
33  LogCvmfs(kLogCvmfs, kLogSyslogWarn, "removing stale session token for %s",
34  settings_.fqrn().c_str());
35  session_->Drop();
36  }
37  throw EPublish(
38  "Repository " + settings_.fqrn() + " is not in a transaction",
40  }
41 
42  session_->Drop();
43 
44  if (managed_node_.IsValid()) {
45  // We already checked for is_publishing and in_transaction. Normally, at
46  // this point we do want to repair the mount points of a repository
47  // in transaction
48  EUnionMountRepairMode repair_mode =
49  settings_.transaction().spool_area().repair_mode();
50  if (repair_mode == kUnionMountRepairSafe) {
51  settings_.GetTransaction()->GetSpoolArea()->SetRepairMode(
53  }
54  int rvi = managed_node_->Check(false /* is_quiet */);
55  settings_.GetTransaction()->GetSpoolArea()->SetRepairMode(repair_mode);
56  if (rvi != 0) throw EPublish("publisher file system mount state is broken");
57 
58  managed_node_->Unmount();
59  managed_node_->ClearScratch();
60  managed_node_->Mount();
61  }
62 
64 }
65 
66 } // namespace publish
#define LogCvmfs(source, mask,...)
Definition: logging.h:22
const SettingsRepository settings_
Definition: repository.h:137
UniquePtr< ManagedNode > managed_node_
Definition: repository.h:380
EUnionMountRepairMode
Definition: settings.h:64
void Abort()
void WipeScratchArea()
ServerLockFile is_publishing_
Definition: repository.h:370
UniquePtr< Session > session_
Definition: repository.h:379
ServerFlagFile in_transaction_
Definition: repository.h:369
std::string fqrn() const
Definition: settings.h:370