Fix weird permission on log directories

Several log directories for integration tests were created with full
permissions for "others" but no permission for the owner of the
directory.  This caused issues when trying to run integration tests
again without manually wiping files from previous runs.  The test would
fail with "PermissionError: [Errno 13] Permission denied: 'logs'".

The intention may have been to do the equivalent of 'chmod o+rwx logs',
but it instead did the equivalent of 'chmod 007 logs'.
This commit is contained in:
Haavard Kvaalen 2021-12-21 11:50:54 +01:00
parent c5dfbfc6f5
commit 9a2b0680a1

View File

@ -1527,7 +1527,7 @@ class ClickHouseCluster:
if os.path.exists(self.mysql_dir): if os.path.exists(self.mysql_dir):
shutil.rmtree(self.mysql_dir) shutil.rmtree(self.mysql_dir)
os.makedirs(self.mysql_logs_dir) os.makedirs(self.mysql_logs_dir)
os.chmod(self.mysql_logs_dir, stat.S_IRWXO) os.chmod(self.mysql_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
subprocess_check_call(self.base_mysql_cmd + common_opts) subprocess_check_call(self.base_mysql_cmd + common_opts)
self.up_called = True self.up_called = True
self.wait_mysql_to_start() self.wait_mysql_to_start()
@ -1537,7 +1537,7 @@ class ClickHouseCluster:
if os.path.exists(self.mysql8_dir): if os.path.exists(self.mysql8_dir):
shutil.rmtree(self.mysql8_dir) shutil.rmtree(self.mysql8_dir)
os.makedirs(self.mysql8_logs_dir) os.makedirs(self.mysql8_logs_dir)
os.chmod(self.mysql8_logs_dir, stat.S_IRWXO) os.chmod(self.mysql8_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
subprocess_check_call(self.base_mysql8_cmd + common_opts) subprocess_check_call(self.base_mysql8_cmd + common_opts)
self.wait_mysql8_to_start() self.wait_mysql8_to_start()
@ -1546,7 +1546,7 @@ class ClickHouseCluster:
if os.path.exists(self.mysql_cluster_dir): if os.path.exists(self.mysql_cluster_dir):
shutil.rmtree(self.mysql_cluster_dir) shutil.rmtree(self.mysql_cluster_dir)
os.makedirs(self.mysql_cluster_logs_dir) os.makedirs(self.mysql_cluster_logs_dir)
os.chmod(self.mysql_cluster_logs_dir, stat.S_IRWXO) os.chmod(self.mysql_cluster_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
subprocess_check_call(self.base_mysql_cluster_cmd + common_opts) subprocess_check_call(self.base_mysql_cluster_cmd + common_opts)
self.up_called = True self.up_called = True
@ -1557,7 +1557,7 @@ class ClickHouseCluster:
if os.path.exists(self.postgres_dir): if os.path.exists(self.postgres_dir):
shutil.rmtree(self.postgres_dir) shutil.rmtree(self.postgres_dir)
os.makedirs(self.postgres_logs_dir) os.makedirs(self.postgres_logs_dir)
os.chmod(self.postgres_logs_dir, stat.S_IRWXO) os.chmod(self.postgres_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
subprocess_check_call(self.base_postgres_cmd + common_opts) subprocess_check_call(self.base_postgres_cmd + common_opts)
self.up_called = True self.up_called = True
@ -1566,11 +1566,11 @@ class ClickHouseCluster:
if self.with_postgres_cluster and self.base_postgres_cluster_cmd: if self.with_postgres_cluster and self.base_postgres_cluster_cmd:
print('Setup Postgres') print('Setup Postgres')
os.makedirs(self.postgres2_logs_dir) os.makedirs(self.postgres2_logs_dir)
os.chmod(self.postgres2_logs_dir, stat.S_IRWXO) os.chmod(self.postgres2_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
os.makedirs(self.postgres3_logs_dir) os.makedirs(self.postgres3_logs_dir)
os.chmod(self.postgres3_logs_dir, stat.S_IRWXO) os.chmod(self.postgres3_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
os.makedirs(self.postgres4_logs_dir) os.makedirs(self.postgres4_logs_dir)
os.chmod(self.postgres4_logs_dir, stat.S_IRWXO) os.chmod(self.postgres4_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
subprocess_check_call(self.base_postgres_cluster_cmd + common_opts) subprocess_check_call(self.base_postgres_cluster_cmd + common_opts)
self.up_called = True self.up_called = True
self.wait_postgres_cluster_to_start() self.wait_postgres_cluster_to_start()
@ -1591,7 +1591,7 @@ class ClickHouseCluster:
if self.with_rabbitmq and self.base_rabbitmq_cmd: if self.with_rabbitmq and self.base_rabbitmq_cmd:
logging.debug('Setup RabbitMQ') logging.debug('Setup RabbitMQ')
os.makedirs(self.rabbitmq_logs_dir) os.makedirs(self.rabbitmq_logs_dir)
os.chmod(self.rabbitmq_logs_dir, stat.S_IRWXO) os.chmod(self.rabbitmq_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
for i in range(5): for i in range(5):
subprocess_check_call(self.base_rabbitmq_cmd + common_opts + ['--renew-anon-volumes']) subprocess_check_call(self.base_rabbitmq_cmd + common_opts + ['--renew-anon-volumes'])
@ -1604,7 +1604,7 @@ class ClickHouseCluster:
if self.with_hdfs and self.base_hdfs_cmd: if self.with_hdfs and self.base_hdfs_cmd:
logging.debug('Setup HDFS') logging.debug('Setup HDFS')
os.makedirs(self.hdfs_logs_dir) os.makedirs(self.hdfs_logs_dir)
os.chmod(self.hdfs_logs_dir, stat.S_IRWXO) os.chmod(self.hdfs_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
subprocess_check_call(self.base_hdfs_cmd + common_opts) subprocess_check_call(self.base_hdfs_cmd + common_opts)
self.up_called = True self.up_called = True
self.make_hdfs_api() self.make_hdfs_api()
@ -1613,7 +1613,7 @@ class ClickHouseCluster:
if self.with_kerberized_hdfs and self.base_kerberized_hdfs_cmd: if self.with_kerberized_hdfs and self.base_kerberized_hdfs_cmd:
logging.debug('Setup kerberized HDFS') logging.debug('Setup kerberized HDFS')
os.makedirs(self.hdfs_kerberized_logs_dir) os.makedirs(self.hdfs_kerberized_logs_dir)
os.chmod(self.hdfs_kerberized_logs_dir, stat.S_IRWXO) os.chmod(self.hdfs_kerberized_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
run_and_check(self.base_kerberized_hdfs_cmd + common_opts) run_and_check(self.base_kerberized_hdfs_cmd + common_opts)
self.up_called = True self.up_called = True
self.make_hdfs_api(kerberized=True) self.make_hdfs_api(kerberized=True)
@ -1669,7 +1669,7 @@ class ClickHouseCluster:
if self.with_jdbc_bridge and self.base_jdbc_bridge_cmd: if self.with_jdbc_bridge and self.base_jdbc_bridge_cmd:
os.makedirs(self.jdbc_driver_logs_dir) os.makedirs(self.jdbc_driver_logs_dir)
os.chmod(self.jdbc_driver_logs_dir, stat.S_IRWXO) os.chmod(self.jdbc_driver_logs_dir, stat.S_IRWXU | stat.S_IRWXO)
subprocess_check_call(self.base_jdbc_bridge_cmd + ['up', '-d']) subprocess_check_call(self.base_jdbc_bridge_cmd + ['up', '-d'])
self.up_called = True self.up_called = True