Formatting

This commit is contained in:
Sybren A. Stüvel 2018-12-04 17:44:35 +01:00
parent de5c7a98a5
commit de8633a5a4
2 changed files with 5 additions and 2 deletions

View File

@ -1064,6 +1064,7 @@ def find_video_files_without_duration():
with output_fpath.open('w', encoding='ascii') as outfile:
outfile.write('\n'.join(sorted(file_ids)))
@manager_maintenance.command
def find_video_nodes_without_duration():
"""Finds video nodes without any duration
@ -1142,7 +1143,8 @@ def reconcile_node_video_duration(nodes_to_update=None, all_nodes=False, go=Fals
{'$unwind': '$_files.variations'},
{'$match': {'_files.variations.duration': {'$gt': 0}}},
{'$addFields': {
'need_update': {'$ne': ['$_files.variations.duration', '$properties.duration_seconds']}
'need_update': {
'$ne': ['$_files.variations.duration', '$properties.duration_seconds']}
}},
{'$match': {'need_update': True}},
{'$project': {

View File

@ -316,7 +316,8 @@ class ReconcileNodeDurationTest(AbstractPillarTest):
with mock.patch('pillar.api.utils.utcnow') as mock_utcnow:
mock_utcnow.return_value = self.fake_now
to_reconcile = [str(self.node_id0), str(self.node_id1), str(self.node_id2), str(self.node_id5)]
to_reconcile = [str(self.node_id0), str(self.node_id1), str(self.node_id2),
str(self.node_id5)]
reconcile_node_video_duration(nodes_to_update=to_reconcile, go=False) # Dry run
self.assertAllUnchanged()