/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2012-05-05 09:17:34 UTC
  • mto: This revision was merged to the branch mainline in revision 570.
  • Revision ID: teddy@recompile.se-20120505091734-6ax38hc7091lotfm
* mandos-ctl (main): Use helper functions to shorten code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#     GNU General Public License for more details.
18
18
19
19
# You should have received a copy of the GNU General Public License
20
 
# along with this program.  If not, see
21
 
# <http://www.gnu.org/licenses/>.
 
20
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
21
23
22
# Contact the authors at <mandos@recompile.se>.
24
23
26
25
from __future__ import (division, absolute_import, print_function,
27
26
                        unicode_literals)
28
27
 
29
 
from future_builtins import *
30
 
 
31
28
import sys
32
29
import dbus
33
30
import argparse
63
60
server_path = "/"
64
61
server_interface = domain + ".Mandos"
65
62
client_interface = domain + ".Mandos.Client"
66
 
version = "1.6.0"
 
63
version = "1.5.3"
67
64
 
68
65
def timedelta_to_milliseconds(td):
69
66
    """Convert a datetime.timedelta object to milliseconds"""
119
116
        if type(value) is dbus.Boolean:
120
117
            return "Yes" if value else "No"
121
118
        if keyword in ("Timeout", "Interval", "ApprovalDelay",
122
 
                       "ApprovalDuration", "ExtendedTimeout"):
 
119
                       "ApprovalDuration"):
123
120
            return milliseconds_to_string(value)
124
121
        return unicode(value)
125
122
    
210
207
    parser.add_argument("client", nargs="*", help="Client name")
211
208
    options = parser.parse_args()
212
209
    
213
 
    if has_actions(options) and not (options.client or options.all):
 
210
    if has_actions(options) and not options.client and not options.all:
214
211
        parser.error("Options require clients names or --all.")
215
212
    if options.verbose and has_actions(options):
216
213
        parser.error("--verbose can only be used alone or with"