Skip to content

Commit

Permalink
Fixed NG partial device sync (#2523)
Browse files Browse the repository at this point in the history
* Fixed NG partial device sync

Fixed management command to partially sync Device to Ralph3 (removed limiting query result to 10 elements)

* skip devices in partial sync when they don't have asset
  • Loading branch information
mkurek committed Jul 4, 2016
1 parent 03c05ba commit 8ad6fb6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ralph/export_to_ng/management/commands/sync_to_ralph3.py
Expand Up @@ -119,7 +119,13 @@ def venture_role_sync(model, **options):


def _device_partial_sync(fields, **options):
for obj in Device.objects.exclude(deleted=True)[:10]:
for obj in Device.objects.exclude(deleted=True):
if (
options.get('device_with_asset_only') and
not obj.get_asset(manager='admin_objects')
):
logger.info('Skipping {} - it does not have asset'.format(obj))
continue
post_save.send(
sender=Device,
instance=obj,
Expand Down Expand Up @@ -165,6 +171,10 @@ class Command(BaseCommand):
'--skip-empty',
action="store_true",
),
make_option(
'--device-with-asset-only',
action="store_true",
),
make_option(
'--sleep',
type=int,
Expand Down

0 comments on commit 8ad6fb6

Please sign in to comment.