DaanHoogland commented on code in PR #6507:
URL: https://github.com/apache/cloudstack/pull/6507#discussion_r940021899
##########
server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java:
##########
@@ -2126,13 +2131,36 @@ public boolean finalizeVirtualMachineProfile(final
VirtualMachineProfile profile
}
}
+ String routerLogrotateFrequency =
RouterLogrotateFrequency.valueIn(router.getDataCenterId());
+ if (!checkLogrotateTimerPattern(routerLogrotateFrequency)) {
+ s_logger.debug(String.format("Setting [%s] with value [%s] do not
match with the used regex [%s], or any acceptable value ('hourly', 'daily',
'monthly'); " +
+ "therefore, we will use the default value [%s] to
configure the logrotate service on the virtual
router.",RouterLogrotateFrequency.key(),
+ routerLogrotateFrequency, LOGROTATE_REGEX,
RouterLogrotateFrequency.defaultValue()));
+ routerLogrotateFrequency = RouterLogrotateFrequency.defaultValue();
+ }
+ s_logger.debug(String.format("The setting [%s] with value [%s] for the
zone with UUID [%s], will be used to configure the logrotate service frequency"
+
+ " on the virtual router.", RouterLogrotateFrequency.key(),
routerLogrotateFrequency, dc.getUuid()));
+ buf.append(String.format(" logrotatefrequency=%s",
routerLogrotateFrequency));
+
if (s_logger.isDebugEnabled()) {
s_logger.debug("Boot Args for " + profile + ": " + buf.toString());
}
return true;
}
+ /**
+ * @param routerLogrotateFrequency The string to be checked if matches
with any acceptable values.
+ * Checks if the value in the global configuration is an acceptable value
to be informed to the Virtual Router.
+ * @return true if the passed value match with any acceptable value based
on the regex ((?i)(hourly)|(daily)|(monthly))|(\*|\d{2})\:(\*|\d{2})\:(\*|\d{2})
+ */
+ protected boolean checkLogrotateTimerPattern(String
routerLogrotateFrequency) {
+ if (Pattern.matches(LOGROTATE_REGEX, routerLogrotateFrequency)) {
+ return true;
+ }
+ return false;
Review Comment:
```suggestion
return Pattern.matches(LOGROTATE_REGEX, routerLogrotateFrequency);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]