Skip to content

Commit

Permalink
Add publisher for rack (#2520)
Browse files Browse the repository at this point in the history
Add publisher for rack
  • Loading branch information
ar4s authored and mkurek committed Jul 1, 2016
1 parent 0f6fc9f commit 640c1ee
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/ralph/ralph2_sync/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ConfigurationClass,
ConfigurationModule
)
from ralph.data_center.models import DataCenterAsset
from ralph.data_center.models import DataCenterAsset, Rack
from ralph.data_importer.models import (
ImportedObjectDoesNotExist,
ImportedObjects
Expand Down Expand Up @@ -138,6 +138,26 @@ def sync_model_to_ralph2(sender, instance=None, created=False, **kwargs):
}


@ralph2_sync(Rack)
def sync_rack_to_ralph2(sender, instance=None, created=False, **kwargs):
"""
Publish Rack info to sync it in Ralph3.
"""
rack = instance
return {
'id': rack.id,
'ralph2_id': _get_obj_id_ralph_2(rack),
'name': rack.name,
'description': rack.description,
'orientation': rack.orientation,
'max_u_height': rack.max_u_height,
'visualization_col': rack.visualization_col,
'visualization_row': rack.visualization_row,
'server_room': _get_obj_id_ralph_2(rack.server_room),
'data_center': _get_obj_id_ralph_2(rack.server_room.data_center) if rack.server_room else None, # noqa
}


@ralph2_sync(ConfigurationModule)
def sync_configuration_module_to_ralph2(sender, instance=None, created=False, **kwargs): # noqa
"""
Expand Down

0 comments on commit 640c1ee

Please sign in to comment.