Uploaded image for project: 'Common Controller SDK'
  1. Common Controller SDK
  2. CCSDK-1460

Hardcoded File Paths Required for CommandExecutor mS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • None

      I was testing the sample CBA in onap/ccsdk/cds/components/model-catalog/blueprint-model/test-blueprint/remote_scripts

      The python remote executor mS is hard coded to `/opt/app/onap/` folder and its subfolders.

      I spin-up a docker container as follows:

      commandexecutor:
       image: nexus3.onap.org:10001/onap/ccsdk-commandexecutor:latest
       container_name: cds-python-command-exec
       ports:
       - "50051:50051"
       volumes:
       - ~/opt/cds/etc/blueprints/deploy:/opt/app/onap/blueprints/deploy
       restart: always

      My CBA remote scripts get extracted and deployed in ~/opt/cds/etc/blueprints/deploy. When I execute, I get the following error logs in remote-python-exec mS:

      cds-python-command-exec  | 2019-07-09 16:53:34,105 - CommandExecutorServer - ThreadPoolExecutor-0_1 - INFO - remote_scripts/1.0.0 - Received executeCommand request
      cds-python-command-exec  | 2019-07-09 16:53:34,105 - CommandExecutorServer - ThreadPoolExecutor-0_1 - INFO - requestId: "123456"
      cds-python-command-exec  | correlationId: "123456"
      cds-python-command-exec  | identifiers {
      cds-python-command-exec  |   blueprintName: "remote_scripts"
      cds-python-command-exec  |   blueprintVersion: "1.0.0"
      cds-python-command-exec  | }
      cds-python-command-exec  | command: "python /Users/nirvanr/opt/cds/etc/blueprints/deploy/remote_scripts/1.0.0/Scripts/python/SamplePython.py demo-ipcore"
      cds-python-command-exec  | timeOut: 30
      cds-python-command-exec  | properties {
      cds-python-command-exec  | }
      cds-python-command-exec  | timestamp {
      cds-python-command-exec  | }
      cds-python-command-exec  | 
      cds-python-command-exec  | 2019-07-09 16:53:34,105 - CommandExecutorHandler - ThreadPoolExecutor-0_1 - INFO - remote_scripts/1.0.0 - Activate Python Virtual Environment
      cds-python-command-exec  | 2019-07-09 16:53:34,111 - CommandExecutorHandler - ThreadPoolExecutor-0_1 - INFO - Running with PATH : /opt/app/onap/blueprints/deploy/remote_scripts/1.0.0/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin
      cds-python-command-exec  | 2019-07-09 16:53:34,111 - CommandExecutorHandler - ThreadPoolExecutor-0_1 - INFO - Command: cd /opt/app/onap/blueprints/deploy/remote_scripts/1.0.0; python /Users/nirvanr/opt/cds/etc/blueprints/deploy/remote_scripts/1.0.0/Scripts/python/SamplePython.py demo-ipcore
      cds-python-command-exec  | 2019-07-09 16:53:34,154 - CommandExecutorHandler - ThreadPoolExecutor-0_1 - INFO - python: can't open file '/Users/nirvanr/opt/cds/etc/blueprints/deploy/remote_scripts/1.0.0/Scripts/python/SamplePython.py': [Errno 2] No such file or directory
      

      The workaround forces me to use /opt/app/onap/blueprints/deploy on my local dev and mount it exactly to /opt/app/onap/blueprints/deploy:

       

      commandexecutor:
          image: nexus3.onap.org:10001/onap/ccsdk-commandexecutor:latest
          container_name: cds-python-command-exec
          ports:
          - "50051:50051"
          volumes:
          - /opt/app/onap/blueprints/deploy:/opt/app/onap/blueprints/deploy
          restart: always

      The logs show success:

      cds-python-command-exec  | 2019-07-09 18:18:23,626 - CommandExecutorServer - ThreadPoolExecutor-0_2 - INFO - remote_scripts/1.0.0 - Received executeCommand request
      cds-python-command-exec  | 2019-07-09 18:18:23,626 - CommandExecutorServer - ThreadPoolExecutor-0_2 - INFO - requestId: "123456"
      cds-python-command-exec  | correlationId: "123456"
      cds-python-command-exec  | identifiers {
      cds-python-command-exec  |   blueprintName: "remote_scripts"
      cds-python-command-exec  |   blueprintVersion: "1.0.0"
      cds-python-command-exec  | }
      cds-python-command-exec  | command: "python /opt/app/onap/blueprints/deploy/remote_scripts/1.0.0/Scripts/python/SamplePython.py demo-ipcore"
      cds-python-command-exec  | timeOut: 30
      cds-python-command-exec  | properties {
      cds-python-command-exec  | }
      cds-python-command-exec  | timestamp {
      cds-python-command-exec  | }
      cds-python-command-exec  | 
      cds-python-command-exec  | 2019-07-09 18:18:23,626 - CommandExecutorHandler - ThreadPoolExecutor-0_2 - INFO - remote_scripts/1.0.0 - Activate Python Virtual Environment
      cds-python-command-exec  | 2019-07-09 18:18:23,634 - CommandExecutorHandler - ThreadPoolExecutor-0_2 - INFO - Running with PATH : /opt/app/onap/blueprints/deploy/remote_scripts/1.0.0/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin
      cds-python-command-exec  | 2019-07-09 18:18:23,634 - CommandExecutorHandler - ThreadPoolExecutor-0_2 - INFO - Command: cd /opt/app/onap/blueprints/deploy/remote_scripts/1.0.0; python /opt/app/onap/blueprints/deploy/remote_scripts/1.0.0/Scripts/python/SamplePython.py demo-ipcore
      cds-python-command-exec  | 2019-07-09 18:18:23,686 - CommandExecutorHandler - ThreadPoolExecutor-0_2 - INFO - demo-ipcore
      cds-python-command-exec  | 2019-07-09 18:18:23,691 - CommandExecutorServer - ThreadPoolExecutor-0_2 - INFO - remote_scripts/1.0.0 - Execution finished successfully.

      Problem:

      This workaround forces every developer to have root privileges to create /opt/app/onap/blueprints/deploy on local env and allow permission to access that folder.

       

      Fix Required:

      Location of deployed scripts should be configurable (e.g. use env variables)

      or

      If we need to keep hardcoded file path: /opt/app/onap/blueprints/deploy, then the command string passed to the command-executor mS should always have the correct file path of  /opt/app/onap/blueprints/deploy

            Unassigned Unassigned
            nirvan.ramjuttun nirvan.ramjuttun
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: