Skip to content

Commit

Permalink
Merge pull request #1 from rjfd/wip-rename-sesboot
Browse files Browse the repository at this point in the history
Renamed project to ceph-bootstrap
  • Loading branch information
rjfd authored Dec 11, 2019
2 parents a4df35f + 809e403 commit 631543c
Show file tree
Hide file tree
Showing 16 changed files with 83 additions and 717 deletions.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: python
python:
- "3.6"
- "3.7"
install:
- pip install -r requirements.txt
script:
- pytest -s --cov -vv
- pylint ceph_bootstrap
- pycodestyle ceph_bootstrap
# linting tests code
- pylint tests
- pycodestyle tests

after_success:
- codecov
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- `sesboot`: CLI tool
- RPM spec file.
- Minimal README with a few usage instructions.
- Minimal README.
- The CHANGELOG file.

[unreleased]: https://github.com/rjfd/sesdev/compare/v0.0.1...HEAD
[0.0.1]: https://github.com/rjfd/sesdev/releases/tag/v0.0.1
[unreleased]: https://github.com/SUSE/ceph-bootstrap/compare/v0.0.1...HEAD
[0.0.1]: https://github.com/SUSE/ceph-bootstrap/releases/tag/v0.0.1
695 changes: 21 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sesboot - CLI tool to deploy SES/Ceph clusters <br/> [![Actions Status](https://github.com/rjfd/sesboot/workflows/Linting/badge.svg)](https://github.com/rjfd/sesboot/actions) [![Actions Status](https://github.com/rjfd/sesboot/workflows/Testing/badge.svg)](https://github.com/rjfd/sesboot/actions)
# ceph-bootstrap - CLI tool to deploy SES/Ceph clusters <br/> [![Build Status](https://travis-ci.com/SUSE/ceph-bootstrap.svg?branch=master)](https://travis-ci.com/SUSE/ceph-bootstrap) [![codecov](https://codecov.io/gh/SUSE/ceph-bootstrap/branch/master/graph/badge.svg)](https://codecov.io/gh/SUSE/ceph-bootstrap)

`sesboot` is a CLI tool to deploy Ceph clusters (both the upstream and SUSE
downstream versions).
`ceph-bootstrap` is a CLI tool to deploy Ceph clusters (both the upstream and SUSE
downstream versions) using Salt.
15 changes: 8 additions & 7 deletions sesboot.spec → ceph-bootstrap.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
%{python_enable_dependency_generator}
%endif

Name: sesboot
Name: ceph-bootstrap
Version: 0.0.1
Release: 1%{?dist}
Summary: CLI tool to deploy SES clusters
Summary: CLI tool to deploy Ceph clusters
License: GPL-3.0
%if 0%{?suse_version}
Group: System/Management
%endif
URL: https://github.com/rjfd/sesboot
URL: https://github.com/SUSE/ceph-bootstrap
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
BuildArch: noarch

Expand All @@ -49,11 +49,12 @@ Requires: python3-setuptools
Requires: python3-salt >= 2019.2.0
%endif

Requires: ses-formula
Requires: ceph-salt-formula
Requires: salt-master >= 2019.2.0

%description
sesboot is a CLI tool for deploying SES clusters.
ceph-bootstrap is a CLI tool for deploying Ceph clusters starting from version
Octopus.

%prep
%autosetup -n %{name}-%{version} -p1
Expand All @@ -68,8 +69,8 @@ sesboot is a CLI tool for deploying SES clusters.
%files
%license LICENSE
%doc CHANGELOG.md README.md
%{python3_sitelib}/sesboot*/
%{_bindir}/sesboot
%{python3_sitelib}/ceph_bootstrap*/
%{_bindir}/ceph-bootstrap

%changelog

16 changes: 8 additions & 8 deletions sesboot/__init__.py → ceph_bootstrap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pkg_resources

from .config_shell import run_config_cmdline, run_config_shell
from .exceptions import SesBootException
from .exceptions import CephBootstrapException

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -44,11 +44,11 @@ def _setup_logging(log_level, log_file):
})


def sesboot_main():
def ceph_bootstrap_main():
try:
# pylint: disable=unexpected-keyword-arg,no-value-for-parameter
cli(prog_name='sesboot')
except SesBootException as ex:
cli(prog_name='ceph-bootstrap')
except CephBootstrapException as ex:
logger.exception(ex)
click.echo(str(ex))

