Rearrange project layout

Changed project layout to be more in-line with the existing
OpenStack customs.

Specifically, the changes include:

* docs moved under doc/source/ and build tox target added
* licensing note added in all source files concistently
* setuptool harness changed to run along with pbr
* some manually added text files removed in favor of pbr-generated
* stest harness added
* test-requirements.txt updated accordingly
* existing code PEP8'ed for tests to pass
* GitHub legacy removed
* Py2 support undeclared

Story: 2006608
Task: 36776
Change-Id: I851efb2b7166db16df77617d41c1771562bcc9a2
This commit is contained in:
Ilya Etingof 2020-01-23 18:52:46 +01:00
parent f1bfcef806
commit ef7e9b5001
40 changed files with 542 additions and 613 deletions

View File

@ -1,21 +0,0 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf
[*.bat]
indent_style = tab
end_of_line = crlf
[LICENSE]
insert_final_newline = false
[Makefile]
indent_style = tab

View File

@ -1,15 +0,0 @@
* sushycli version:
* Python version:
* Operating System:
### Description
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
### What I Did
```
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
```

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./sushycli/tests
top_dir=.

View File

@ -1,13 +0,0 @@
=======
Credits
=======
Development Lead
----------------
* khansa amrouni <khansa.amrouni@gmail.com>
Contributors
------------
None yet. Why not be the first?

View File

@ -1,128 +1,17 @@
.. highlight:: shell
If you would like to contribute to the development of OpenStack, you must
follow the steps in this page:
============
Contributing
============
http://docs.openstack.org/infra/manual/developers.html
Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.
If you already have a good understanding of how the system works and your
OpenStack accounts are set up, you can skip to the development workflow
section of this documentation to learn how changes to OpenStack should be
submitted for review via the Gerrit tool:
You can contribute in many ways:
http://docs.openstack.org/infra/manual/developers.html#development-workflow
Types of Contributions
----------------------
Pull requests submitted through GitHub will be ignored.
Report Bugs
~~~~~~~~~~~
Bugs should be filed in StoryBoard, not GitHub:
Report bugs at https://github.com/khansaAmrouni/sushycli/issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.
Fix Bugs
~~~~~~~~
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.
Implement Features
~~~~~~~~~~~~~~~~~~
Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.
Write Documentation
~~~~~~~~~~~~~~~~~~~
sushycli could always use more documentation, whether as part of the
official sushycli docs, in docstrings, or even on the web in blog posts,
articles, and such.
Submit Feedback
~~~~~~~~~~~~~~~
The best way to send feedback is to file an issue at https://github.com/khansaAmrouni/sushycli/issues.
If you are proposing a feature:
* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)
Get Started!
------------
Ready to contribute? Here's how to set up `sushycli` for local development.
1. Fork the `sushycli` repo on GitHub.
2. Clone your fork locally::
$ git clone git@github.com:your_name_here/sushycli.git
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
$ mkvirtualenv sushycli
$ cd sushycli/
$ python setup.py develop
4. Create a branch for local development::
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::
$ flake8 sushycli tests
$ python setup.py test or pytest
$ tox
To get flake8 and tox, just pip install them into your virtualenv.
6. Commit your changes and push your branch to GitHub::
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
7. Submit a pull request through the GitHub website.
Pull Request Guidelines
-----------------------
Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check
https://travis-ci.org/khansaAmrouni/sushycli/pull_requests
and make sure that the tests pass for all supported Python versions.
Tips
----
To run a subset of tests::
$ python -m unittest tests.test_sushycli
Deploying
---------
A reminder for the maintainers on how to deploy.
Make sure all your changes are committed (including an entry in HISTORY.rst).
Then run::
$ bump2version patch # possible: major / minor / patch
$ git push
$ git push --tags
Travis will then deploy to PyPI if tests pass.
https://storyboard.openstack.org/#!/project/960

4
HACKING.rst Normal file
View File

