Revision f78346f5 lib/backend.py
b/lib/backend.py | ||
---|---|---|
169 | 169 |
"""Cleans up the current node and prepares it to be removed from the cluster. |
170 | 170 |
|
171 | 171 |
""" |
172 |
if os.path.isdir(constants.DATA_DIR): |
|
173 |
for rel_name in utils.ListVisibleFiles(constants.DATA_DIR): |
|
174 |
full_name = os.path.join(constants.DATA_DIR, rel_name) |
|
172 |
def _CleanDirectory(path): |
|
173 |
if not os.path.isdir(path): |
|
174 |
return |
|
175 |
for rel_name in utils.ListVisibleFiles(path): |
|
176 |
full_name = os.path.join(path, rel_name) |
|
175 | 177 |
if os.path.isfile(full_name) and not os.path.islink(full_name): |
176 | 178 |
utils.RemoveFile(full_name) |
177 | 179 |
|
180 |
_CleanDirectory(constants.DATA_DIR) |
|
181 |
|
|
182 |
# Remove job queue files and archived jobs |
|
183 |
_CleanDirectory(constants.QUEUE_DIR) |
|
184 |
_CleanDirectory(constants.JOB_QUEUE_ARCHIVE_DIR) |
|
185 |
|
|
178 | 186 |
try: |
179 | 187 |
priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS) |
180 | 188 |
except errors.OpExecError: |
Also available in: Unified diff