#include <stdlib.h>
#include <sstream>
-#include <fstream>
-#include <string>
-#include <iterator>
-
#include "ceph_ver.h"
#include "common/ceph_strings.h"
return STRINGIFY(CEPH_GIT_VER);
}
-static std::string read_vendor_release_file()
-{
- auto filename = "/etc/ceph_version";
- std::ifstream file(filename);
-
- if(!file.is_open()){
- return "";
- }
-
- std::string content;
- try {
- content.assign(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
- } catch (const std::exception &e) {
- return "";
- }
- if (!content.empty()) {
- while (!content.empty() && (content.back() == '\n' || content.back() == '\r')) {
- content.pop_back();
- }
- return std::string(" release ") + content;
- }
-
- return "";
-
-}
-
std::string const pretty_version_to_str(void)
{
std::ostringstream oss;
#ifdef WITH_CRIMSON
<< " (crimson)"
#endif
- << read_vendor_release_file()
;
return oss.str();
}