summaryrefslogtreecommitdiff
path: root/configshell/prefs.py
Commit message (Collapse)AuthorAgeFilesLines
* Don't warn if prefs file doesn't existTim Serong2020-05-011-1/+2
| | | | | | | | | | | | The first time configshell is used, prefs.bin won't exist, so you'll see something like: Warning: Could not load preferences file /root/.whatever/prefs.bin. If the file doesn't actually exist, this warning is just confusing, so I've added an existence check to Prefs.load() Signed-off-by: Tim Serong <tserong@suse.com>
* Acquire a lock to a preference file before working with itAndrei Vagin2018-03-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we can meet a situation, when one process is writing a file, but another one tries to read the same file: prefs.py:147:load:EOFError Traceback (most recent call last): File "/usr/bin/targetcli", line 121, in <module> main() File "/usr/bin/targetcli", line 77, in main shell = TargetCLI('~/.targetcli') File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 176, in __init__ self.prefs.load() File "/usr/lib/python2.7/site-packages/configshell_fb/prefs.py", line 147, in load self._prefs = six.moves.cPickle.load(fsock) EOFError Local variables in innermost frame: self: <configshell_fb.prefs.Prefs object at 0x1077550> fsock: <closed file '/root/.targetcli/prefs.bin', mode 'rb' at 0x1058300> filename: '/root/.targetcli/prefs.bin' Signed-off-by: Andrei Vagin <avagin@openvz.org>
* Support Python 3 with "six" instead of running `2to3`Christophe Vu-Brugier2015-06-031-4/+4
| | | | | | | | | | | | | | | * Replace dict.iteritems() with six.iteritems(dict) * Use six.string_types instead of basestring * Remove calls to unicode() in the handle_input() function called by Urwid: it is not necessary. However, during my tests, I observed that the Urwid listbox displayed for `cd` is broken: I see garbage on the screen when moving the cursor. * Use six.moves to import pickle on Python 3 or cPickle on Python 2 * Use six.moves to call input() on Python 3 or raw_input() on Python 2 * Add classifiers to setup.py * Sort imports Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
* configshell: Change copyright to Apache License 2.01.2upstreamNicholas Bellinger2013-07-041-11/+11
| | | | | | | | | 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>
* Initial configshell commit0.9Nicholas Bellinger2011-05-041-0/+149
Signed-off-by: Nicholas A. Bellinger <nab@risingtidesystems.com>