This is an automated email from the ASF dual-hosted git repository.
rmani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new 965368d RANGER-2620:Create empty Role cache file when no roles are
present in ranger yet
965368d is described below
commit 965368da8d56af436af12d5901fb83647ad65725
Author: rmani <[email protected]>
AuthorDate: Fri Oct 11 10:24:51 2019 -0700
RANGER-2620:Create empty Role cache file when no roles are present in
ranger yet
Signed-off-by: rmani <[email protected]>
---
.../java/org/apache/ranger/plugin/util/RangerRolesProvider.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRolesProvider.java
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRolesProvider.java
index 5ba3cca..38ba6cf 100644
---
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRolesProvider.java
+++
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRolesProvider.java
@@ -33,6 +33,8 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.Reader;
import java.io.Writer;
+import java.util.Date;
+import java.util.HashSet;
public class RangerRolesProvider {
@@ -255,7 +257,12 @@ public class RangerRolesProvider {
}
}
} else {
- LOG.warn("cache file does not exist or not readable '"
+ (cacheFile == null ? null : cacheFile.getAbsolutePath()) + "'");
+ rangerRoles = new RangerRoles();
+ rangerRoles.setServiceName(serviceName);
+ rangerRoles.setRoleVersion(-1L);
+ rangerRoles.setRoleUpdateTime(new Date());
+ rangerRoles.setRangerRoles(new HashSet<>());
+ saveToCache(rangerRoles);
}
if (LOG.isDebugEnabled()) {