Rename composer-cli to composer

This commit is contained in:
Lars Karlitski 2018-09-18 16:48:46 +02:00 committed by Brian C. Lane
parent 490f7f6cf1
commit d540ba3a23
18 changed files with 47 additions and 47 deletions

View File

@ -26,7 +26,7 @@ install: all
install -m 644 docs/man/lorax.1 $(DESTDIR)/$(mandir)/man1 install -m 644 docs/man/lorax.1 $(DESTDIR)/$(mandir)/man1
install -m 644 docs/man/livemedia-creator.1 $(DESTDIR)/$(mandir)/man1 install -m 644 docs/man/livemedia-creator.1 $(DESTDIR)/$(mandir)/man1
mkdir -p $(DESTDIR)/etc/bash_completion.d mkdir -p $(DESTDIR)/etc/bash_completion.d
install -m 644 etc/bash_completion.d/composer-cli $(DESTDIR)/etc/bash_completion.d install -m 644 etc/bash_completion.d/composer $(DESTDIR)/etc/bash_completion.d
check: check:
@echo "*** Running pylint ***" @echo "*** Running pylint ***"

View File

@ -1,54 +1,54 @@
composer-cli composer
============ ========
:Authors: :Authors:
Brian C. Lane <bcl@redhat.com> Brian C. Lane <bcl@redhat.com>
``composer-cli`` is used to interact with the ``lorax-composer`` API server, managing blueprints, exploring available packages, and building new images. ``composer`` is used to interact with the ``lorax-composer`` API server, managing blueprints, exploring available packages, and building new images.
It requires `lorax-composer <lorax-composer.html>`_ to be installed on the It requires `lorax-composer <lorax-composer.html>`_ to be installed on the
local system, and the user running it needs to be a member of the ``weldr`` local system, and the user running it needs to be a member of the ``weldr``
group. They do not need to be root, but all of the `security precautions group. They do not need to be root, but all of the `security precautions
<lorax-composer.html#security>`_ apply. <lorax-composer.html#security>`_ apply.
composer-cli cmdline arguments composer cmdline arguments
------------------------------ --------------------------
.. argparse:: .. argparse::
:ref: composer.cli.cmdline.composer_cli_parser :ref: composer.cli.cmdline.composer_cli_parser
:prog: composer-cli :prog: composer
Edit a Blueprint Edit a Blueprint
---------------- ----------------
Start out by listing the available blueprints using ``composer-cli blueprints Start out by listing the available blueprints using ``composer blueprints
list``, pick one and save it to the local directory by running ``composer-cli list``, pick one and save it to the local directory by running ``composer
blueprints save http-server``. If there are no blueprints available you can blueprints save http-server``. If there are no blueprints available you can
copy one of the examples `from the test suite copy one of the examples `from the test suite
<https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/>`_. <https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/>`_.
Edit the file (it will be saved with a .toml extension) and change the Edit the file (it will be saved with a .toml extension) and change the
description, add a package or module to it. Send it back to the server by description, add a package or module to it. Send it back to the server by
running ``composer-cli blueprints push http-server.toml``. You can verify that it was running ``composer blueprints push http-server.toml``. You can verify that it was
saved by viewing the changelog - ``composer-cli blueprints changes http-server``. saved by viewing the changelog - ``composer blueprints changes http-server``.
Build an image Build an image
---------------- ----------------
Build a ``qcow2`` disk image from this blueprint by running ``composer-cli Build a ``qcow2`` disk image from this blueprint by running ``composer
compose start http-server qcow2``. It will print a UUID that you can use to compose start http-server qcow2``. It will print a UUID that you can use to
keep track of the build. You can also cancel the build if needed. keep track of the build. You can also cancel the build if needed.
The available types of images is displayed by ``composer-cli compose types``. The available types of images is displayed by ``composer compose types``.
Currently this consists of: ext4-filesystem, live-iso, partitioned-disk, qcow2, Currently this consists of: ext4-filesystem, live-iso, partitioned-disk, qcow2,
tar tar
Monitor the build status Monitor the build status
------------------------ ------------------------
Monitor it using ``composer-cli compose status``, which will show the status of Monitor it using ``composer compose status``, which will show the status of
all the builds on the system. You can view the end of the anaconda build logs all the builds on the system. You can view the end of the anaconda build logs
once it is in the ``RUNNING`` state using ``composer-cli compose log UUID`` once it is in the ``RUNNING`` state using ``composer compose log UUID``
where UUID is the UUID returned by the start command. where UUID is the UUID returned by the start command.
Once the build is in the ``FINISHED`` state you can download the image. Once the build is in the ``FINISHED`` state you can download the image.
@ -56,7 +56,7 @@ Once the build is in the ``FINISHED`` state you can download the image.
Download the image Download the image
------------------ ------------------
Downloading the final image is done with ``composer-cli compose image UUID`` and it will Downloading the final image is done with ``composer compose image UUID`` and it will
save the qcow2 image as ``UUID-disk.qcow2`` which you can then use to boot a VM like this:: save the qcow2 image as ``UUID-disk.qcow2`` which you can then use to boot a VM like this::
qemu-kvm --name test-image -m 1024 -hda ./UUID-disk.qcow2 qemu-kvm --name test-image -m 1024 -hda ./UUID-disk.qcow2

