RANGER-5549: replace use of com.kstruct.gethostname4j library#911
RANGER-5549: replace use of com.kstruct.gethostname4j library#911mneethiraj merged 5 commits intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Replaces usage of com.kstruct.gethostname4j for agent hostname detection with environment-variable lookup (HOSTNAME / COMPUTERNAME) and a Java networking fallback, and removes the associated native/JNA dependencies from builds and assemblies.
Changes:
- Removed
gethostname4jand JNA dependencies/version properties from Maven poms and distribution assembly descriptors. - Updated
RangerRESTUtilsto resolve hostname via env vars with fallback toInetAddress.getLocalHost().getHostName(). - Updated the audit handler unit test to assert that
agentHostnameis non-blank rather than a hardcoded value.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ranger-presto-plugin-shim/pom.xml | Drops gethostname4j dependency from Presto plugin shim module. |
| ranger-examples/distro/src/main/assembly/sample-client.xml | Removes gethostname4j/JNA from the example distro assembly includes. |
| pom.xml | Removes gethostname4j and JNA version properties from the parent pom. |
| distro/src/main/assembly/usersync.xml | Removes gethostname4j/JNA from usersync assembly includes. |
| distro/src/main/assembly/tagsync.xml | Removes gethostname4j/JNA from tagsync assembly includes. |
| distro/src/main/assembly/storm-agent.xml | Removes gethostname4j/JNA from storm agent assembly includes. |
| distro/src/main/assembly/sample-client.xml | Removes gethostname4j/JNA from sample client assembly includes. |
| distro/src/main/assembly/ranger-tools.xml | Removes gethostname4j/JNA from ranger tools assembly includes. |
| distro/src/main/assembly/plugin-yarn.xml | Removes gethostname4j/JNA from yarn plugin assembly includes. |
| distro/src/main/assembly/plugin-trino.xml | Removes gethostname4j/JNA from trino plugin assembly includes. |
| distro/src/main/assembly/plugin-sqoop.xml | Removes gethostname4j/JNA from sqoop plugin assembly includes. |
| distro/src/main/assembly/plugin-solr.xml | Removes gethostname4j/JNA from solr plugin assembly includes. |
| distro/src/main/assembly/plugin-presto.xml | Removes gethostname4j/JNA from presto plugin assembly includes. |
| distro/src/main/assembly/plugin-ozone.xml | Removes gethostname4j/JNA from ozone plugin assembly includes. |
| distro/src/main/assembly/plugin-kylin.xml | Removes gethostname4j/JNA from kylin plugin assembly includes. |
| distro/src/main/assembly/plugin-kms.xml | Removes gethostname4j/JNA from KMS plugin assembly includes. |
| distro/src/main/assembly/plugin-kafka.xml | Removes gethostname4j/JNA from kafka plugin assembly includes. |
| distro/src/main/assembly/plugin-elasticsearch.xml | Removes gethostname4j/JNA from elasticsearch plugin assembly includes. |
| distro/src/main/assembly/plugin-atlas.xml | Removes gethostname4j/JNA from atlas plugin assembly includes. |
| distro/src/main/assembly/pdp.xml | Removes native hostname lookup includes (gethostname4j/JNA) from PDP assembly. |
| distro/src/main/assembly/knox-agent.xml | Removes gethostname4j/JNA from knox agent assembly includes. |
| distro/src/main/assembly/kms.xml | Removes gethostname4j/JNA from kms assembly includes. |
| distro/src/main/assembly/hive-agent.xml | Removes gethostname4j/JNA from hive agent assembly includes. |
| distro/src/main/assembly/hdfs-agent.xml | Removes gethostname4j/JNA from hdfs agent assembly includes. |
| distro/src/main/assembly/hbase-agent.xml | Removes gethostname4j/JNA from hbase agent assembly includes. |
| distro/src/main/assembly/admin-web.xml | Removes gethostname4j/JNA from admin web assembly includes. |
| agents-common/src/test/java/org/apache/ranger/plugin/audit/TestRangerDefaultAuditHandler.java | Adjusts test to validate non-blank agent hostname instead of a fixed value. |
| agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTUtils.java | Implements hostname resolution without gethostname4j and wires it into getAgentHostname(). |
| agents-common/pom.xml | Drops gethostname4j and JNA dependencies from agents-common. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTUtils.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTUtils.java
Show resolved
Hide resolved
agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTUtils.java
Outdated
Show resolved
Hide resolved
agents-common/src/test/java/org/apache/ranger/plugin/audit/TestRangerDefaultAuditHandler.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTUtils.java
Outdated
Show resolved
Hide resolved
(cherry picked from commit b8eb7b4)
What changes were proposed in this pull request?
Replaced use of
com.kstruct.gethostname4j.Hostname.getHostname()with env variable lookupHOSTNAMEorCOMPUTERNAME), with fallback toInetAddress.getLocalHost().getHostName().How was this patch tested?
Using docker setup, verified that plugins report correct hostname in audit logs.