Skip to content

Commit 51e53ae

Browse files
committed
Updates to readme and lint fixes
1 parent e456fa7 commit 51e53ae

5 files changed

Lines changed: 47 additions & 8 deletions

File tree

README.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,38 @@ rhos-bootstrap
55

66
.. |CI Status| image:: https://github.com/mwhahaha/rhos-bootstrap/actions/workflows/py-tox.yml/badge.svg
77
:target: https://github.com/mwhahaha/rhos-bootstrap/actions
8+
9+
A bootstrap tool used to handle repository, dnf module configuration, and
10+
tripleoclient installation in preparation for a Red Hat OpenStack installation.
11+
12+
Usage
13+
~~~~~
14+
15+
::
16+
17+
usage: rhos-bootstrap [-h] [--skip-validation] [--skip-repos]
18+
[--skip-ceph-install] [--skip-modules]
19+
[--update-packages] [--skip-client-install] [--debug]
20+
version
21+
22+
Perform basic bootstrap related functions when installing, updating, or
23+
upgrading OpenStack on Red Hat based systems. This tool can manage RPM
24+
repository and dnf module configurations. This tool can also be used to
25+
install tripleoclient and perform repository validations for the target
26+
version
27+
28+
positional arguments:
29+
version The target OpenStack version to configure this system
30+
to use when fetching packages.
31+
32+
optional arguments:
33+
-h, --help show this help message and exit
34+
--skip-validation Skip version validation
35+
--skip-repos Skip repository configuration related actions
36+
--skip-ceph-install Skip ceph related configuration actions
37+
--skip-modules Skip module configuration related actions
38+
--update-packages Perform a system update after configuring the system
39+
repositories and modules configuration.
40+
--skip-client-install
41+
Skip tripleoclient installation
42+
--debug Enable debug logging

contrib/rhos-bootstrap.spec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Requires: python3-requests
2727
%{?python_provide:%python_provide python3-%{name}}
2828

2929
%description
30-
Red Hat OpenStack bootstrap utility
30+
A bootstrap tool used to handle repository, dnf module configuration, and
31+
tripleoclient installation in preparation for a Red Hat OpenStack installation.
3132

3233
# ---------------
3334
# Setup

rhos_bootstrap/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BootstrapCli:
3131

3232
def __init__(self):
3333
self._parser = argparse.ArgumentParser(
34-
description="Perform basic bootrstrap related functions when "
34+
description="Perform basic bootstrap related functions when "
3535
"installing, updating, or upgrading OpenStack on "
3636
"Red Hat based systems. This tool can manage "
3737
"RPM repository and dnf module configurations. This "

rhos_bootstrap/distribution.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,18 @@ def __init__(
4040
"""Distribution Information class"""
4141
_id, _version_id, _name = (None, None, None)
4242
if not distro_id or not distro_version_id or not distro_name:
43-
output = subprocess.Popen(
44-
"source /etc/os-release && " 'echo -e -n "$ID\n$VERSION_ID\n$NAME"',
43+
cmd = "source /etc/os-release && " 'echo -e -n "$ID\n$VERSION_ID\n$NAME"'
44+
with subprocess.Popen(
45+
cmd,
4546
shell=True,
4647
stdout=subprocess.PIPE,
47-
stderr=open(os.devnull, "w"),
48+
stderr=subprocess.DEVNULL,
4849
executable="/bin/bash",
4950
universal_newlines=True,
50-
).communicate()
51-
_id, _version_id, _name = output[0].split("\n")
51+
) as proc:
52+
output = proc.communicate()
53+
print(output)
54+
_id, _version_id, _name = output[0].split("\n")
5255

5356
self._distro_id = distro_id or _id
5457
self._distro_version_id = distro_version_id or _version_id

tests/unit/test_distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_data(self, exists_mock):
124124
proc_mock = mock.MagicMock()
125125
comm_mock = mock.MagicMock()
126126
comm_mock.return_value = ["rhel\n8.2\nRed Hat Enterprise Linux"]
127-
proc_mock.communicate = comm_mock
127+
proc_mock.__enter__.return_value.communicate = comm_mock
128128
popen_mock.return_value = proc_mock
129129
obj = distribution.DistributionInfo()
130130
self.assertEqual(obj.distro_id, "rhel")

0 commit comments

Comments
 (0)