Expand All @@ -57,10 +57,10 @@ def sesboot_main():
@click.option('-l', '--log-level', default='info',
type=click.Choice(["info", "error", "debug", "silent"]),
help="set log level (default: info)")
@click.option('--log-file', default='/var/log/sesboot.log',
@click.option('--log-file', default='/var/log/ceph-bootstrap.log',
type=click.Path(dir_okay=False),
help="the file path for the log to be stored")
@click.version_option(pkg_resources.get_distribution('sesboot'), message="%(version)s")
@click.version_option(pkg_resources.get_distribution('ceph-bootstrap'), message="%(version)s")
def cli(log_level, log_file):
_setup_logging(log_level, log_file)

Expand All @@ -69,7 +69,7 @@ def cli(log_level, log_file):
@click.argument('config_args', nargs=-1, type=click.UNPROCESSED, required=False)
def config_shell(config_args):
"""
Starts sesboot configuration shell
Starts ceph-bootstrap configuration shell
"""
if config_args:
run_config_cmdline(" ".join(config_args))
Expand All @@ -78,4 +78,4 @@ def config_shell(config_args):


if __name__ == '__main__':
sesboot_main()
ceph_bootstrap_main()
21 changes: 11 additions & 10 deletions sesboot/config_shell.py → ceph_bootstrap/config_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def possible_values(self):
return [n.minion_id for n in SesNodeManager.ses_nodes().values()]


SESBOOT_OPTIONS = {
CEPH_BOOTSTRAP_OPTIONS = {
'Cluster': {
'help': '''
Cluster Options Configuration
Expand Down Expand Up @@ -467,11 +467,11 @@ def possible_values(self):
}


class SesBootRoot(configshell.ConfigNode):
class CephBootstrapRoot(configshell.ConfigNode):
help_intro = '''
sesboot Configuration
ceph-bootstrap Configuration
=====================
This is a shell where you can manipulate sesboot's configuration.
This is a shell where you can manipulate ceph-bootstrap's configuration.
Each configuration option is present under a configuration group.
You can navigate through the groups and options using the B{ls} and
B{cd} commands as in a typical shell.
Expand Down Expand Up @@ -745,15 +745,16 @@ def _generate_group_node(group_name, group_dict, parent):


def generate_config_shell_tree(shell):
root_node = SesBootRoot(shell)
for group_name, group_dict in SESBOOT_OPTIONS.items():
root_node = CephBootstrapRoot(shell)
for group_name, group_dict in CEPH_BOOTSTRAP_OPTIONS.items():
_generate_group_node(group_name, group_dict, root_node)


class SesBootConfigShell(configshell.ConfigShell):
class CephBootstrapConfigShell(configshell.ConfigShell):
# pylint: disable=anomalous-backslash-in-string
def __init__(self):
super(SesBootConfigShell, self).__init__('~/.sesboot_config_shell')
super(CephBootstrapConfigShell, self).__init__(
'~/.ceph_bootstrap_config_shell')
# Grammar of the command line
command = locatedExpr(Word(alphanums + '_'))('command')
var = Word(alphanums + ';,=_\+/.<>()~@:-%[]*{}" ') # adding '*'
Expand All @@ -771,7 +772,7 @@ def __init__(self):


def run_config_shell():
shell = SesBootConfigShell()
shell = CephBootstrapConfigShell()
generate_config_shell_tree(shell)
while True:
try:
Expand All @@ -783,7 +784,7 @@ def run_config_shell():


def run_config_cmdline(cmdline):
shell = SesBootConfigShell()
shell = CephBootstrapConfigShell()
generate_config_shell_tree(shell)
try:
logger.info("running command: %s", cmdline)
Expand Down
4 changes: 2 additions & 2 deletions sesboot/exceptions.py → ceph_bootstrap/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class SesBootException(Exception):
class CephBootstrapException(Exception):
pass


class SesNodeHasRolesException(SesBootException):
class SesNodeHasRolesException(CephBootstrapException):
def __init__(self, minion_id, roles):
super(SesNodeHasRolesException, self).__init__(
"Cannot remove host '{}' because it has roles defined: {}".format(minion_id, roles))
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.
codecov==2.0.15
mock==3.0.5
pycodestyle==2.5.0
pyfakefs==3.7
Expand Down
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[metadata]
name = sesboot
summary = CLI tool to bootstrap SES clusters
name = ceph-bootstrap
summary = CLI tool to bootstrap Ceph clusters
description-file =
README.md
CHANGES.md
home-page = https://github.com/rjfd/sesboot
home-page = https://github.com/SUSE/ceph-bootstrap
requires-dist = setuptools
license = MIT License
license_file = LICENSE
Expand All @@ -28,7 +28,7 @@ install_requires =
salt >= 2019.2.0

packages =
sesboot
ceph_bootstrap

tests_require =
pytest
Expand All @@ -41,7 +41,7 @@ test=pytest

[options.entry_points]
console_scripts =
sesboot = sesboot:sesboot_main
ceph-bootstrap = ceph_bootstrap:ceph_bootstrap_main

[options.extras_require]
dev =
Expand All @@ -63,7 +63,7 @@ testpaths = tests

[coverage:paths]
source =
sesboot
ceph_bootstrap

[coverage:run]
omit =
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def get_version_from_spec():
this_dir = os.path.dirname(__file__)
with open(os.path.join(this_dir, 'sesboot.spec'), 'r') as file:
with open(os.path.join(this_dir, 'ceph-bootstrap.spec'), 'r') as file:
while True:
line = file.readline()
if not line:
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self, methodName='runTest'):
def setUp(self):
super(SaltMockTestCase, self).setUp()
self.setUpPyfakefs()
patcher = patch('sesboot.salt_utils.SaltClient', new_callable=SaltClientMock)
patcher = patch('ceph_bootstrap.salt_utils.SaltClient', new_callable=SaltClientMock)
self.local_client = patcher.start()
SaltClientMock.local_fs = self.fs
self.fs.create_dir(SaltClientMock.pillar_fs_path())
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grains_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sesboot.salt_utils import GrainsManager
from ceph_bootstrap.salt_utils import GrainsManager
from . import SaltMockTestCase


Expand Down
2 changes: 1 addition & 1 deletion tests/test_pillar_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from sesboot.salt_utils import PillarManager
from ceph_bootstrap.salt_utils import PillarManager
from . import SaltMockTestCase, SaltClientMock as SaltClient


Expand Down

0 comments on commit 631543c

Please sign in to comment.