mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-09-30 20:46:32 +00:00
basic multi-chain create support
This commit is contained in:
+14
-3
@@ -3,6 +3,7 @@ from .kubernetes import Kubernetes
|
||||
from .template import Ethereum
|
||||
from .table import table
|
||||
|
||||
blockchains = [Ethereum]
|
||||
|
||||
class Bootnode(object):
|
||||
def __init__(self):
|
||||
@@ -61,9 +62,19 @@ class Bootnode(object):
|
||||
print(self.gcloud.snapshot_disk(pod.disk, name, pod_name=pod.name))
|
||||
|
||||
# Pods
|
||||
def create_pod(self, network, name):
|
||||
network, id = Ethereum.normalize_network(network)
|
||||
config = Ethereum(name, network)
|
||||
def find_blockchain(self, chain):
|
||||
for blockchain in blockchains:
|
||||
if blockchain.is_blockchain(chain):
|
||||
return blockchain
|
||||
|
||||
def create_pod(self, chain, network, name):
|
||||
c = self.find_blockchain(chain)
|
||||
|
||||
if c is None:
|
||||
raise Exception('Blockchain "" does not exist' % chain)
|
||||
|
||||
network, id = c.normalize_network(network)
|
||||
config = c(name, network)
|
||||
|
||||
disk_name = config.spec.volumes[0].gcePersistentDisk.pdName
|
||||
snap = self.gcloud.get_last_snapshot(network)
|
||||
|
||||
@@ -66,13 +66,12 @@ def parser():
|
||||
|
||||
# Pods
|
||||
create_pod = subparsers.add_parser('create-pod', help='Create pod')
|
||||
create_pod.add_argument('chain', help='Name of blockchain to create')
|
||||
create_pod.add_argument('chain', help='Type of blockchain node to create')
|
||||
create_pod.add_argument('network', help='Name of network to use')
|
||||
create_pod.add_argument('name', help='Name of pod')
|
||||
create_pod.set_defaults(command='create_pod')
|
||||
|
||||
delete_pod = subparsers.add_parser('delete-pod', help='Delete pod')
|
||||
create_pod.add_argument('chain', help='Name of blockchain to delete')
|
||||
delete_pod.add_argument('network', help='Name of network to use')
|
||||
delete_pod.add_argument('name', help='Name of pod')
|
||||
delete_pod.set_defaults(command='delete_pod')
|
||||
|
||||
Reference in New Issue
Block a user