You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/03/11 10:30:00 UTC

[jira] [Work logged] (KNOX-1814) Move directory check to Java layer

     [ https://issues.apache.org/jira/browse/KNOX-1814?focusedWorklogId=210923&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-210923 ]

ASF GitHub Bot logged work on KNOX-1814:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Mar/19 10:29
            Start Date: 11/Mar/19 10:29
    Worklog Time Spent: 10m 
      Work Description: smolnar82 commented on pull request #68: KNOX-1814 - Moving conf/data folder checking to Java layer from bash
URL: https://github.com/apache/knox/pull/68
 
 
   ## What changes were proposed in this pull request?
   `conf` and `data` directories are configurable using GATEWAY_HOME (or newly introduced env variable) in the Java layer, therefore those checks should either be removed from the `bash` layer, so they take those variables into account within the Java code.
   
   ## How was this patch tested?
   
   Running JUnit tests:
   ```
   $ mvn -T1C verify -Prelease,package
   ...
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 19:13 min (Wall Clock)
   [INFO] Finished at: 2019-03-11T11:04:32+01:00
   [INFO] Final Memory: 272M/1965M
   [INFO] ------------------------------------------------------------------------
   ```
   
   Additionally, the following manual test steps were executed:
   
   1. Using non-existing `conf` and `data` folders:
   ```
   $ ls -al $GATEWAY_CONF_HOME
   ls: cannot access /home/knox/nonExistingFolder: No such file or directory
   $ ls -al $GATEWAY_DATA_HOME
   ls: cannot access /home/knox/nonExistingFolder: No such file or directory
   
   $ ./knox-1.3.0-SNAPSHOT/bin/gateway.sh start
   Starting Gateway succeeded with PID 32349.
   
   // wait 10 seconds
   
   $ ./knox-1.3.0-SNAPSHOT/bin/gateway.sh status
   Gateway is not running. No PID file found.
   
   This error found in gateway.log:
   2019-03-11 10:37:13,405 FATAL knox.gateway (GatewayServer.java:main(175)) - Failed to start gateway: org.apache.knox.gateway.config.GatewayConfigurationException: Found configurations errors:
   GATEWAY_DATA_HOME is set to a non-existing directory: /home/knox/nonExistingFolder
   GATEWAY_CONF_HOME is set to a non-existing directory: /home/knox/nonExistingFolder
   org.apache.knox.gateway.config.GatewayConfigurationException: Found configurations errors:
   GATEWAY_DATA_HOME is set to a non-existing directory: /home/knox/nonExistingFolder
   GATEWAY_CONF_HOME is set to a non-existing directory: /home/knox/nonExistingFolder
           at org.apache.knox.gateway.GatewayServer.validateConfigurableGatewayDirectories(GatewayServer.java:260)
           at org.apache.knox.gateway.GatewayServer.main(GatewayServer.java:159)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.apache.knox.gateway.launcher.Invoker.invokeMainMethod(Invoker.java:68)
           at org.apache.knox.gateway.launcher.Invoker.invoke(Invoker.java:39)
           at org.apache.knox.gateway.launcher.Command.run(Command.java:99)
           at org.apache.knox.gateway.launcher.Launcher.run(Launcher.java:75)
           at org.apache.knox.gateway.launcher.Launcher.main(Launcher.java:52)        
   ```
   
   2. Using non-readable `conf` folder:
   ```
   $ export GATEWAY_CONF_HOME=/home/knox/testFolder
   $ mkdir /home/knox/testFolder
   $ chmod -r /home/knox/testFolder
   
   $ ./knox-1.3.0-SNAPSHOT/bin/gateway.sh start
   Starting Gateway succeeded with PID 11511.
   
   // wait 10 seconds
   
   $ ./knox-1.3.0-SNAPSHOT/bin/gateway.sh status
   Gateway is not running. No PID file found.
   
   The following error found in gateway.log:
   2019-03-11 10:40:19,813 FATAL knox.gateway (GatewayServer.java:main(175)) - Failed to start gateway: org.apache.knox.gateway.config.GatewayConfigurationException: Found configurations errors:
   GATEWAY_CONF_HOME is set to a non-readable directory: /home/knox/testFolder
   org.apache.knox.gateway.config.GatewayConfigurationException: Found configurations errors:
   GATEWAY_CONF_HOME is set to a non-readable directory: /home/knox/testFolder
           at org.apache.knox.gateway.GatewayServer.validateConfigurableGatewayDirectories(GatewayServer.java:260)
           at org.apache.knox.gateway.GatewayServer.main(GatewayServer.java:159)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.apache.knox.gateway.launcher.Invoker.invokeMainMethod(Invoker.java:68)
           at org.apache.knox.gateway.launcher.Invoker.invoke(Invoker.java:39)
           at org.apache.knox.gateway.launcher.Command.run(Command.java:99)
           at org.apache.knox.gateway.launcher.Launcher.run(Launcher.java:75)
           at org.apache.knox.gateway.launcher.Launcher.main(Launcher.java:52)
   ```
   
   3. Using non-writeable `data` folder:
   ```
   $ export GATEWAY_DATA_HOME=/home/knox/testFolder
   $ chmod +r /home/knox/testFolder/
   $ chmod -w /home/knox/testFolder/
   $ ./knox-1.3.0-SNAPSHOT/bin/gateway.sh start
   Starting Gateway failed.
   
   This error found in gateway.log:
   2019-03-11 10:42:51,596 FATAL knox.gateway (GatewayServer.java:main(175)) - Failed to start gateway: org.apache.knox.gateway.config.GatewayConfigurationException: Found configurations errors:
   GATEWAY_DATA_HOME is set to a non-writeable directory: /home/knox/testFolder
   org.apache.knox.gateway.config.GatewayConfigurationException: Found configurations errors:
   GATEWAY_DATA_HOME is set to a non-writeable directory: /home/knox/testFolder
           at org.apache.knox.gateway.GatewayServer.validateConfigurableGatewayDirectories(GatewayServer.java:260)
           at org.apache.knox.gateway.GatewayServer.main(GatewayServer.java:159)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.apache.knox.gateway.launcher.Invoker.invokeMainMethod(Invoker.java:68)
           at org.apache.knox.gateway.launcher.Invoker.invoke(Invoker.java:39)
           at org.apache.knox.gateway.launcher.Command.run(Command.java:99)
           at org.apache.knox.gateway.launcher.Launcher.run(Launcher.java:75)
           at org.apache.knox.gateway.launcher.Launcher.main(Launcher.java:52)
   ```
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 210923)
            Time Spent: 10m
    Remaining Estimate: 0h

> Move directory check to Java layer
> ----------------------------------
>
>                 Key: KNOX-1814
>                 URL: https://issues.apache.org/jira/browse/KNOX-1814
>             Project: Apache Knox
>          Issue Type: Improvement
>          Components: Server
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 1.3.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the following folder checks exist in {{gateway.sh}}:
>  * {{conf}} directory exists and can be read?
>  * {{data}}, {{log}}, {{pid}} directories exist and can be written?
> Only the {{conf}} and {{data}} folders are used by the Java code ({{log}} and {{pid}} only used in the bash script). Those directories are configurable using GATEWAY_HOME in the Java layer, therefore those checks should either be removed or fixed, so they take those variables into account.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)