def show_status(self, args):
        controller = control.VersaSDSSoftConsole()

        iter_service_status = controller.get_all_service_status()
        table_status = utils.Table()
        table_status.header = [
            'node', 'pacemaker', 'corosync', 'linstor-satellite', 'drbd',
            'linstor-controller'
        ]
        for i in iter_service_status:
            if args.node:
                if args.node == i[0]:
                    table_status.add_data(i)
                    break
            else:
                table_status.add_data(i)

        iter_version = controller.get_version('sysos', 'syskernel', 'drbd',
                                              'linstor', 'targetcli',
                                              'pacemaker')
        table_version = utils.Table()
        table_version.header = [
            'node', 'os_system', 'kernel', 'drbd_kernel_version', 'linstor',
            'targetcli', 'pacemaker'
        ]
        for i in iter_version:
            if args.node:
                if args.node == i[0]:
                    table_version.add_data(i)
                    break
            else:
                table_version.add_data(i)

        table_status.print_table()
        table_version.print_table()
Beispiel #2
0
    def show(self, args):
        controller = control.Scheduler()
        controller.get_ssh_conn()

        conf = utils.ConfFile()
        l_node = [i['hostname'] for i in conf.cluster['node']]
        l_ssh = ['T' if i else 'F' for i in controller.check_ssh_authorized()]
        l_hostname = ['T' if i else 'F' for i in controller.check_hostname()]
        l_corosync = ['T' if i else 'F' for i in controller.check_corosync()]
        l_packmaker = ['T' if i else 'F' for i in controller.check_packmaker()]
        l_targetcli = ['T' if i else 'F' for i in controller.check_targetcli()]
        l_service = ['T' if i else 'F' for i in controller.check_service()]

        table = utils.Table()
        table.header = [
            'node', 'ssh', 'hostname', 'corosync', 'pacemaker', 'targetcli',
            'service'
        ]
        for i in range(len(l_node)):
            table.add_data([
                l_node[i], l_ssh[i], l_hostname[i], l_corosync[i],
                l_packmaker[i], l_targetcli[i], l_service[i]
            ])

        table.print_table()
Beispiel #3
0
    def eligibility(self):
        try:
            table = utils.Table(self.soup.select("table[summary~=Land]")[0])
        except IndexError:
            return None

        return utils.clean(table["Eligibility"].text.strip())
Beispiel #4
0
    def check_version(self, args):
        controller = control.VersaSDSSoftConsole()
        iter_version = controller.get_version('drbd', 'linstor', 'targetcli',
                                              'pacemaker', 'corosync')

        dict_all = {
            'node': [],
            'drbd': [],
            'linstor': [],
            'targetcli': [],
            'pacemaker': [],
            'corosync': []
        }
        for i in iter_version:
            dict_all['node'].append(i[0])
            dict_all['drbd'].append(i[1])
            dict_all['linstor'].append(i[2])
            dict_all['targetcli'].append(i[3])
            dict_all['pacemaker'].append(i[4])
            dict_all['corosync'].append(i[5])

        flag = []
        diff_version = []
        for k, v in dict_all.items():
            if len(set(v)) == 1 and v[0] is not None:
                flag.append([k, True])
            else:
                flag.append([k, False])
                diff_version.append([k, v])

        flag.pop(0)

        table_soft_check = utils.Table()
        table_soft_check.header = ['software', 'result']
        for i in flag:
            table_soft_check.add_data(i)

        table_soft_check.print_table()

        if len(diff_version) > 1:
            table_version = utils.Table()
            table_version.header = []
            for i in diff_version:
                table_version.header.append(i[0])
                table_version.add_column(i[0], i[1])
            table_version.print_table()
Beispiel #5
0
    def __init__(self, rkey):
        req = requests.get(urls.MAIN, params={"licKey": rkey})
        req.raise_for_status()

        soup = bs4.BeautifulSoup(req.text, "html.parser")
        title = soup.select("span[class=h2]")[0].text
        table = utils.Table(soup.select("table[summary~=License]")[0])

        self.rkey = rkey
        self.title = title
        self.soup = soup
        self.callsign = table["Call Sign"].text.strip()
        self.service = table["Radio Service"].text.strip()[:2]
        self.status = table["Status"].text.strip().lower()
Beispiel #6
0
    def test_table(self):
        table = utils.Table()
        for i in range(10):
            table.append(list(range(20)))
        self.assertSequenceEqual(table.shape, (10, 20))

        table.clear()
        self.assertEqual(table.num_rows, 0)

        r1 = {'c1': 1, 'c2': 2}
        r2 = {'c1': 2, 'c2': 4}
        r3 = {'c1': 4, 'c2': 8}
        mu = {'c1': (1+2+4)/3.0, 'c2': (2+4+8)/3.0}
        table.append(r1)
        table.append(r2)
        table.append(r3)
        self.assertSequenceEqual(table.shape, (3, 2))
        self.assertDictEqual(table.row(0), r1)
        self.assertDictEqual(table.row(-1), r3)
        self.assertSequenceEqual(table.column('c1'), (1, 2, 4))
        self.assertSequenceEqual(table.column('c2'), (2, 4, 8))

        self.assertDictEqual(table.max('c1'), r3)
        self.assertDictEqual(table.max('c2'), r3)
        self.assertDictEqual(table.min('c1'), r1)
        self.assertDictEqual(table.mean(['c1', 'c2']), mu)
        
        def f(row):
            if row['c1'] % 2 == 0:
                return None
            row['c1'] = row['c1'] ** 2
            row['c2'] = row['c2'] ** 2
            return row
        g = list(table.filter(f))
        self.assertDictEqual(g[0], {'c1': 1, 'c2': 4})

        table.clear()
        table.append(r1)
        txt = table.csv()
        # self.assertEqual('c1,c2\r\n1,2\r\n', txt)
        self.logger.debug(txt)
        txt = table.tabulate()
        self.logger.debug(txt)
Beispiel #7
0
kernelOpen = np.ones((5, 5))
kernelClose = np.ones((20, 20))

circles = []
rectangles = []
randomPositions = []
contadores = []
covers = []
viewCovers = []

randomPositions = generateRandomPositions()
generarShapes(circles, rectangles, randomPositions, 2)

selector = []

table = utils.Table()
table.initialize_odds()
table.initialize_table(340, 220)

print table.pares
print table.cards
print table.posicion

pressed = 0

while True:

    ret, img = cam.read()

    img = cv2.resize(img, (360, 240))
    imgHSV = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)