@ -0,0 +1,4 @@
Sushy CLI Style Commandments
============================
Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/

View File

@ -1,8 +0,0 @@
=======
History
=======
0.1.0 (2020-01-07)
------------------
* First release on PyPI.

182
LICENSE
View File

@ -1,16 +1,176 @@
Apache Software License 2.0
Copyright (c) 2020, khansa amrouni
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
http://www.apache.org/licenses/LICENSE-2.0
1. Definitions.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

View File

@ -1,11 +0,0 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst
recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

74
doc/source/conf.py Executable file
View File

@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2020 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'openstackdocstheme'
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
copyright = u'2020, OpenStack Foundation'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
html_theme = 'openstackdocs'
# html_static_path = ['static']
# Output file base name for HTML help builder.
htmlhelp_basename = 'sushyclidoc'
latex_use_xindy = False
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index',
'doc-sushycli.tex',
u'Sushy CLI Documentation',
u'OpenStack Foundation', 'manual'),
]

View File

@ -0,0 +1,10 @@
.. _contributing:
=========================
Contributing to Sushy CLI
=========================
How to contribute
=================
.. include:: ../../../CONTRIBUTING.rst

View File

@ -1,17 +1,13 @@
Welcome to sushycli's documentation!
======================================
====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
readme
installation
usage
modules
contributing
authors
history
install/index
reference/usage
contributor/index
Indices and tables
==================

View File

@ -0,0 +1,12 @@
====================
Installing Sushy CLI
====================
At the command line::
$ pip install sushy-cli
Or, if you have virtualenvwrapper installed::
$ mkvirtualenv sushy-cli
$ pip install sushy-cli

View File

@ -1 +0,0 @@
.. include:: ../AUTHORS.rst

View File

@ -1,162 +0,0 @@
#!/usr/bin/env python
#
# sushycli documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import sushycli
# -- General configuration ---------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'sushycli'
copyright = "2020, khansa amrouni"
author = "khansa amrouni"
# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
# the built documents.
#
# The short X.Y version.
version = sushycli.__version__
# The full version, including alpha/beta/rc tags.
release = sushycli.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output -------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for HTMLHelp output ---------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sushyclidoc'
# -- Options for LaTeX output ------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, 'sushycli.tex',
'sushycli Documentation',
'khansa amrouni', 'manual'),
]
# -- Options for manual page output ------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'sushycli',
'sushycli Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'sushycli',
'sushycli Documentation',
author,
'sushycli',
'One line description of project.',
'Miscellaneous'),
]

View File

@ -1 +0,0 @@
.. include:: ../CONTRIBUTING.rst

View File

@ -1 +0,0 @@
.. include:: ../HISTORY.rst

View File

@ -1,51 +0,0 @@
.. highlight:: shell
============
Installation
============
Stable release
--------------
To install sushycli, run this command in your terminal:
.. code-block:: console
$ pip install sushycli
This is the preferred method to install sushycli, as it will always install the most recent stable release.
If you don't have `pip`_ installed, this `Python installation guide`_ can guide
you through the process.
.. _pip: https://pip.pypa.io
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/
From sources
------------
The sources for sushycli can be downloaded from the `Github repo`_.
You can either clone the public repository:
.. code-block:: console
$ git clone git://github.com/khansaAmrouni/sushycli
Or download the `tarball`_:
.. code-block:: console
$ curl -OJL https://github.com/khansaAmrouni/sushycli/tarball/master
Once you have a copy of the source, you can install it with:
.. code-block:: console
$ python setup.py install
.. _Github repo: https://github.com/khansaAmrouni/sushycli
.. _tarball: https://github.com/khansaAmrouni/sushycli/tarball/master

View File

@ -1,36 +0,0 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=python -msphinx
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=sushycli
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The Sphinx module was not found. Make sure you have Sphinx installed,
echo.then set the SPHINXBUILD environment variable to point to the full
echo.path of the 'sphinx-build' executable. Alternatively you may add the
echo.Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd

