basic multi-chain create support

This commit is contained in:
David Tai
2018-11-28 15:57:15 -06:00
parent 1eafb2ecd7
commit 109902a1ca
2 changed files with 15 additions and 5 deletions
+14 -3
View File
@@ -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)
+1 -2
View File
@@ -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')