Skip to content

Commit

Permalink
Fix deleting storage policy
Browse files Browse the repository at this point in the history
  • Loading branch information
JosepSampe committed Nov 15, 2017
1 parent 5a984d4 commit cf3a6b8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions api/swift_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,13 @@ def storage_policy_detail(request, storage_policy_id):
if request.method == 'DELETE':
if r.exists(key):
try:
policy_file_path = get_policy_file_path(settings.SWIFT_CFG_DEPLOY_DIR, storage_policy_id)
if os.path.isfile(policy_file_path):
os.remove(policy_file_path)
os.remove(get_policy_file_path(settings.SWIFT_CFG_TMP_DIR, storage_policy_id))
policy_file_path_dep = get_policy_file_path(settings.SWIFT_CFG_DEPLOY_DIR, storage_policy_id)
if os.path.isfile(policy_file_path_dep):
os.remove(policy_file_path_dep)

policy_file_path_tmp = get_policy_file_path(settings.SWIFT_CFG_TMP_DIR, storage_policy_id)
if os.path.isfile(policy_file_path_tmp):
os.remove(policy_file_path_tmp)

deploy_swift_file = get_swift_cfg_path(settings.SWIFT_CFG_DEPLOY_DIR)

Expand Down

0 comments on commit cf3a6b8

Please sign in to comment.