View File

@ -1 +0,0 @@
.. include:: ../README.rst

20
lower-constraints.txt Normal file
View File

@ -0,0 +1,20 @@
cliff==2.17.0
coverage==4.0
docutils==0.11
fixtures==3.0.0
flake8==2.5.5
hacking==1.0.0
mock==2.0.0
openstackdocstheme==1.20.0
oslotest==3.2.0 # Apache-2.0
pbr==2.0.0
pep8==1.5.7
pyflakes==0.8.1
Pygments==2.2.0
reno==2.5.0
Sphinx==1.6.2
sphinxcontrib-websupport==1.0.1
stevedore==1.29.0
stestr==2.0.0
sushy==3.0.0
testtools==2.2.0

View File

@ -1,12 +0,0 @@
pip==19.2.3
bump2version==0.5.11
wheel==0.33.6
watchdog==0.9.0
flake8==3.7.8
tox==3.14.0
coverage==4.5.4
Sphinx==1.8.5
twine==1.14.0
sushy==3.0.0
cliff==2.17.0

View File

@ -1,22 +1,53 @@
[bumpversion]
current_version = 0.1.0
commit = True
tag = True
[metadata]
name = sushy-cli
summary = Redfish CLI tool based on sushy Redfish client library
description-file =
README.rst
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/sushy-cli/latest/
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[files]
packages =
sushycli
[bumpversion:file:sushycli/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
[entry_points]
console_scripts =
sushycli = sushycli.cmd.sushycli:main
[bdist_wheel]
universal = 1
sushycli =
power_reset = sushycli.power_reset:PowerReset
version = sushycli.version:Version
[flake8]
exclude = docs
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1
warning-is-error = 1
[aliases]
# Define setup.py command aliases here
[upload_sphinx]
upload-dir = doc/build/html
[compile_catalog]
directory = sushycli/locale
domain = sushycli
[update_catalog]
domain = sushycli
output_dir = sushycli/locale
input_file = sushycli/locale/sushycli.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = sushycli/locale/sushycli.pot

View File

@ -1,57 +1,22 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
# Copyright 2010-2020 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from setuptools import setup, find_packages
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [ ]
setup_requirements = [ ]
test_requirements = [ ]
setup(
author="khansa amrouni",
author_email='khansa.amrouni@gmail.com',
python_requires='>=3.5',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
description="a Redfish command line interface client tool built on top of sushy library to manage Redfish BMC resources.",
install_requires=requirements,
license="Apache Software License 2.0",
long_description=readme + '\n\n' + history,
include_package_data=True,
keywords='sushycli',
name='sushycli',
packages=find_packages(include=['sushycli', 'sushycli.*']),
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/khansaAmrouni/sushycli',
version='0.1.0',
zip_safe=False,
entry_points={
'console_scripts': [
'sushycli = sushycli.main:main'
],
'sushy.cli': [
'version = sushycli.version:Version',
'power_reset = sushycli.power_reset:PowerReset',
],
},
)
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)

0
sushycli/cmd/__init__.py Normal file
View File

View File

@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2020 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sys
from cliff.app import App

View File

