Uploaded image for project: 'SEBA'
  1. SEBA
  2. SEBA-540

XOS API Convenience methods stored in distro-specific location

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Next for SEBA 2.0
    • Fix Version/s: None
    • Component/s: NEM
    • Labels:
      None

      Description

      xosapi module assumes that convenience methods can be saved in the same location that the module is saved in, but this location changes depending on the distro used.

      In Ubuntu and similar distros this is `/usr/local/lib/python2.7/dist-packages/`. Alpine installs python modules in `/usr/lib/python2.7/site-packages/`.

      When testing with Alpline as a synchronizer image, this failure arises:

      2019-03-14T16:35:07.436915Z [info     ] reconnected                    after_retries=14
      2019-03-14T16:35:07.620652Z [info     ] Loading convenience methods    methods=[u'voltserviceinstance.py', u'voltservice.py', u'rcordsubscriber.py', u'fabric_crossconnect_service.py']
      2019-03-14T16:35:07.623288Z [debug    ] Saving convenience method      method=u'voltserviceinstance.py'
      Unhandled Error
      Traceback (most recent call last):
        File "/usr/lib/python2.7/site-packages/xossynchronizer/modelaccessor.py", line 416, in config_accessor
          config_accessor_grpcapi()
        File "/usr/lib/python2.7/site-packages/xossynchronizer/modelaccessor.py", line 377, in config_accessor_grpcapi
          reactor.run()
        File "/usr/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run
          self.mainLoop()
        File "/usr/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop
          self.runUntilCurrent()
      --- <exception caught here> ---
        File "/usr/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent
          call.func(*call.args, **call.kw)
        File "/usr/lib/python2.7/site-packages/xosapi/xos_grpc_client.py", line 138, in reconnected
          self.load_convenience_methods()
        File "/usr/lib/python2.7/site-packages/xosapi/xos_grpc_client.py", line 98, in load_convenience_methods
          open(save_path, "w").write(cm.contents)
      exceptions.IOError: [Errno 2] No such file or directory: u'/usr/local/lib/python2.7/dist-packages/xosapi/convenience/voltserviceinstance.py'
      

      Preferably xosapi should use a neutral temp directory for convenience methods, or alternatively determine the path to save convenience methods in at runtime. It's currently hardcoded here:

      https://gerrit.opencord.org/gitweb?p=xos.git;a=blob;f=lib/xos-api/xosapi/xos_grpc_client.py;h=fba9ce4d142a1c2fee5be9fb9c231bdf435aca66;hb=HEAD#l82

        Attachments

          Issue Links

          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              scottb Scott Baker
              Reporter:
              zdw Zack Williams
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes