def check_api_key(self, editor): if self.api_key is None: api_key, ok = QInputDialog.getText( None, "Add your API KEY", "You must first set your api key in this file." " You can find it here: https://app.datadoghq.com/account/settings#api" ) if ok and api_key: new_content = [] for line in self.content.splitlines(): if "api_key:" in line: new_content.append("api_key: %s" % str(api_key)) else: new_content.append("%s" % line) new_content = "\n".join(new_content) self.save(new_content) editor.set_text(new_content) if agent_status() != AGENT_STOPPED: agent_manager("restart") else: agent_manager("start") elif not ok: warning_popup( "The agent needs an API key to send metrics to Datadog") if agent_status() != AGENT_STOPPED: agent_manager("stop") else: self.check_api_key(editor)
def windows_flare(): case_id, ok = QInputDialog.getInteger( None, "Flare", "Your logs and configuration files are going to be collected and " "sent to Datadog Support. Please enter your ticket number if you have one:", value=0, min=0 ) if not ok: info_popup("Flare cancelled") return case_id = int(case_id) if case_id != 0 else None f = Flare(case_id=case_id) f.collect() email, ok = QInputDialog.getText( None, "Your email", "Logs and configuration files have been collected." " Please enter your email address:" ) if not ok: info_popup("Flare cancelled. You can still use {0}".format(f.tar_path)) return try: case_id = f.upload(email=str(email)) info_popup("Your logs were successfully uploaded. For future reference," " your internal case id is {0}".format(case_id)) except Exception, e: warning_popup('The upload failed. Please send the following file by email' ' to support: {0}\n\n{1}'.format(f.tar_path, str(e)))
def check_api_key(self, editor): if self.api_key is None: api_key, ok = QInputDialog.getText( None, "Add your API KEY", "You must first set your api key in this file." " You can find it here: https://app.datadoghq.com/account/settings#api" ) if ok and api_key: new_content = [] for line in self.content.splitlines(): if "api_key:" in line: new_content.append("api_key: %s" % str(api_key)) else: new_content.append("%s" % line) new_content = "\n".join(new_content) self.save(new_content) editor.set_text(new_content) if agent_status() != AGENT_STOPPED: agent_manager("restart") else: agent_manager("start") elif not ok: warning_popup("The agent needs an API key to send metrics to Datadog") if agent_status() != AGENT_STOPPED: agent_manager("stop") else: self.check_api_key(editor)
def windows_flare(): case_id, ok = QInputDialog.getInteger( None, "Flare", "Your logs and configuration files are going to be collected and " "sent to Datadog Support. Please enter your ticket number if you have one:", value=0, min=0 ) if not ok: info_popup("Flare cancelled") return case_id = int(case_id) if case_id != 0 else None f = Flare(case_id=case_id) f.collect() email, ok = QInputDialog.getText( None, "Your email", "Logs and configuration files have been collected." " Please enter your email address:" ) if not ok: info_popup("Flare cancelled. You can still use {0}".format(f.tar_path)) return try: case_id = f.upload(email=str(email)) info_popup("Your logs were successfully uploaded. For future reference," " your internal case id is {0}".format(case_id)) except Exception as e: warning_popup('The upload failed. Please send the following file by email' ' to support: {0}\n\n{1}'.format(f.tar_path, str(e))) finally: return
def check_api_key(self, editor): if self.api_key is None: api_key, ok = QInputDialog.getText(None, "Add your API KEY", "You must first set your api key in this file. You can find it here: https://app.datadoghq.com/account/settings#api") if ok and api_key: new_content = [] for line in self.content.splitlines(): if "api_key:" in line: new_content.append("api_key: %s" % str(api_key)) else: new_content.append("%s" % line) new_content = "\n".join(new_content) self.save(new_content) editor.set_text(new_content) if not is_service_stopped(): service_manager("restart") else: service_manager("start") else: self.check_api_key(editor)