Uploaded image for project: 'ONAP Operations Manager'
  1. ONAP Operations Manager
  2. OOM-1685

APPC Ansible server pod failure due to python pip and apt versioning

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Highest
    • Resolution: Done
    • Casablanca Release, Casablanca Maintenance Release
    • Dublin Release
    • None

    Description

      From Casablanca APPC deployment of the Ansible pod, an error during the startup of the /opt/onap/ccsdk/startAnsibleServer.sh script is received which prevents the pod from starting.  The error received from the script is:

      Traceback (most recent call last):
        File "RestServer.py", line 34, in <module>
          import cherrypy
        File "/usr/local/lib/python2.7/dist-packages/cherrypy/__init__.py", line 66, in <module>
          from ._cperror import (
        File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cperror.py", line 129, in <module>
          from more_itertools import always_iterable
        File "/usr/local/lib/python2.7/dist-packages/more_itertools/__init__.py", line 1, in <module>
          from more_itertools.more import *  # noqa
        File "/usr/local/lib/python2.7/dist-packages/more_itertools/more.py", line 329
          def _collate(*iterables, key=lambda a: a, reverse=False):
                                     ^
      SyntaxError: invalid syntax
      

      This error relates to a new upstream version change in more-itertools pip package which breaks the CherryPy package.  Additionally, apt-add-repository is not installed because of lack of an apt update and upgrade. The pod then enters crashloopbackoff status.

      To fix, the following changes were made to the startAnsibleServer.sh script, including apt update, upgrade and version controlling the more-itertools pip package:

      #!/bin/bash
      exec &> >(tee -a "/var/log/ansible-server.log")
      
      if [ ! -f /tmp/.ansible-server-installed ]
      then
          # The next 3 lines were inserted
          apt -y update
          apt -y upgrade
          pip install "more-itertools<6.0.0"
          pip install PyMySQL
          pip install 'cherrypy<18.0.0'
          pip install requests
      
          apt-get -y install software-properties-common
          apt-add-repository -y ppa:ansible/ansible
          apt-get -y install ansible
      
          cp /etc/ansible/ansible.cfg /etc/ansible/ansible.cfg.orig
          cat /etc/ansible/ansible.cfg.orig | sed -e 's/#host_key_checking/host_key_checking/' > /etc/ansible/ansible.cfg
          date > /tmp/.ansible-server-installed 2>&1
      fi
      
      cd /opt/onap/ccsdk
      exec /usr/bin/python RestServer.py
      

      These changes were applied by modifying line 51 of the helm ./appc/charts/appc-ansible-server/templates/deployment.yaml file :

      args: ["-c", "cd /opt/onap/ccsdk && sed -i.bak -e '5a\\ apt -y update' -e '5a\\ apt -y upgrade' -e '5a\\ pip install \"more-itertools<6.0.0\"' startAnsibleServer.sh && ./startAnsibleServer.sh"]
      

      Also, without running an additional 'apt -y update' immediately after the 'apt-add-repository -y ppa:ansible/ansible' line in the script, the installed ansible version will be 2.0.0.2 (as of today) which is a version approximately 3 years old. Optionally, adding an extra 'apt -y update' immediately after the apt-add-repository command and before the 'apt-get -y install ansible' command will cause the script to install the latest ansible version: 2.7.X (as of today).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Takamune_Cho Takamune Cho
            JohnL101 John Lotoski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: