added: some scripts, __str__ method for Nodes class

This commit is contained in:
adobdin 2016-04-18 10:41:54 +00:00
parent c0b798481c
commit 7e2abe63e5
7 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1 @@
../../cmds/fuel-environment-list

View File

@ -0,0 +1 @@
../../cmds/fuel-notifications

View File

@ -0,0 +1 @@
../../cmds/fuel-task-list

View File

@ -0,0 +1 @@
fuel environment list

View File

@ -0,0 +1 @@
fuel notifications -a

View File

@ -81,7 +81,6 @@ def main(argv=None):
extended=args.extended,
cluster=args.cluster,
)
# nodes.print_nodes()
if not args.only_logs:
n.get_node_file_list()
n.launch_ssh(config.outdir)
@ -102,7 +101,8 @@ def main(argv=None):
lock.unlock()
else:
logging.warning('Unable to obtain lock %s, skipping "logs"-part' % lf)
n.print_nodes()
logging.info("Nodes:\n%s" % n)
print(n)
return 0
if __name__ == '__main__':

View File

@ -358,6 +358,16 @@ class Nodes(object):
self.njdata = json.loads(self.get_nodes())
self.load_nodes()
def __str__ (self):
s = "#node-id, cluster, admin-ip, mac, os, roles, online, status\n"
for node in sorted(self.nodes.values(), key=lambda x: x.node_id):
if (self.cluster and (str(self.cluster) != str(node.cluster)) and
node.cluster != 0):
s += "#%s\n" % str(node)
else:
s += "%s\n" % str(node)
return s
def get_nodes(self):
fuel_node_cmd = 'fuel node list --json'
nodes_json, err, code = ssh_node(ip=self.fuelip,
@ -577,6 +587,7 @@ class Nodes(object):
def create_log_archives(self, outdir, timeout, fake=False):
if fake:
logging.info('create_log_archives: skip creating archives(fake:%s)' % fake)
return
threads = []
txtfl = []