Skip to content

Commit 8a0748d

Browse files
Used with statement to open the file
1 parent fe61c7c commit 8a0748d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

recipes/python/backup-restore/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Netbackup VmWare agentless single and group VM backup and restore APIs code samples
1+
# NetBackup VmWare agentless single and group VM backup and restore APIs code samples
22

33
## Executing the scripts:
44

recipes/python/backup-restore/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def create_protection_plan(baseurl, token, protection_plan_name, storage_unit_na
114114

115115
cur_dir = os.path.dirname(os.path.abspath(__file__))
116116
file_name = os.path.join(cur_dir, "create_protection_plan_template.json")
117-
file_handle = open(file_name)
118-
data = json.load(file_handle)
117+
with open(file_name, 'r') as file_handle:
118+
data = json.load(file_handle)
119119
data['data']['attributes']['name'] = protection_plan_name
120120
data['data']['attributes']['policyNamePrefix'] = protection_plan_name
121121
data['data']['attributes']['schedules'][0]['backupStorageUnit'] = storage_unit_name

0 commit comments

Comments
 (0)