in scripts/update-kafka-cluster-config.py [0:0]
def main(config):
logger = logging.getLogger("data_service")
logging.basicConfig(
format='%(asctime)s.%(msecs)s:%(name)s:%(thread)d:%(levelname)s:%(process)d:%(message)s',
level=logging.INFO)
try:
with open(config['cluster-properties'], mode='r') as file:
file_content = file.read()
client = boto3.client('kafka')
kafka_config = client.create_configuration(
Description=config['config-description'],
Name=config['config-name'],
ServerProperties=file_content
)
logger.info(str(kafka_config))
cluster_info = client.describe_cluster( ClusterArn=config['cluster-arn'])
response = client.update_cluster_configuration(
ClusterArn=config['cluster-arn'],
ConfigurationInfo={
'Arn': kafka_config['Arn'],
'Revision': kafka_config['LatestRevision']['Revision']
},
CurrentVersion=cluster_info['ClusterInfo']['CurrentVersion']
)
logger.info(str(response))
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_tb(exc_traceback, limit=20, file=sys.stdout)
logger.error(str(e))