@@ -128,7 +128,7 @@ def send_to_heroic(api_endpoint: str, payload: dict, update: bool = False):
128128def create_heroic_instrument (instrument : Instrument ):
129129 ''' Create a new instrument payload and send it to HEROIC
130130 '''
131- if (instrument .telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES ):
131+ if (instrument .telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES and str ( instrument . telescope ) not in settings . HEROIC_EXCLUDE_TELESCOPES ):
132132 instrument_payload = {
133133 'id' : heroic_instrument_id (instrument ),
134134 'name' : f"{ instrument .instrument_type .name } - { instrument .code } " ,
@@ -145,7 +145,7 @@ def update_heroic_instrument_capabilities(instrument: Instrument):
145145 ''' Send the current instrument capabilities of an instrument to HEROIC
146146 if it is not DISABLED and heroic is set up in settings.py
147147 '''
148- if can_submit_to_heroic () and instrument .state != 'DISABLED' and instrument .telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES :
148+ if can_submit_to_heroic () and instrument .state != 'DISABLED' and instrument .telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES and str ( instrument . telescope ) not in settings . HEROIC_EXCLUDE_TELESCOPES :
149149 capabilities = instrument_to_heroic_instrument_capabilities (instrument )
150150 try :
151151 send_to_heroic ('instrument-capabilities/' , capabilities )
@@ -156,7 +156,7 @@ def update_heroic_instrument_capabilities(instrument: Instrument):
156156def create_heroic_telescope (telescope : Telescope ):
157157 ''' Create a new telescope payload and send it to HEROIC
158158 '''
159- if telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES :
159+ if telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES and str ( telescope ) not in settings . HEROIC_EXCLUDE_TELESCOPES :
160160 telescope_payload = telescope_to_heroic_telescope_properties (telescope )
161161 telescope_payload ['id' ] = heroic_telescope_id (telescope )
162162 telescope_payload ['status' ] = telescope_status_conversion (telescope )
@@ -171,7 +171,7 @@ def create_heroic_telescope(telescope: Telescope):
171171def update_heroic_telescope_properties (telescope : Telescope ):
172172 ''' Send updated telescope properties to HEROIC when they change
173173 '''
174- if telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES :
174+ if telescope .enclosure .site .code not in settings .HEROIC_EXCLUDE_SITES and str ( telescope ) not in settings . HEROIC_EXCLUDE_TELESCOPES :
175175 telescope_update_payload = telescope_to_heroic_telescope_properties (telescope )
176176 try :
177177 send_to_heroic (f'telescopes/{ heroic_telescope_id (telescope )} /' , telescope_update_payload , update = True )
0 commit comments