You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fixity/fixity.py
+27-7Lines changed: 27 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,11 @@ def parse_arguments():
40
40
action="store_true",
41
41
help="Force a local fixity check on the Storage Service.",
42
42
)
43
+
parser.add_argument(
44
+
"--timestamps",
45
+
action="store_true",
46
+
help="Add a timestamp to the beginning of each line of output.",
47
+
)
43
48
args=parser.parse_args()
44
49
45
50
validate_arguments(args)
@@ -99,6 +104,7 @@ def scan(
99
104
report_auth=(),
100
105
session_id=None,
101
106
force_local=False,
107
+
timestamps=False,
102
108
):
103
109
"""
104
110
Instruct the storage service to scan a single AIP.
@@ -114,7 +120,8 @@ def scan(
114
120
:param str report_url: The base URL to a server to which the report will be POSTed after the scan completes. If absent, the report will not be transmitted.
115
121
:param report_auth: Authentication for the report_url. Tupel of (user, password) for HTTP auth.
116
122
:param session_id: Identifier for this session, allowing every scan from one run to be identified.
117
-
:param bool force_local: If True, will will request the Storage Service to perform a local fixity check, instead of using the Space's fixity (if available).
123
+
:param bool force_local: If True, will request the Storage Service to perform a local fixity check, instead of using the Space's fixity (if available).
124
+
:param bool timestamps: If True, will add a timestamp to the beginning of each line of output.
118
125
"""
119
126
120
127
# Ensure the storage service knows about this AIP first;
@@ -135,7 +142,9 @@ def scan(
135
142
session_id=session_id,
136
143
)
137
144
exceptreporting.ReportServiceException:
138
-
utils.pyprint(f"Unable to POST pre-scan report to {report_url}")
145
+
utils.pyprint(
146
+
f"Unable to POST pre-scan report to {report_url}", timestamps=timestamps
utils.pyprint(f"Unable to POST report for AIP {aip} to remote service")
193
+
utils.pyprint(
194
+
f"Unable to POST report for AIP {aip} to remote service",
195
+
timestamps=timestamps,
196
+
)
183
197
184
198
ifreport:
185
199
session.add(report)
@@ -196,6 +210,7 @@ def scanall(
196
210
report_auth=(),
197
211
throttle_time=0,
198
212
force_local=False,
213
+
timestamps=False,
199
214
):
200
215
"""
201
216
Run a fixity scan on every AIP in a storage service instance.
@@ -206,7 +221,8 @@ def scanall(
206
221
:param str report_url: The base URL to a server to which the report will be POSTed after the scan completes. If absent, the report will not be transmitted.
207
222
:param report_auth: Authentication for the report_url. Tupel of (user, password) for HTTP auth.
208
223
:param int throttle_time: Time to wait between scans.
209
-
:param bool force_local: If True, will will request the Storage Service to perform a local fixity check, instead of using the Space's fixity (if available).
224
+
:param bool force_local: If True, will request the Storage Service to perform a local fixity check, instead of using the Space's fixity (if available).
225
+
:param bool timestamps: If True, will add a timestamp to the beginning of each line of output.
210
226
"""
211
227
success=True
212
228
@@ -231,19 +247,21 @@ def scanall(
231
247
report_auth=report_auth,
232
248
session_id=session_id,
233
249
force_local=force_local,
250
+
timestamps=timestamps,
234
251
)
235
252
ifnotscan_success:
236
253
success=False
237
254
exceptExceptionase:
238
255
utils.pyprint(
239
256
f"Internal error encountered while scanning AIP {aip['uuid']} ({type(e).__name__})",
0 commit comments