Skip to content

Commit

Permalink
Merge pull request #1765 from subutai-io/hotfix
Browse files Browse the repository at this point in the history
Hotfix
  • Loading branch information
jadilet authored Oct 27, 2018
2 parents 2f8b504 + 8dc9ef0 commit 3810bc0
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions hub/src/P2PController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,34 @@ void P2PConnector::update_status() {

static QString lxc_path("/var/lib/lxc");
QDir directory(lxc_path);
QString tmp;
QString tmp, hostfile_path;

// check container directory
if (directory.exists()) {
for (QFileInfo info : directory.entryInfoList()) {
if (info.fileName() == "." || info.fileName() == "..")
continue;

tmp = info.fileName().trimmed();
qDebug() << "local container foreach: " << tmp;
if (tmp.contains("Container")) {
qDebug() << "found local container: "
<< tmp;
local_containers << tmp;
hostfile_path = lxc_path + QDir::separator() + tmp + QDir::separator() + "rootfs/etc/hostname";

if (QFileInfo::exists(hostfile_path)) {
QFile file(hostfile_path);

if(!file.open(QIODevice::ReadOnly)) {
qDebug() << "error opening file: " << file.error() << hostfile_path;
break;
}

QTextStream instream(&file);
QString line = instream.readLine();

qDebug() << "local container hotname found: " << line;
local_containers << line;
file.close();
} else {
qInfo() << "not exist container hostname file: "
<< hostfile_path;
}
}

Expand Down

0 comments on commit 3810bc0

Please sign in to comment.