Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Melodic
morphemic-preprocessor
Commits
e964dbcd
Commit
e964dbcd
authored
Nov 18, 2021
by
Mohamed Khalil Labidi
Browse files
Fix ip addresses retrieval issue related to bot.whatismyipaddress.com api
parent
ba2aa963
Pipeline
#17497
passed with stage
in 1 minute and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java
View file @
e964dbcd
...
...
@@ -10,6 +10,7 @@ import org.activeeon.morphemic.model.IpVersion;
import
org.activeeon.morphemic.service.EntityManagerHelper
;
import
org.activeeon.morphemic.service.RMConnectionHelper
;
import
org.apache.http.conn.ConnectTimeoutException
;
import
org.apache.http.conn.util.InetAddressUtils
;
import
org.ow2.proactive.resourcemanager.common.NSState
;
import
org.ow2.proactive.resourcemanager.common.event.RMNodeEvent
;
import
org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull
;
...
...
@@ -387,7 +388,11 @@ public class PAResourceManagerGateway {
60000
);
String
publicIPAddr
=
taskResult
.
getValue
().
toString
();
LOGGER
.
info
(
"Task result value to string: "
+
publicIPAddr
);
if
(!
InetAddressUtils
.
isIPv4Address
(
publicIPAddr
))
{
LOGGER
.
warn
(
String
.
format
(
"IPAddrGetter job could not retrieve the public ip for deployment [%s]"
,
deployment
.
getNodeName
()));
LOGGER
.
warn
(
" Public ip address will be set to 999.999.999.999"
);
publicIPAddr
=
"999.999.999.999"
;
}
IpAddress
ipAddress
=
new
IpAddress
(
IpAddressType
.
PUBLIC_IP
,
IpVersion
.
V4
,
publicIPAddr
);
...
...
scheduling-abstraction-layer/src/main/resources/get_ip_addr_script.groovy
View file @
e964dbcd
URL
url_name
=
new
URL
(
"http://
bot.whatismyipaddress.com
"
);
URL
url_name
=
new
URL
(
"http
s
://
api.ipify.org
"
);
BufferedReader
sc
=
new
BufferedReader
(
new
InputStreamReader
(
url_name
.
openStream
()));
// reads system IPAddress
systemipaddress
=
sc
.
readLine
().
trim
();
System
.
out
.
println
(
"Public IP Address: "
+
systemipaddress
+
"\n"
);
System
.
out
.
println
(
"Public IP Address: "
+
systemipaddress
+
"\n"
);
result
=
systemipaddress
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment