Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

add '--endpoint' to 'repro_cmd' for integrations #113

Merged
merged 3 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api-service/__app__/agent_registration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from onefuzztypes.responses import AgentRegistration

from ..onefuzzlib.agent_authorization import verify_token
from ..onefuzzlib.azure.creds import get_fuzz_storage, get_instance_name
from ..onefuzzlib.azure.creds import get_fuzz_storage, get_instance_url
from ..onefuzzlib.azure.queue import get_queue_sas
from ..onefuzzlib.pools import Node, NodeMessage, Pool
from ..onefuzzlib.request import not_ok, ok, parse_uri


def create_registration_response(machine_id: UUID, pool: Pool) -> func.HttpResponse:
base_address = "https://%s.azurewebsites.net" % get_instance_name()
base_address = get_instance_url()
events_url = "%s/api/agents/events" % base_address
commands_url = "%s/api/agents/commands" % base_address
work_queue = get_queue_sas(
Expand Down
5 changes: 5 additions & 0 deletions src/api-service/__app__/onefuzzlib/azure/creds.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def get_instance_name() -> str:
return os.environ["ONEFUZZ_INSTANCE_NAME"]


@cached
def get_instance_url() -> str:
return "https://%s.azurewebsites.net" % get_instance_name()


@cached(ttl=60)
def get_regions() -> List[str]:
client = mgmt_client_factory(SubscriptionClient)
Expand Down
4 changes: 2 additions & 2 deletions src/api-service/__app__/onefuzzlib/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from onefuzztypes.primitives import Extension, Region

from .azure.containers import get_container_sas_url, get_file_sas_url, save_blob
from .azure.creds import get_func_storage, get_instance_name
from .azure.creds import get_func_storage, get_instance_url
from .azure.monitor import get_monitor_settings
from .reports import get_report

Expand Down Expand Up @@ -91,7 +91,7 @@ def dependency_extension(region: Region, os: OS) -> Optional[Extension]:
def build_pool_config(pool_name: str) -> str:
agent_config = AgentConfig(
pool_name=pool_name,
onefuzz_url="https://%s.azurewebsites.net" % get_instance_name(),
onefuzz_url=get_instance_url(),
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
)
Expand Down
5 changes: 3 additions & 2 deletions src/api-service/__app__/onefuzzlib/notifications/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from onefuzztypes.models import Error, Report

from ..azure.containers import auth_download_url
from ..azure.creds import get_instance_url
from ..jobs import Job
from ..tasks.config import get_setup_container
from ..tasks.main import Task
Expand Down Expand Up @@ -72,7 +73,7 @@ def render(self, template: str) -> str:
"target_url": self.target_url,
"report_container": self.container,
"report_filename": self.filename,
"repro_cmd": "onefuzz repro create_and_connect %s %s"
% (self.container, self.filename),
"repro_cmd": "onefuzz --endpoint %s repro create_and_connect %s %s"
% (get_instance_url(), self.container, self.filename),
}
)
5 changes: 2 additions & 3 deletions src/api-service/__app__/onefuzzlib/tasks/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from onefuzztypes.models import TaskConfig, TaskDefinition, TaskUnitConfig

from ..azure.containers import blob_exists, get_container_sas_url, get_containers
from ..azure.creds import get_fuzz_storage, get_instance_name
from ..azure.creds import get_fuzz_storage, get_instance_url
from ..azure.queue import get_queue_sas
from .defs import TASK_DEFINITIONS

Expand Down Expand Up @@ -184,8 +184,7 @@ def build_task_config(
account_id=os.environ["ONEFUZZ_FUNC_STORAGE"],
add=True,
),
back_channel_address="https://%s.azurewebsites.net/api/back_channel"
% (get_instance_name()),
back_channel_address="https://%s/api/back_channel" % (get_instance_url()),
)

if definition.monitor_queue:
Expand Down
4 changes: 2 additions & 2 deletions src/api-service/__app__/pool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
from onefuzztypes.models import AgentConfig, Error
from onefuzztypes.requests import PoolCreate, PoolSearch, PoolStop

from ..onefuzzlib.azure.creds import get_instance_name
from ..onefuzzlib.azure.creds import get_instance_url
from ..onefuzzlib.pools import Pool
from ..onefuzzlib.request import not_ok, ok, parse_request


def set_config(pool: Pool) -> Pool:
pool.config = AgentConfig(
pool_name=pool.name,
onefuzz_url="https://%s.azurewebsites.net" % get_instance_name(),
onefuzz_url=get_instance_url(),
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
)
Expand Down