Custom Script Results Pending #9436
-
I found a dummy script just to see if I can get custom scripts to work. The following is the script import requests
import json
from extras.scripts import *
class RunCommand(Script):
class Meta:
name = "Lookup IP or domain"
description = "Lookup IP or domain"
field_order = ['input_data']
input_data = StringVar(
description="Lookup IP or Domain"
)
def run(self, data, commit):
url = "http://ipwhois.app/json/%s" % data['input_data']
payload={}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
rawoutput = response.text
output = json.loads(rawoutput)
#
#Available fields:ip,success,type,continent,continent_code,country,country_code,country_flag,country_capital,country_phone,country_neighbours,
# region,city,latitude,longitude,asn,org,isp,timezone,timezone_name,timezone_dstOffset,timezone_gmtOffset,timezone_gmt,currency
# currency_code,currency_symbol,currency_rates,currency_plural
self.log_success(f"IP :" + output['ip'])
self.log_success(f"Type :" + output['type'])
self.log_success(f"Continent :" + output['continent'])
self.log_success(f"Country :" + output['country'])
self.log_success(f"Region :" + output['region'])
self.log_success(f"City :" + output['city'])
self.log_success(f"ASN :" + output['asn'])
self.log_success(f"Org :" + output['org'])
self.log_success(f"ISP :" + output['isp'])
self.log_success(f"Timezone :" + output['timezone'])
return("Done") The script itself is not important, I just wanted to see if it would work. My terminal is outputing the following line repeatedly The netbox UI is saying the results of the script are pending, and has been saying this for 15 minutes so something is clearly wrong. Has anyone run into this issue before or knows what I am doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Go to |
Beta Was this translation helpful? Give feedback.
Go to
/admin/background-tasks/
and click the number under theFAILED JOBS
column for the default queue. If there are any entries you can click them and see why they failed.