Example #1
0
 def test_check_ord_tls_verbose(self, mock_execute):
     mock_execute.side_effect = [("value", None)]
     check_ord_tls(self.OPTS, verbose=True)
     mock_execute.assert_called_once_with(
         'kubectl get cm -n orderer-namespace an-ord-hlf-ord--ord -o jsonpath="{.data.ORDERER_GENERAL_TLS_ENABLED}"',
         verbose=True,
     )
Example #2
0
def peer_channel_suffix(opts, ord_msp, ord_name):
    """Get command suffix for "peer channel" commands, as they involve speaking with Orderer.

    Args:
        opts (dict): Nephos options dict.
        ord_name (str): Orderer we wish to speak to.
        ord_msp(str): Orderer msp we wish to speak to

    Returns:
        str: Command suffix we need to use in "peer channel" commands.
    """
    ord_tls = check_ord_tls(opts, ord_msp, ord_name)
    if ord_tls:
        cmd_suffix = "--tls " + f"--cafile $(ls ${{ORD_TLS_PATH}}/*.pem)"
    else:
        cmd_suffix = ""
    return cmd_suffix
Example #3
0
def peer_channel_suffix(opts, ord_name, verbose=False):
    """Get command suffix for "peer channel" commands, as they involve speaking with Orderer.

    Args:
        opts (dict): Nephos options dict.
        ord_name (str): Orderer we wish to speak to.
        verbose (bool): Verbosity. False by default.

    Returns:
        str: Command suffix we need to use in "peer channel" commands.
    """
    ord_tls = check_ord_tls(opts, verbose=verbose)
    if ord_tls:
        cmd_suffix = ("--tls " +
                      "--ordererTLSHostnameOverride {orderer}-hlf-ord " +
                      "--cafile $(ls ${{ORD_TLS_PATH}}/*.pem)").format(
                          orderer=ord_name)
    else:
        cmd_suffix = ""
    return cmd_suffix