force not using systemctl if not present - suggested by Ciro for ubuntu
[sfa.git] / clientbin / sfiListNodes.py
1 #! /usr/bin/env python
2
3 import sys
4
5 from sfa.client.sfi_commands import Commands
6
7 from sfa.rspecs.rspec import RSpec
8
9 from sfa.planetlab.plxrn import xrn_to_hostname 
10
11 command = Commands(usage="%prog [options]",
12                    description="List all nodes in the RSpec. " + 
13                    "Use this to display the list of nodes on which it is " + 
14                    "possible to create a slice.")
15 command.prep()
16
17 if command.opts.infile:
18     rspec = RSpec(command.opts.infile)
19     nodes = rspec.version.get_nodes()
20     if command.opts.outfile:
21         sys.stdout = open(command.opts.outfile, 'w')
22     
23     for node in nodes:
24         hostname = None
25         if node.get('component_id'):
26             hostname = xrn_to_hostname(node['component_id'])
27         if hostname:
28             print hostname 
29
30
31
32