#resolve IDEMPIERE-4302 Improve Schedule discovery (#74)
This commit is contained in:
parent
5550a9633c
commit
d2c02c1bf0
|
@ -0,0 +1,11 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- IDEMPIERE-4302 Improve Schedule discovery
|
||||
-- May 19, 2020, 11:04:59 PM CEST
|
||||
UPDATE AD_Column SET Description='Run only on this IP address', Help='This is a list of semicolon (;) separated IP addresses or hostnames, if empty or 0.0.0.0 means the schedule can run in all servers.',Updated=TO_DATE('2020-05-19 23:04:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200486
|
||||
;
|
||||
|
||||
SELECT register_migration_script('202005192306_IDEMPIERE-4302.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- IDEMPIERE-4302 Improve Schedule discovery
|
||||
-- May 19, 2020, 11:04:59 PM CEST
|
||||
UPDATE AD_Column SET Description='Run only on this IP address', Help='This is a list of semicolon (;) separated IP addresses or hostnames, if empty or 0.0.0.0 means the schedule can run in all servers.',Updated=TO_TIMESTAMP('2020-05-19 23:04:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200486
|
||||
;
|
||||
|
||||
SELECT register_migration_script('202005192306_IDEMPIERE-4302.sql') FROM dual
|
||||
;
|
||||
|
|
@ -89,6 +89,9 @@ public class MSchedule extends X_AD_Schedule
|
|||
*/
|
||||
public boolean isOKtoRunOnIP()
|
||||
{
|
||||
if (!isActive()) {
|
||||
return false;
|
||||
}
|
||||
String ipOnly = getRunOnlyOnIP();
|
||||
// 0.0.0.0 = all ip address
|
||||
if ((ipOnly == null) || (ipOnly.length() == 0) || "0.0.0.0".equals(ipOnly))
|
||||
|
@ -138,6 +141,17 @@ public class MSchedule extends X_AD_Schedule
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!chekIPFormat(ipOnly)) {
|
||||
// verify with the local hostname
|
||||
String retVal = InetAddress.getLocalHost().getHostName();
|
||||
retVal = InetAddress.getLocalHost().getCanonicalHostName();
|
||||
if (ipOnly.equals(retVal)) {
|
||||
if (log.isLoggable(Level.INFO)) log.info("Allowed here - IP=" + retVal+ " match");
|
||||
return true;
|
||||
} else {
|
||||
if (log.isLoggable(Level.INFO)) log.info("Not Allowed here - IP=" + retVal+ " does not match " + ipOnly);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue