Skip to content

Commit

Permalink
Add the imported flag to CA, peer and ordering service node
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Elder <[email protected]>
  • Loading branch information
Chris Elder authored and Chris Elder committed Apr 24, 2024
1 parent ddb24ae commit 858f916
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 18 deletions.
15 changes: 10 additions & 5 deletions plugins/module_utils/certificate_authorities.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, code, message):

class CertificateAuthority:

def __init__(self, name, api_url, operations_url, ca_url, ca_name, tlsca_name, pem, location, msp):
def __init__(self, name, api_url, operations_url, ca_url, ca_name, tlsca_name, pem, location, msp, imported):
self.name = name
self.api_url = api_url
self.operations_url = operations_url
Expand All @@ -51,6 +51,7 @@ def __init__(self, name, api_url, operations_url, ca_url, ca_name, tlsca_name, p
self.pem = pem
self.location = location
self.msp = msp
self.imported = imported

def clone(self):
return CertificateAuthority(
Expand All @@ -62,7 +63,8 @@ def clone(self):
tlsca_name=self.tlsca_name,
pem=self.pem,
location=self.location,
msp=self.msp
msp=self.msp,
imported=self.imported
)

def equals(self, other):
Expand All @@ -75,7 +77,8 @@ def equals(self, other):
self.tlsca_name == other.tlsca_name and
self.pem == other.pem and
self.location == other.location and
self.msp == other.msp
self.msp == other.msp and
self.imported == other.imported
)

def to_json(self):
Expand All @@ -90,7 +93,8 @@ def to_json(self):
pem=self.pem,
tls_cert=self.pem,
location=self.location,
msp=self.msp
msp=self.msp,
imported=self.imported
)

@staticmethod
Expand All @@ -104,7 +108,8 @@ def from_json(data):
tlsca_name=data['tlsca_name'],
pem=data['pem'],
location=data['location'],
msp=data['msp']
msp=data['msp'],
imported=data['imported']
)

def wait_for(self, timeout):
Expand Down
9 changes: 6 additions & 3 deletions plugins/module_utils/consoles.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ def extract_ca_info(self, ca):
'pem': ca.get('msp').get('component').get('tls_cert'),
'tls_cert': ca.get('msp').get('component').get('tls_cert'),
'location': 'kubernetes' if ca['location'] == 'ibm_saas' else ca['location'],
'msp': ca['msp']
'msp': ca['msp'],
'imported': ca['imported']
}

def create_ext_ca(self, data):
Expand Down Expand Up @@ -582,7 +583,8 @@ def extract_peer_info(self, peer):
'tls_ca_root_cert': peer.get('msp').get('tlsca').get('root_certs')[0],
'tls_cert': peer.get('msp').get('component').get('tls_cert'),
'location': 'kubernetes' if peer['location'] == 'ibm_saas' else peer['location'],
'msp': peer['msp']
'msp': peer['msp'],
'imported': peer['imported']
}

def create_ext_peer(self, data):
Expand Down Expand Up @@ -892,7 +894,8 @@ def extract_ordering_service_node_info(self, ordering_service_node):
'id': ordering_service_node['id'],
'display_name': ordering_service_node['display_name'],
'osnadmin_url': ordering_service_node.get('osnadmin_url', None),
'msp': ordering_service_node['msp']
'msp': ordering_service_node['msp'],
'imported': ordering_service_node['imported']
}

def create_ext_ordering_service_node(self, data):
Expand Down
15 changes: 10 additions & 5 deletions plugins/module_utils/ordering_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class OrderingServiceNode:

def __init__(self, name, api_url, operations_url, grpcwp_url, msp_id, pem, tls_ca_root_cert, tls_cert, location, system_channel_id, cluster_id, cluster_name, client_tls_cert, server_tls_cert, consenter_proposal_fin, id, display_name, osnadmin_url, msp):
def __init__(self, name, api_url, operations_url, grpcwp_url, msp_id, pem, tls_ca_root_cert, tls_cert, location, system_channel_id, cluster_id, cluster_name, client_tls_cert, server_tls_cert, consenter_proposal_fin, id, display_name, osnadmin_url, msp, imported):
self.name = name
self.api_url = api_url
self.operations_url = operations_url
Expand All @@ -44,6 +44,7 @@ def __init__(self, name, api_url, operations_url, grpcwp_url, msp_id, pem, tls_c
self.display_name = display_name
self.osnadmin_url = osnadmin_url
self.msp = msp
self.imported = imported

def clone(self):
return OrderingServiceNode(
Expand All @@ -65,7 +66,8 @@ def clone(self):
id=self.id,
display_name=self.display_name,
osnadmin_url=self.osnadmin_url,
msp=self.msp
msp=self.msp,
imported=self.imported
)

def equals(self, other):
Expand All @@ -88,7 +90,8 @@ def equals(self, other):
self.id == other.id and
self.display_name == other.display_name and
self.osnadmin_url == other.osnadmin_url and
self.msp == other.msp
self.msp == other.msp and
self.imported == other.imported
)

def to_json(self):
Expand All @@ -112,7 +115,8 @@ def to_json(self):
display_name=self.display_name,
osnadmin_url=self.osnadmin_url,
consenter_proposal_fin=self.consenter_proposal_fin,
msp=self.msp
msp=self.msp,
imported=self.imported
)

@staticmethod
Expand All @@ -136,7 +140,8 @@ def from_json(data):
id=data['id'],
display_name=data['display_name'],
osnadmin_url=data['osnadmin_url'],
msp=data['msp']
msp=data['msp'],
imported=data['imported']
)

def wait_for(self, timeout):
Expand Down
15 changes: 10 additions & 5 deletions plugins/module_utils/peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class Peer:

def __init__(self, name, api_url, operations_url, grpcwp_url, msp_id, pem, tls_ca_root_cert, tls_cert, location, msp):
def __init__(self, name, api_url, operations_url, grpcwp_url, msp_id, pem, tls_ca_root_cert, tls_cert, location, msp, imported):
self.name = name
self.api_url = api_url
self.operations_url = operations_url
Expand All @@ -38,6 +38,7 @@ def __init__(self, name, api_url, operations_url, grpcwp_url, msp_id, pem, tls_c
self.tls_cert = tls_cert
self.location = location
self.msp = msp
self.imported = imported

def clone(self):
return Peer(
Expand All @@ -50,7 +51,8 @@ def clone(self):
tls_ca_root_cert=self.tls_ca_root_cert,
tls_cert=self.tls_cert,
location=self.location,
msp=self.msp
msp=self.msp,
imported=self.imported
)

def equals(self, other):
Expand All @@ -64,7 +66,8 @@ def equals(self, other):
self.tls_ca_root_cert == other.tls_ca_root_cert and
self.tls_cert == other.tls_cert and
self.location == other.location and
self.msp == other.msp
self.msp == other.msp and
self.imported == other.imported
)

def to_json(self):
Expand All @@ -79,7 +82,8 @@ def to_json(self):
tls_ca_root_cert=self.tls_ca_root_cert,
tls_cert=self.tls_cert,
location=self.location,
msp=self.msp
msp=self.msp,
imported=self.imported
)

@staticmethod
Expand All @@ -94,7 +98,8 @@ def from_json(data):
tls_ca_root_cert=data['tls_ca_root_cert'],
tls_cert=data['tls_cert'],
location=data['location'],
msp=data['msp']
msp=data['msp'],
imported=data['imported']
)

def wait_for(self, timeout):
Expand Down

0 comments on commit 858f916

Please sign in to comment.