Removing hard cable information
This commit is contained in:
parent
10b3845469
commit
8819ddc962
|
@ -52,7 +52,11 @@ public class ResourceCheckerPlugin extends Plugin {
|
||||||
private static final int SECONDS2WAIT = 2; // seconds to wait among IS requests
|
private static final int SECONDS2WAIT = 2; // seconds to wait among IS requests
|
||||||
private static final String INITIAL_ERRORS_STATEMENT = "Other errors: ";
|
private static final String INITIAL_ERRORS_STATEMENT = "Other errors: ";
|
||||||
public static final String ROLE_TO_NOTIFY = "role";
|
public static final String ROLE_TO_NOTIFY = "role";
|
||||||
|
|
||||||
private static final String NAGIOS_PROPERTY_FILE = "/META-INF/plugin_resources/nagios-report-location.properties";
|
private static final String NAGIOS_PROPERTY_FILE = "/META-INF/plugin_resources/nagios-report-location.properties";
|
||||||
|
|
||||||
|
public final static String HOME_SYSTEM_PROPERTY = "user.home";
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ResourceCheckerPlugin.class);
|
private static final Logger logger = LoggerFactory.getLogger(ResourceCheckerPlugin.class);
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private static final DiscoveryClient client = ICFactory.client();
|
private static final DiscoveryClient client = ICFactory.client();
|
||||||
|
@ -270,11 +274,25 @@ public class ResourceCheckerPlugin extends Plugin {
|
||||||
try{
|
try{
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
prop.load(getClass().getResourceAsStream(NAGIOS_PROPERTY_FILE));
|
prop.load(getClass().getResourceAsStream(NAGIOS_PROPERTY_FILE));
|
||||||
String location = prop.getProperty("location");
|
String relativeLocation = prop.getProperty("location");
|
||||||
|
|
||||||
logger.trace("File location for nagios is " + location);
|
if(relativeLocation.startsWith("/")) {
|
||||||
|
relativeLocation = relativeLocation.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.trace("File home relative location for nagios is " + relativeLocation);
|
||||||
|
|
||||||
|
String homePath = System.getProperty(HOME_SYSTEM_PROPERTY);
|
||||||
|
File home = new File(homePath);
|
||||||
|
|
||||||
|
String[] parts = relativeLocation.split("/");
|
||||||
|
|
||||||
|
File f = new File(home, parts[0]);
|
||||||
|
|
||||||
|
for(int i=1; i<parts.length; i++) {
|
||||||
|
f = new File(f, parts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
File f = new File(location);
|
|
||||||
f.getParentFile().mkdirs();
|
f.getParentFile().mkdirs();
|
||||||
f.delete();
|
f.delete();
|
||||||
f.createNewFile();
|
f.createNewFile();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
location=/home/gcube/missing_resources/identifiers
|
location=missing_resources/identifiers
|
|
@ -1 +1 @@
|
||||||
location=/home/gcube/missing_resources/identifiers
|
location=missing_resources/identifiers
|
Loading…
Reference in New Issue