From b681d30c916f87c4b8a71d38f0cc67a095fb8fc1 Mon Sep 17 00:00:00 2001
From: Marco Mariani <marco.mariani@nexedi.com>
Date: Fri, 16 May 2014 14:31:25 +0200
Subject: [PATCH] cli: added missing O_TRUNC to os.open

---
 slapos/cli/configure_client.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/slapos/cli/configure_client.py b/slapos/cli/configure_client.py
index 7dd762a23..59c1aa5f5 100644
--- a/slapos/cli/configure_client.py
+++ b/slapos/cli/configure_client.py
@@ -108,15 +108,15 @@ def do_configure_client(logger, master_url_web, token, config_path, master_url):
 
     # write everything
 
-    with os.fdopen(os.open(config_path, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as fout:
+    with os.fdopen(os.open(config_path, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o600), 'w') as fout:
         logger.debug('Writing configuration to %s', config_path)
         fout.write(cfg)
 
-    with os.fdopen(os.open(cert_path, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as fout:
+    with os.fdopen(os.open(cert_path, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o600), 'w') as fout:
         logger.debug('Writing certificate to %s', cert_path)
         fout.write(certificate)
 
-    with os.fdopen(os.open(key_path, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as fout:
+    with os.fdopen(os.open(key_path, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o600), 'w') as fout:
         logger.debug('Writing key to %s', key_path)
         fout.write(key)
 
-- 
2.30.9