View File

@ -17,13 +17,13 @@ Installation
------------ ------------
The best way to install ``lorax-composer`` is to use ``sudo dnf install The best way to install ``lorax-composer`` is to use ``sudo dnf install
lorax-composer composer-cli``, this will setup the weldr user and install the lorax-composer composer``, this will setup the weldr user and install the
systemd socket activation service. You will then need to enable it with ``sudo systemd socket activation service. You will then need to enable it with ``sudo
systemctl enable lorax-composer.socket && sudo systemctl start systemctl enable lorax-composer.socket && sudo systemctl start
lorax-composer.socket``. This will leave the server off until the first request lorax-composer.socket``. This will leave the server off until the first request
is made. Systemd will then launch the server and it will remain running until is made. Systemd will then launch the server and it will remain running until
the system is rebooted. This will cause some delay in responding to the first the system is rebooted. This will cause some delay in responding to the first
request from the UI or `composer-cli`. request from the UI or `composer`.
.. note:: .. note::
@ -102,7 +102,7 @@ Composing Images
The `welder-web <https://github.com/weldr/welder-web/>`_ GUI project can be used to construct The `welder-web <https://github.com/weldr/welder-web/>`_ GUI project can be used to construct
blueprints and create composes using a web browser. blueprints and create composes using a web browser.
Or use the command line with `composer-cli <composer-cli.html>`_. Or use the command line with `composer <composer-cli.html>`_.
Blueprints Blueprints
---------- ----------
@ -334,7 +334,7 @@ system repo files with a configuration file pointing to the DVD.
* Remove all the cached repo files from ``/var/lib/lorax/composer/repos/`` * Remove all the cached repo files from ``/var/lib/lorax/composer/repos/``
* Restart the ``lorax-composer.service`` * Restart the ``lorax-composer.service``
* Check the output of ``composer-cli status show`` for any output specific depsolve errors. * Check the output of ``composer status show`` for any output specific depsolve errors.
For example, the DVD usually does not include ``grub2-efi-*-cdboot-*`` so the live-iso image For example, the DVD usually does not include ``grub2-efi-*-cdboot-*`` so the live-iso image
type will not be available. type will not be available.

View File

