Exemple #1
0
    def start_polisd(request):

        if request.method == 'POST':
            mns = request.form.getlist('mns')
            actions = request.form.getlist('params')

            result = 'Attempted starting: ' + ', '.join(mns)
            for idx in mns:
                vps = VPS(config['masternodes'][int(idx)],
                          Polis(config['Polis']))
                result = vps.daemon_action(Polis(config["Polis"]))
                logging.info(f"Restarted {vps.getIP()} got: {result}")

            return f"Result of polisd {actions}: {result} <br><a href=/mns/cli/masternodes/status></a>"
        else:
            #diisplay list of all MNs with "start" button
            mnlist = "<form method='POST'>\n<select name=mns multiple>\n"
            idx = 0

            for masternode in config["masternodes"]:
                mnlist += f"\t<option value='{str(idx)}'>{masternode['connection_string']}</option>\n"
                idx += 1

            mnlist += "</select>\n"
            return mnlist + "<p><input type=submit value=start></form>"
Exemple #2
0
    def daemon_masternode_start(request, mn_idx, reindex):
        coin = Polis(config['Polis'])

        vps = VPS(config["masternodes"][mn_idx], coin)
        result = vps.kill_daemon(coin)
        time.sleep(10)
        logging.info(f"Killed daemon {result}")
        result = vps.daemon_action(coin, reindex)
        logging.info(f"Executed: polisd @ {mn_idx} returned: {result}")
        return result