Formatting

This commit is contained in:
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: with output_fpath.open('w', encoding='ascii') as outfile:
outfile.write('\n'.join(sorted(file_ids))) outfile.write('\n'.join(sorted(file_ids)))
@manager_maintenance.command @manager_maintenance.command
def find_video_nodes_without_duration(): def find_video_nodes_without_duration():
"""Finds video nodes without any 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'}, {'$unwind': '$_files.variations'},
{'$match': {'_files.variations.duration': {'$gt': 0}}}, {'$match': {'_files.variations.duration': {'$gt': 0}}},
{'$addFields': { {'$addFields': {
'need_update': {'$ne': ['$_files.variations.duration', '$properties.duration_seconds']} 'need_update': {
'$ne': ['$_files.variations.duration', '$properties.duration_seconds']}
}}, }},
{'$match': {'need_update': True}}, {'$match': {'need_update': True}},
{'$project': { {'$project': {

View File

@@ -316,7 +316,8 @@ class ReconcileNodeDurationTest(AbstractPillarTest):
with mock.patch('pillar.api.utils.utcnow') as mock_utcnow: with mock.patch('pillar.api.utils.utcnow') as mock_utcnow:
mock_utcnow.return_value = self.fake_now 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 reconcile_node_video_duration(nodes_to_update=to_reconcile, go=False) # Dry run
self.assertAllUnchanged() self.assertAllUnchanged()