| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
We have changed the API from Datera configshell, so we should be using
a different package name to eliminate confusion.
Still package under configshell pkg name, but issue a warning to switch.
Change code in shell.py to use relative imports instead of package name.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
| |
Later on in the function, we assume "parameter" is still the dict that
was passed in.
Reported-by: Fabian Deutsch <fdeutsch@redhat.com>
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A node named "foo4" will match the regexp in sorting_keys and will sort by
("foo", 4). A node named "foo" will not match and will sort by
("foo", None).
This is incorrect because None is not orderable with integers. In the
second case, having the second element in the tuple be 0 does the
right thing.
Fixes #14
Reported-by: Arthur Lutz
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "get attribute" command displays an error message after the list
of attributes. For instance, in the TPG context, the following error
is displayed:
No parameter 't' in group 'attribute'
This happens because the 'parameter' argument in ui_command_get() is
overwritten in the loop that iterates over the list of parameters to
display their value. This patch fixes the issue by renaming the
variable in the loop so that the value of the original 'parameter'
variable is preserved.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
|
|
|
|
|
|
| |
To follow-on Christophe's previous fix, now that the previous conditional
returns, it's a little easier to follow (IMHO) if the next conditional
is an 'if' instead of an 'elif'.
Also, add an empty line.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
| |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
|
|
| |
Arrg. Can't reference self in a default parameter.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
| |
An earlier version of the commit used it, but its use was removed in the
final commit. Whups.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
Extend con.display() with an error boolean optional parameter. If true,
output goes to stderr. Is this in log._log() to send messages >= 'error'
to stderr.
This is based on work by Tregaron Bayly and Jason Earl at Bluehost, thanks.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change logic in run_interactive() to not recursively call itself, and to
let exceptions through to callers.
Raising ExecutionError instead of printing a message but not raising an
exception is now allowed. This lets us reorganize a few functions for
less nested logic.
Change log.error()s to exceptions.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A very nice behavior is having <tab><tab> bring up options for the next
expected commandline token when nothing is underneath the cursor. There was
a workaround to get this working with the simpleparse parser, and we need
a different workaround for it to work with pyparsing.
This keeps the same technique of adding a bogus input and seeing what the
parser would categorize it as, and then setting current_token based on
that.
We also ensure current_token is defined. Without this, the call to
_dispatch_completion fails with a NameError but somebody catches the
error so things just silently don't work, without the debug msg in
_dispatch_completion for unknown current_token ever printing.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With Python 2, '/' returns the floor of the mathematical result of
division if the arguments are ints. With Python 3, the operator
returns a reasonable approximation of the mathematical result of the
division.
This commit uses '//', which is the floor division operator in both
Python 2 and Python 3, so that the result can be safely used to index
an array.
For more details, see PEP 238 "changing the division operator"
http://www.python.org/dev/peps/pep-0238
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
| |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
| |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
|
|
| |
Generated with `2to3 -f except`.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Configshell uses simpleparse to parse the command line. Unfortunately,
simpleparse does not seem to be maintained anymore: the last release
was three years ago. Moreover, simpleparse is not widely used (on
Debian, only configshell depends on it).
On the other hand, pyparsing is actively maintained, widely used and
ready for Python 3. So let's use it.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
|
|
| |
Also update the package name, version, URL and maintainer.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|\
| |
| |
| |
| | |
Conflicts:
README
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch converts configshell code copyright from AGPL to the
permissive Apache License 2.0.
It also update copyright owner to Datera, Inc.
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
|
| |
| |
| |
| | |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | | |
sorting_keys is already a function.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|/ /
| |
| |
| |
| |
| |
| | |
I have a feeling that urwid has a more elegant way to handle scrolling
behavior, but it wasn't very obvious, so this works.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| | |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| | |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| |
| | |
We actually want to sort by non-ending-numeric part first, and *then* sort
by ending number.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| |
| | |
Sort (lun1, lun2, lun10) as (lun1, lun2, lun10) instead of
(lun1, lun10, lun2).
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| |
| | |
It seems to be brownish, but whatever, it's better than blue, which is
also used for debug level.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| | |
That's all anyone is looking at.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| | |
"param" and "type" are never used, so they can be removed.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| |
| | |
I put the epydoc import in a try block, but forgot to remove the original
import.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| | |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| |
| | |
Importing readline emits escape sequences to stdout. We want to avoid this
when output is not to a tty.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| | |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| |
| | |
It was returning the same value for multiple default params (since index
was not being incremented).
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
| |
| |
| |
| |
| |
| | |
If invoked with run_cmdline instead of run_interactive, the shell may not
be interactive, in which case the helptext would be misleading.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|/
|
|
|
|
|
|
| |
It's a little excessive to require the entire epydoc package so that
configshell can output italic/bold help text. If it's present, use it,
but otherwise just print plaintext.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
| |
* Default max width is now 132 cols.
* Now also works with non-terminal device, problem was reported by
"Pál Gergely" <nightw@niif.hu>
|
| |
|
| |
|
|
|
|
|
|
|
| |
* Replaces 'is' by '==' for string test.
* Explicitely looks for a ConfigNode to change current node.
* Added debugging output.
* Raise an exception on unexpected result.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Moved ConfigNode add_child to child's __init__
. Better semantics matching actual usage.
. Allows to skip many checks in add_child.
. Knowing parent at __init__ time will allow to access some of its
attributes during __init__, useful for actual usage.
. Removed _set_name, _set_parent and corresponding setter properties.
. Added ConfigNode.remove_child().
* Moved shell property to ConfigNode.
. Root node attaches itself to a shell during __init__.
. Each node can use con, log and prefs through the shell property.
* Linebreaks cleanup: removed unneccessary backslashes.
* Catching setting signal handler failure in thread.
* Changed a list concat (l1+l2) to use l1.extend(l2).
|
|
|
|
|
|
|
|
|
|
| |
* Error messages are now more descriptive regrading wrong parameters errors.
* Used to catch TypeError exception after the fact, without distinguishing
between actually wrong user-supplied parameters from improper function calls
from within our code. Also, was based on greping substrigns in the TypeError
message, which is fragile and hackish.
* Does not catch TypeError anymore, instead added an assert_params() method
that check the user parameters agains the command method before calling it.
|
| |
|
|
|
|
|
|
|
| |
* Direct access is fragile and causes issues when changing
the data structure for parameters. Wrapped it in helper
methods get_group_param(), list_group_params(), list_config_groups()
and define_config_group_param().
|
|
|
|
|
|
| |
* Fixed set param value auto completion
* Fixed get/set group usage of param types
* Some variable naming cleanup for consistency
|
|
|
|
| |
* Use type names instead.
|
| |
|
|
|
|
|
|
| |
* Only use writable ones for set operations.
* Changed a few messages accrodingly.
* Display the params [ro] status in 'get GROUP'.
|