Skip to content

Commit

Permalink
ifquery: Add config loading and basic logic
Browse files Browse the repository at this point in the history
There's still lots more logic missing, but we're making progress.

Signed-off-by: Kyle Moffett <[email protected]>
  • Loading branch information
kmoffett committed Jan 2, 2013
1 parent fe21b6f commit 8b4c2cb
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ifupdown_ng/commands/ifquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import argparse

from ifupdown_ng import args
from ifupdown_ng import config
from ifupdown_ng import logging
from ifupdown_ng.commands import common

class IfQueryCommandHandler(common.CommonCommandHandler):
Expand All @@ -39,5 +41,23 @@ def __init__(self, command):
help=argparse.SUPPRESS)

def execute(self):
## Do not run any commands in this mode
args.no_act = True
print "BLARG QUERY ME HARDER"

## Check for nonsensical option combinations
if not args.list and not args.iface:
self.argp.error('No interfaces specified in query')
if args.list and args.iface:
self.argp.error('Both --list and interfaces given')

## Load the configuration
sysconfig = config.SystemConfig()
sysconfig.load_interfaces_file()
sysconfig.log_total_errors(error=logging.fatal)

## Figure out what to do based on arguments
if args.list:
print "FIXME: LIST INTERFACES"
else:
ifaces = ', '.join(args.iface)
print "FIXME: QUERY INTERFACES: %s" % ifaces

0 comments on commit 8b4c2cb

Please sign in to comment.