Landscape Client Charm Docs

landscape-client

Description

Landscape client is the daemon for Landscape server. This subordinate charm is intended to be used to register a machine against a running Landscape server. This charm uses the Ops framework

Links

Usage

The minimal example to get started with Landscape SaaS

juju deploy landscape-client --config account-name=foo-bar
juju deploy ubuntu --series jammy
juju relate landscape-client ubuntu

To install using a PPA

--config ppa=ppa:landscape/self-hosted-beta

To connect to a Landscape Self-Hosted instance

juju deploy landscape-client \
    --config computer-title=helloworld \
    --config account-name=standalone \
    --config url=https://mydomain.com/message-system \
    --config ping-url=http://mydomain.com/ping \

However, when registering the client against a server with a custom or not well known CA, we need to use the ssl-public-key option. To insert the certificate contents into the charm config directly, encode it in base64 using the following syntax:

--config ssl-public-key=base64:<base64_encoded_certificate>

For example:

--config ssl-public-key=base64:LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS4HY5RHZ6VWxUcDYwcjFNRmw1bG16M2I5a2dJeTVJeUYyUURCNnhXeEFMYXoKUGJwVCtnZ2NvYTN5Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0=

If the certificate is already present in the client machine, then use the filepath:

--config ssl-public-key=/path/to/ca.cert

Upgrading

It is recommended to use the PPA.

juju config landscape-client ppa=ppa:landscape/self-hosted-beta

The charm upgrade action can be run as shown where landscape-client/0 is the desired unit.

For juju 3.0 and above, run:

juju run landscape-client/0 upgrade

For versions before juju 3.0, use run-action instead of run:

juju run-action landscape-client/0 upgrade

Re-registering

The charm will register the client once. Subsequent config-changed events will restart the service. If you want to register again, run:

juju run landscape-client/0 register

If you’re using a version before juju 3.0, use run-action instead of run.

Relations

Since this is a subordinate charm, a relation is required. (Breaking the relation via remove-relation will disable the client.)

In the following example the Ubuntu Charm is used.

juju deploy landscape-client --config account-name=foo-bar
juju deploy ubuntu --series jammy
juju relate landscape-client ubuntu

This is accomplished using the juju-info interface. For more information, see Juju’s reference material on implicit integrations.

Source Code

The code for this updated version of the charm is in https://github.com/canonical/landscape-client-charm

Development

Make your code modifications and ensure that the options bundle.yaml are correct. Then

make build

To run linting and tests, cd into the top level directory and

sudo apt install tox
tox

To run an individual test:

tox tests/unit/test_charm.py::TestCharm::test_ssl_cert

The following commands may also be helpful:

juju status --watch 1s
juju debug-log --include landscape-client

The commands for re-registering the charm did not work for me, I’m using juju version 2.9.44.

prod-proposed-migration-environment@ubuntu-qa-bastion-ps5:~$ juju run landscape-client/0 register
ERROR You must specify a target, either through --all, --machine, --application or --unit
prod-proposed-migration-environment@ubuntu-qa-bastion-ps5:~$ juju run --unit landscape-client/0 register
/tmp/juju-exec1402953840/script.sh: line 1: register: command not found

For versions before juju 3.0, you should use run-action instead of run. I’ve just updated the doc to reflect that. Thanks for your feedback! :smile: