confluentinc / confluent-docker-utils

Common Python utils for testing Confluent's Docker images
Apache License 2.0
3 stars 5 forks source link

dub template failing with 'No such file or directory' #32

Closed LeonardMeyer closed 3 years ago

LeonardMeyer commented 3 years ago

Hi. I've overriden and added some code to my configure script. I also copied additional files (connectors directory) to template them. The templating command is failing with an error I cannot make much sense of :

connect            | for file in /etc/confluent/docker/connectors/*
connect            | do
connect            |   FILENAME=$(basename "$file" .properties.template)
connect            |    dub template "/etc/confluent/docker/connectors/${FILENAME}.properties.template" "/etc/${COMPONENT}/connectors/${FILENAME}.properties"
connect            | done
connect            | + for file in '/etc/confluent/docker/connectors/*'
connect            | basename "$file" .properties.template
connect            | ++ basename /etc/confluent/docker/connectors/HttpSinkOauth2Stock.properties.template .properties.template
connect            | + FILENAME=HttpSinkOauth2Stock
connect            | + dub template /etc/confluent/docker/connectors/HttpSinkOauth2Stock.properties.template /etc/kafka-connect/connectors/HttpSinkOauth2Stock.properties
connect            | [Errno 2] No such file or directory: '/etc/kafka-connect/connectors/HttpSinkOauth2Stock.properties'
connect            | Command [/usr/local/bin/dub template /etc/confluent/docker/connectors/HttpSinkOauth2Stock.properties.template /etc/kafka-connect/connectors/HttpSinkOauth2Stock.properties] FAILED !
connect exited with code 1

As you can see it's inferring properly the command but the execution is failing with [Errno 2] No such file or directory: '/etc/kafka-connect/connectors/HttpSinkOauth2Stock.properties'. Shouldn't the templating create that file ?

Here's the additional configure script code for clarity :

for file in /etc/confluent/docker/connectors/*
do
  FILENAME=$(basename "$file" .properties.template)
  dub template "/etc/confluent/docker/connectors/${FILENAME}.properties.template" "/etc/${COMPONENT}/connectors/${FILENAME}.properties"
done
LeonardMeyer commented 3 years ago

Actually it fails because the connectors directory does not exist. If I create it explicitly it's fine, which is expected behavior I guess ? If so then the issue can be closed.