Merge pull request #1250 from Mic92/fix-ssh-prefix

hydra: fix localhost detection when protocol prefix are used
This commit is contained in:
Janne Heß 2022-09-30 10:06:29 +02:00 committed by GitHub
commit 7e459e8c5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <queue> #include <queue>
#include <regex>
#include <prometheus/counter.h> #include <prometheus/counter.h>
#include <prometheus/gauge.h> #include <prometheus/gauge.h>
@ -293,7 +294,8 @@ struct Machine
bool isLocalhost() bool isLocalhost()
{ {
return sshName == "localhost"; std::regex r("^(ssh://|ssh-ng://)?localhost$");
return std::regex_search(sshName, r);
} }
}; };