charmed-osm / layer-sshproxy

A Juju layer to ease development of proxy charms
3 stars 2 forks source link

action-get fails with "exit status 1" #8

Open dreibh opened 4 years ago

dreibh commented 4 years ago

Trying to get the value of a parameter with action_get() fails with an exception, since the call to the program action-get fails with exit code 1. However, there is no information about what went wrong with the call: subprocess.CalledProcessError: Command '['action-get', 'cassandra-server-ip', '--format=json']' returned non-zero exit status 1

Is there any possibility to get some information about what is going wrong with "action-get"?

My Charm:

action.yaml: ... configure-hss: description: Configures the HSS params: cassandra-server-ip: description: Cassandra Server IP data-type: string default: 172.16.6.129 required:

The code: ... @when('actions.configure-cassandra') ... def configure_cassandra(): cassandraServerIP = action_get('cassandra-server-ip') ...

VNF: ...

====== Juju Charm ===============================================

      vdu-configuration:
        juju:
          charm: hsscharm
        initial-config-primitive:
          - seq: '1'
            name: config
            parameter:
              - name: ssh-hostname
                value: <rw_mgmt_ip>
              - name: ssh-username
                value: nornetpp
              - name: ssh-password
                value: <password>
          - seq: '2'
            name: prepare-cassandra-hss-build
            parameter:
              - name: hss-git-repository
                value: https://github.com/OPENAIRINTERFACE/openair-cn-cups.git
              - name: hss-git-commit
                value: develop
          - seq: '3'
            name: configure-cassandra
            parameter:
              - name: cassandra-server-ip
                value: 172.16.6.129

...

Juju log: 2019-11-18 10:26:06 DEBUG update-status Traceback (most recent call last): 2019-11-18 10:26:06 DEBUG update-status File "/var/lib/juju/agents/unit-simulamet-oai-epc-b-hss-aa-0/charm/hooks/update-status", line 22, in 2019-11-18 10:26:06 DEBUG update-status main() 2019-11-18 10:26:06 DEBUG update-status File "/usr/local/lib/python3.5/dist-packages/charms/reactive/init.py", line 74, in main 2019-11-18 10:26:06 DEBUG update-status bus.dispatch(restricted=restricted_mode) 2019-11-18 10:26:06 DEBUG update-status File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 390, in dispatch 2019-11-18 10:26:06 DEBUG update-status _invoke(other_handlers) 2019-11-18 10:26:06 DEBUG update-status File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 359, in _invoke 2019-11-18 10:26:06 DEBUG update-status handler.invoke() 2019-11-18 10:26:06 DEBUG update-status File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 181, in invoke 2019-11-18 10:26:06 DEBUG update-status self._action(args) 2019-11-18 10:26:06 DEBUG update-status File "/var/lib/juju/agents/unit-simulamet-oai-epc-b-hss-aa-0/charm/reactive/hsscharm.py", line 197, in configure_cassandra 2019-11-18 10:26:06 DEBUG update-status cassandraServerIP = action_get('cassandra-server-ip') 2019-11-18 10:26:06 DEBUG update-status File "/usr/local/lib/python3.5/dist-packages/charmhelpers/core/hookenv.py", line 82, in wrapper 2019-11-18 10:26:06 DEBUG update-status res = func(args, kwargs) 2019-11-18 10:26:06 DEBUG update-status File "/usr/local/lib/python3.5/dist-packages/charmhelpers/core/hookenv.py", line 974, in action_get 2019-11-18 10:26:06 DEBUG update-status action_data = json.loads(subprocess.check_output(cmd).decode('UTF-8')) 2019-11-18 10:26:06 DEBUG update-status File "/usr/lib/python3.5/subprocess.py", line 626, in check_output 2019-11-18 10:26:06 DEBUG update-status kwargs).stdout 2019-11-18 10:26:06 DEBUG update-status File "/usr/lib/python3.5/subprocess.py", line 708, in run 2019-11-18 10:26:06 DEBUG update-status output=stdout, stderr=stderr) 2019-11-18 10:26:06 DEBUG update-status subprocess.CalledProcessError: Command '['action-get', 'cassandra-server-ip', '--format=json']' returned non-zero exit status 1 2019-11-18 10:26:06 ERROR juju.worker.uniter.operation runhook.go:113 hook "update-status" failed: exit status 1

The issue appears in 100% of the cases, i.e. I can reliably reproduce it. Also, trying to manually invoke the funtion (i.e.: juju run-action simulamet-oai-epc-b-hss-aa/0 configure-cassandra cassandra-server-ip=1.2.3.4) leads to the same issue.

Note, that my VNF applies the Juju charm as part of the VDU configuration. I am not sure whether this is important for the issue.

dreibh commented 4 years ago

I noticed probably the same failure in another part of my charm, this time with "action-fail" returning status 1. That is, probably the issue is not the handling of parameters but some problem with the state of the Juju instance?

dreibh commented 4 years ago

The container for controlling the VDU seems to use juju version 2.3.7, i.e. action-get is /var/lib/juju/tools/2.3.7-xenial-amd64/action-get . Could the Juju version in the container be the problem? I am using an OSM Release SIX setup.

dreibh commented 4 years ago

When checking the contents of the Juju container for the VDU, I noticed the following:

So, I tried to update the Python packages: apt install -y pkg-config libcurl4-openssl-dev libcairo2-dev libssl-dev libgirepository1.0-dev pip list --outdated --format=freeze | grep -v '^-e' | cut -d = -f 1 | xargs -n1 pip install -U

This leaves 4 packages are installed by apt-get, which pip cannot upgrade:

pip list --outdated

Package Version Latest Type


blinker 1.3 1.4 sdist pycurl 7.43.0 7.43.0.3 sdist pygobject 3.20.0 3.34.0 sdist pyserial 3.0.1 3.4 wheel

So, may be the Python installation inside the container needs a look whether there is some incompatibility between "apt-get"-installed and "pip"-installed packages?

However, this does not solve my issue with "action-get". After upgrading the packages, I tried to run my configuration commands again => same problem.

AdamIsrael commented 4 years ago

Would you be willing to share the charm layer you've written with me? It'll be easier to debug if I can look at your code as a whole. If so, you can email it to me at adam.israel@canonical.com. I'm currently at the OSM F2F/Hackfest #8 but I'll take a look as soon as I can.