Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #24825: User version 2.2.1 of license lib #710

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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