Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add post about weldr-client #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions _posts/2021-12-14-Weldr-Client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
layout: post
title: composer-cli update
author: bcl
tags: weldr composer-cli
---

As I wrote [back in May](https://weldr.io/Project-Updates/), `lorax-composer`
and `composer-cli` are no longer under active development. When RHEL 8.6.0 is
release `composer-cli` will be provided by [weldr-client
repo](https://github.com/osbuild/weldr-client), a complete rewrite of the tool
using Go.

The rewrite uses the [cobra library](https://github.com/spf13/cobra) to handle
the command parsing instead of the 'minimum viable parser' I wrote for the
python version. The JSON output format is consistently supported since it is
now implemented at a lower level than before. And error reporting should be
more clear, with consistent return codes and errors that come from the API
server.

The project has moved under the umbrella of the
[osbuild](https://github.com/osbuild/) project, with
[weldr](https://github.com/weldr/) continuing to be the home of `lorax` and
`livemedia-creator`.

The JSON output now includes more details:

[root@localhost ~]# composer-cli --json blueprints list
{
"method": "GET",
"path": "/blueprints/list?limit=0",
"status": 200,
"body": {
"blueprints": [],
"limit": 0,
"offset": 0,
"total": 1
}
}
{
"method": "GET",
"path": "/blueprints/list?limit=1",
"status": 200,
"body": {
"blueprints": [
"bcl-tmux"
],
"limit": 1,
"offset": 0,
"total": 1
}
}

The `method`, `path`, and `status` are added to each call, and the response is
in the `body` section. Some commands, like this `blueprints list` command,
involve multiple calls to the server so the output may contain more than 1 JSON
object as you can see.

One of the goals of the rewrite was to make the code easier to maintain,
extend, and use so in addition to switching to go and a real command parser it
includes [a library](https://github.com/osbuild/weldr-client/tree/main/weldr)
that the `composer-cli` command uses to communicate with the API server. You
can use it to write your own applications to interact with the
`osbuild-composer` server.