@ -1,53 +1,69 @@
import logging
# -*- coding: utf-8 -*-
# Copyright 2010-2020 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sushy
from cliff import command
class PowerReset(command.Command):
def get_parser(self, prog_name):
"""Command argument parsing."""
parser = super(PowerReset, self).get_parser(prog_name)
parser.add_argument('--user',
dest='user',
default='foo',
help='The user or login for authentication')
parser.add_argument('--password',
dest='password',
default='bar',
help='The password for authentication')
parser.add_argument('--rhost',
dest='rhost',
default='http://localhost:8000/redfish/v1/',
help='The address of the Redfish service; defaults'
+'to "http://localhost:8000/redfish/v1"')
parser.add_argument('--system',
dest='system',
default='437XR1138R2',
help='The ID of the system')
parser.add_argument('--type',
dest='power_mode',
default='on',
help='Specifying the type of action to perform'
+'"reset/shutOff.."; default mode is ON')
parser.add_argument(
'--user',
dest='user',
default='foo',
help='The user or login for authentication')
parser.add_argument(
'--password',
dest='password',
default='bar',
help='The password for authentication')
parser.add_argument(
'--rhost',
dest='rhost',
default='http://localhost:8000/redfish/v1/',
help='The address of the Redfish service; defaults'
'to "http://localhost:8000/redfish/v1"')
parser.add_argument(
'--system',
dest='system',
default='437XR1138R2',
help='The ID of the system')
parser.add_argument(
'--type',
dest='power_mode',
default='on',
help='Specifying the type of action to perform'
'"reset/shutOff.."; default mode is ON')
return parser
def take_action(self, parsed_args):
"""Command action."""
# Getting arguments
"""Command action"""
user = parsed_args.user
password = parsed_args.password
rhost = parsed_args.rhost
system = parsed_args.system
s = sushy.Sushy(rhost, username=user, password=password)
# Instantiate a system object
sys_inst = s.get_system('/redfish/v1/Systems/%s' %system)
# Performing reset action with the specified reset type from --type argument
sys_inst.reset_system(parsed_args.power_mode)
s = sushy.Sushy(rhost, username=user, password=password)
sys_inst = s.get_system('/redfish/v1/Systems/%s' % system)
sys_inst.reset_system(parsed_args.power_mode)

View File

@ -1 +0,0 @@
"""Main module."""

View File

View File

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslotest import base
class TestCase(base.BaseTestCase):
"""Test case base class for all unit tests"""

View File

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2020 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from sushycli.tests.unit import base
class SuchyCliTestCase(base.TestCase):
def test_main(self):
pass

View File

@ -1,19 +1,28 @@
import logging
# -*- coding: utf-8 -*-
import sushy
# Copyright 2010-2020 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from cliff.command import Command
import sushy
class Version (Command):
"A simple command that render the Redfish version."
log = logging.getLogger(__name__)
class Version(Command):
"""A simple command that render the Redfish version"""
def take_action(self, parsed_args):
self.log.info('Get the redfish version ..')
self.log.debug('debugging')
s = sushy.Sushy('http://localhost:8000/redfish/v1',
username='foo', password='bar')
return s.redfish_version
username='foo', password='bar')
return s.redfish_version

View File

@ -2,5 +2,11 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.0.0,<2.0.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
hacking>=1.0.0,<1.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
openstackdocstheme>=1.20.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
reno>=2.5.0 # Apache-2.0

View File

@ -1 +0,0 @@
"""Unit test package for sushycli."""

View File

@ -1,21 +0,0 @@
#!/usr/bin/env python
"""Tests for `sushycli` package."""
import unittest
from sushycli import sushycli
class TestSushycli(unittest.TestCase):
"""Tests for `sushycli` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"""Tear down test fixtures, if any."""
def test_000_something(self):
"""Test something."""

28
tox.ini
View File

@ -18,6 +18,28 @@ deps =
commands = stestr run {posargs}
stestr slowest
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:pdf-docs]
whitelist_externals = make
commands = sphinx-build -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --parallel-mode
# After running this target, visit sushycli/cover/index.html
# in your browser, to see a nicer presentation report with annotated
# HTML listings detailing missed lines.
commands = coverage erase
stestr run {posargs}
coverage combine
coverage report
coverage html
coverage xml -o cover/coverage.xml
[testenv:pep8]
commands = flake8 {posargs}
@ -27,3 +49,9 @@ show-source = True
ignore = E123, E125
builtins = _
exclude = .venv, .git, .tox, dist, doc, *lib/python*, *egg,build
[testenv:lower-constraints]
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt