Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pulsar-functions/instance/src/main/python/python_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,13 +581,16 @@ def get_record_class(self, class_name):
except:
pass
return record_kclass

def get_crypto_reader(self, crypto_spec):
crypto_key_reader = None
if crypto_spec is not None:
try:
crypto_config = json.loads(crypto_spec.cryptoKeyReaderConfig)
if crypto_spec.cryptoKeyReaderClassName == "" or crypto_spec.cryptoKeyReaderClassName is None:
crypto_key_reader = pulsar.CryptoKeyReader(**crypto_config)
crypto_config = json.loads(crypto_spec.cryptoKeyReaderConfig) if crypto_spec.cryptoKeyReaderConfig else {}
# use the default crypto key reader
if not crypto_spec.cryptoKeyReaderClassName:
if "public_key_path" in crypto_config and "private_key_path" in crypto_config:
crypto_key_reader = pulsar.CryptoKeyReader(**crypto_config)
else:
crypto_key_reader = util.import_class(os.path.dirname(self.user_code), crypto_spec.cryptoKeyReaderClassName)(**crypto_config)
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,9 @@ protected void testExclamationFunction(Runtime runtime,
batchingConfig = producerConfig.getBatchingConfig();
}
checkLogs(functionName, batchingConfig, consumerConfig, config, inputTopicName);
} else if (runtime == Runtime.PYTHON) {
String functionLogs = pulsarCluster.getFunctionLogs(functionName);
assertFalse(functionLogs.contains("Failed to load the crypto key reader from spec"));
}

// get function status
Expand Down
Loading