@ -1,4 +1,4 @@
# bash completion for composer-cli # bash completion for composer
__composer_cli_flags="-h --help -j --json -s --socket --log -a --api --test -V" __composer_cli_flags="-h --help -j --json -s --socket --log -a --api --test -V"
@ -16,19 +16,19 @@ __composer_socket_ok() {
} }
__composer_blueprints() { __composer_blueprints() {
__composer_socket_ok && composer-cli blueprints list __composer_socket_ok && composer blueprints list
} }
__composer_sources() { __composer_sources() {
__composer_socket_ok && composer-cli sources list __composer_socket_ok && composer sources list
} }
__composer_compose_types() { __composer_compose_types() {
__composer_socket_ok && composer-cli compose types __composer_socket_ok && composer compose types
} }
__composer_composes() { __composer_composes() {
__composer_socket_ok && composer-cli compose list $@ | while read id rest; do echo $id; done __composer_socket_ok && composer compose list $@ | while read id rest; do echo $id; done
} }
__word_in_list() { __word_in_list() {
@ -39,7 +39,7 @@ __word_in_list() {
return 1 return 1
} }
_composer_cli() { _composer() {
local cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" local cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
local w="" wi=0 cmd="__NONE__" subcmd="__NONE__" cmd_cword=0 local w="" wi=0 cmd="__NONE__" subcmd="__NONE__" cmd_cword=0
@ -140,4 +140,4 @@ _composer_cli() {
fi fi
} }
complete -F _composer_cli composer-cli complete -F _composer composer

View File

@ -225,9 +225,9 @@ getent passwd weldr >/dev/null 2>&1 || useradd -r -g weldr -d / -s /sbin/nologin
%attr(0771, weldr, weldr) %{_sharedstatedir}/lorax/composer/blueprints/* %attr(0771, weldr, weldr) %{_sharedstatedir}/lorax/composer/blueprints/*
%files -n composer-cli %files -n composer-cli
%{_bindir}/composer-cli %{_bindir}/composer
%{python3_sitelib}/composer/* %{python3_sitelib}/composer/*
%{_sysconfdir}/bash_completion.d/composer-cli %{_sysconfdir}/bash_completion.d/composer
%changelog %changelog
* Fri Sep 07 2018 Brian C. Lane <bcl@redhat.com> 29.15-1 * Fri Sep 07 2018 Brian C. Lane <bcl@redhat.com> 29.15-1

View File

@ -23,7 +23,7 @@ data_files.append(("/usr/sbin", ["src/sbin/lorax", "src/sbin/mkefiboot",
"src/sbin/livemedia-creator", "src/sbin/lorax-composer"])) "src/sbin/livemedia-creator", "src/sbin/lorax-composer"]))
data_files.append(("/usr/bin", ["src/bin/image-minimizer", data_files.append(("/usr/bin", ["src/bin/image-minimizer",
"src/bin/mk-s390-cdboot", "src/bin/mk-s390-cdboot",
"src/bin/composer-cli"])) "src/bin/composer"]))
# get the version # get the version
sys.path.insert(0, "src") sys.path.insert(0, "src")

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
# #
# composer-cli # composer
# #
# Copyright (C) 2018 Red Hat, Inc. # Copyright (C) 2018 Red Hat, Inc.
# #
@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
import os import os
import sys import sys

View File

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# #
# composer-cli # composer
# #
# Copyright (C) 2018 Red Hat, Inc. # Copyright (C) 2018 Red Hat, Inc.
# #

View File

@ -1,5 +1,5 @@
# #
# composer-cli # composer
# #
# Copyright (C) 2018 Red Hat, Inc. # Copyright (C) 2018 Red Hat, Inc.
# #
@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
from composer.cli.blueprints import blueprints_cmd from composer.cli.blueprints import blueprints_cmd
from composer.cli.modules import modules_cmd from composer.cli.modules import modules_cmd
@ -44,7 +44,7 @@ def main(opts):
""" """
# Making sure opts.args is not empty (thus, has a command and subcommand) # Making sure opts.args is not empty (thus, has a command and subcommand)
# is already handled in src/bin/composer-cli. # is already handled in src/bin/composer.
if opts.args[0] not in command_map: if opts.args[0] not in command_map:
log.error("Unknown command %s", opts.args[0]) log.error("Unknown command %s", opts.args[0])
return 1 return 1

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
import os import os

View File

@ -24,7 +24,7 @@ from composer.cli.help import epilog
VERSION = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum) VERSION = "{0}-{1}".format(os.path.basename(sys.argv[0]), vernum)
def composer_cli_parser(): def composer_cli_parser():
""" Return the ArgumentParser for composer-cli""" """ Return the ArgumentParser for composer"""
parser = argparse.ArgumentParser(description="Lorax Composer commandline tool", parser = argparse.ArgumentParser(description="Lorax Composer commandline tool",
epilog=epilog, epilog=epilog,
@ -36,7 +36,7 @@ def composer_cli_parser():
parser.add_argument("-s", "--socket", default="/run/weldr/api.socket", metavar="SOCKET", parser.add_argument("-s", "--socket", default="/run/weldr/api.socket", metavar="SOCKET",
help="Path to the socket file to listen on") help="Path to the socket file to listen on")
parser.add_argument("--log", dest="logfile", default=None, metavar="LOG", parser.add_argument("--log", dest="logfile", default=None, metavar="LOG",
help="Path to logfile (./composer-cli.log)") help="Path to logfile (./composer.log)")
parser.add_argument("-a", "--api", dest="api_version", default="0", metavar="APIVER", parser.add_argument("-a", "--api", dest="api_version", default="0", metavar="APIVER",
help="API Version to use") help="API Version to use")
parser.add_argument("--test", dest="testmode", default=0, type=int, metavar="TESTMODE", parser.add_argument("--test", dest="testmode", default=0, type=int, metavar="TESTMODE",

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
from datetime import datetime from datetime import datetime
import sys import sys
@ -186,7 +186,7 @@ def compose_types(socket_path, api_version, args, show_json=False, testmode=0):
:param testmode: unused in this function :param testmode: unused in this function
:type testmode: int :type testmode: int
Add additional details to types that are known to composer-cli. Raw JSON output does not Add additional details to types that are known to composer. Raw JSON output does not
include this extra information. include this extra information.
""" """
api_route = client.api_url(api_version, "/compose/types") api_route = client.api_url(api_version, "/compose/types")

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
from composer import http_client as client from composer import http_client as client
from composer.cli.help import modules_help from composer.cli.help import modules_help

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
import textwrap import textwrap

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
import os import os

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
from composer import http_client as client from composer import http_client as client
from composer.cli.help import status_help from composer.cli.help import status_help

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
import json import json

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import logging import logging
log = logging.getLogger("composer-cli") log = logging.getLogger("composer")
import os import os
import sys import sys