Skip to content

Commit

Permalink
Merge branch 'arch_24825/user_version_2_2_1_of_license_lib_pr' into b…
Browse files Browse the repository at this point in the history
…ranches/rudder/7.3
  • Loading branch information
Jenkins CI committed May 15, 2024
2 parents 482ae48 + 09ee4a5 commit 7d4336a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins-common-private/pom-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<dependency>
<groupId>com.normation</groupId>
<artifactId>license-lib</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</dependency>
</dependencies>
<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@

package com.normation.plugins

import com.normation.license._
import com.normation.license.*
import com.normation.license.MaybeLicenseError.Maybe
import com.normation.rudder.domain.logger.PluginLogger
import java.nio.file.Files
import java.nio.file.Paths
Expand Down Expand Up @@ -75,14 +76,14 @@ trait LicensedPluginCheck extends PluginStatus {
/*
* we don't want to check each time if the license is ok or not. So we only change if license or key file is updated
*/
def getModDate(path: String): Option[FileTime] = {
def getModDate(path: String): Option[FileTime] = {
try {
Some(Files.getLastModifiedTime(Paths.get(path)))
} catch {
case NonFatal(ex) => None
}
}
def readLicense = {
def readLicense: Maybe[(License.CheckedLicense, Version)] = {
val lic = LicenseReader.readAndCheckLicenseFS(
pluginResourceLicense,
pluginResourcePublickey,
Expand All @@ -105,7 +106,7 @@ trait LicensedPluginCheck extends PluginStatus {
LicenseError.IO("License not initialized yet or missing licenses related files.")
)

def maybeLicense = {
def maybeLicense: Maybe[(License.CheckedLicense, Version)] = {
val licenseMod = getModDate(pluginResourceLicense)
val pubkeyMod = getModDate(pluginResourcePublickey)
if (licenseMod != licenseModDate || pubkeyMod != pubkeyModDate) {
Expand Down

0 comments on commit 7d4336a

Please sign in to comment.