tengu-team / tengu-browser

Tengu UI
Other
0 stars 0 forks source link

add port info of subordinate charms to status view of model info #25

Open gvseghbr opened 7 years ago

gvseghbr commented 7 years ago

tvanhove:

poort info van die subordinates moet ook in tabel komen

gvseghbr commented 7 years ago

1st we need to check if necessary info is passed via the API. @sebastienpattyn93 @mhmoerma

sebastienpattyn93 commented 7 years ago

The API returns the port but will leave it blank if it is not set in the charm. I noticed that returning the model information in JSON format gives other information for subordinates charms as well. When I try to open the port in the subordinate charm it only works if it is a different port, which is not the case for our Sojobo.

error: cannot open 80/tcp (unit "monitoring-api/0"): conflicts with existing 80/tcp (unit "sojobo-api/0")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/charmhelpers/core/hookenv.py", line 609, in open_port
    subprocess.check_call(_args)
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['open-port', '80/TCP']' returned non-zero exit status 1

We can easily check if it is a subordinate charm and just add the port number of the charm the subordinate has a relationship with.

As a test I opened port 8080 for a subordinate charm and it was visible in juju status but it was not returned in the juju status --format json... Maybe libjuju integration might fix this.

EDIT: just noticed that our main charm returns the open ports for his subordinate charms. they can be found in his application info but not in the info for the subordinate charm