tasks/agent.py
def refresh_assets(_, build_tags, development=True, flavor=AgentFlavor.base.name, windows_sysprobe=False):
    """
    Clean up and refresh Collector's assets and config files
    """
    flavor = AgentFlavor[flavor]
    # ensure BIN_PATH exists
    if not os.path.exists(BIN_PATH):
        os.mkdir(BIN_PATH)

    dist_folder = os.path.join(BIN_PATH, "dist")
    if os.path.exists(dist_folder):
        shutil.rmtree(dist_folder)
    os.mkdir(dist_folder)

    if "python" in build_tags:
        copy_tree("./cmd/agent/dist/checks/", os.path.join(dist_folder, "checks"))
        copy_tree("./cmd/agent/dist/utils/", os.path.join(dist_folder, "utils"))
        shutil.copy("./cmd/agent/dist/config.py", os.path.join(dist_folder, "config.py"))
    if not flavor.is_iot():
        shutil.copy("./cmd/agent/dist/dd-agent", os.path.join(dist_folder, "dd-agent"))
        # copy the dd-agent placeholder to the bin folder
        bin_ddagent = os.path.join(BIN_PATH, "dd-agent")
        shutil.move(os.path.join(dist_folder, "dd-agent"), bin_ddagent)

    # System probe not supported on windows
    if sys.platform.startswith('linux') or windows_sysprobe:
        shutil.copy("./cmd/agent/dist/system-probe.yaml", os.path.join(dist_folder, "system-probe.yaml"))
    shutil.copy("./cmd/agent/dist/datadog.yaml", os.path.join(dist_folder, "datadog.yaml"))

    for check in AGENT_CORECHECKS if not flavor.is_iot() else IOT_AGENT_CORECHECKS:
        check_dir = os.path.join(dist_folder, f"conf.d/{check}.d/")
        copy_tree(f"./cmd/agent/dist/conf.d/{check}.d/", check_dir)
    if "apm" in build_tags:
        shutil.copy("./cmd/agent/dist/conf.d/apm.yaml.default", os.path.join(dist_folder, "conf.d/apm.yaml.default"))
    if "process" in build_tags:
        shutil.copy(
            "./cmd/agent/dist/conf.d/process_agent.yaml.default",
            os.path.join(dist_folder, "conf.d/process_agent.yaml.default"),
        )

    copy_tree("./cmd/agent/gui/views", os.path.join(dist_folder, "views"))
    if development:
        copy_tree("./dev/dist/", dist_folder)

    Clean up and refresh Collector's assets and config files
    
Clean up and refresh Collector's assets and config files
Clean up and refresh Collector ' s assets and config files
def refresh_assets(_, build_tags, development=True, flavor=AgentFlavor.base.name, windows_sysprobe=False):
    flavor = AgentFlavor[flavor]
    if not os.path.exists(BIN_PATH):
        os.mkdir(BIN_PATH)
    dist_folder = os.path.join(BIN_PATH, "dist")
    if os.path.exists(dist_folder):
        shutil.rmtree(dist_folder)
    os.mkdir(dist_folder)
    if "python" in build_tags:
        copy_tree("./cmd/agent/dist/checks/", os.path.join(dist_folder, "checks"))
        copy_tree("./cmd/agent/dist/utils/", os.path.join(dist_folder, "utils"))
        shutil.copy("./cmd/agent/dist/config.py", os.path.join(dist_folder, "config.py"))
    if not flavor.is_iot():
        shutil.copy("./cmd/agent/dist/dd-agent", os.path.join(dist_folder, "dd-agent"))
        bin_ddagent = os.path.join(BIN_PATH, "dd-agent")
        shutil.move(os.path.join(dist_folder, "dd-agent"), bin_ddagent)
    if sys.platform.startswith('linux') or windows_sysprobe:
        shutil.copy("./cmd/agent/dist/system-probe.yaml", os.path.join(dist_folder, "system-probe.yaml"))
    shutil.copy("./cmd/agent/dist/datadog.yaml", os.path.join(dist_folder, "datadog.yaml"))
    for check in AGENT_CORECHECKS if not flavor.is_iot() else IOT_AGENT_CORECHECKS:
        check_dir = os.path.join(dist_folder, f"conf.d/{check}.d/")
        copy_tree(f"./cmd/agent/dist/conf.d/{check}.d/", check_dir)
    if "apm" in build_tags:
        shutil.copy("./cmd/agent/dist/conf.d/apm.yaml.default", os.path.join(dist_folder, "conf.d/apm.yaml.default"))
    if "process" in build_tags:
        shutil.copy(
            "./cmd/agent/dist/conf.d/process_agent.yaml.default",
            os.path.join(dist_folder, "conf.d/process_agent.yaml.default"),
        )
    copy_tree("./cmd/agent/gui/views", os.path.join(dist_folder, "views"))
    if development:
        copy_tree("./dev/dist/", dist_folder)
def refresh_assets ( _ , build_tags , development = True , flavor = AgentFlavor . base . name , windows_sysprobe = False ) : flavor = AgentFlavor [ flavor ] if not os . path . exists ( BIN_PATH ) : os . mkdir ( BIN_PATH ) dist_folder = os . path . join ( BIN_PATH , "dist" ) if os . path . exists ( dist_folder ) : shutil . rmtree ( dist_folder ) os . mkdir ( dist_folder ) if "python" in build_tags : copy_tree ( "./cmd/agent/dist/checks/" , os . path . join ( dist_folder , "checks" ) ) copy_tree ( "./cmd/agent/dist/utils/" , os . path . join ( dist_folder , "utils" ) ) shutil . copy ( "./cmd/agent/dist/config.py" , os . path . join ( dist_folder , "config.py" ) ) if not flavor . is_iot ( ) : shutil . copy ( "./cmd/agent/dist/dd-agent" , os . path . join ( dist_folder , "dd-agent" ) ) bin_ddagent = os . path . join ( BIN_PATH , "dd-agent" ) shutil . move ( os . path . join ( dist_folder , "dd-agent" ) , bin_ddagent ) if sys . platform . startswith ( 'linux' ) or windows_sysprobe : shutil . copy ( "./cmd/agent/dist/system-probe.yaml" , os . path . join ( dist_folder , "system-probe.yaml" ) ) shutil . copy ( "./cmd/agent/dist/datadog.yaml" , os . path . join ( dist_folder , "datadog.yaml" ) ) for check in AGENT_CORECHECKS if not flavor . is_iot ( ) else IOT_AGENT_CORECHECKS : check_dir = os . path . join ( dist_folder , f"conf.d/{check}.d/" ) copy_tree ( f"./cmd/agent/dist/conf.d/{check}.d/" , check_dir ) if "apm" in build_tags : shutil . copy ( "./cmd/agent/dist/conf.d/apm.yaml.default" , os . path . join ( dist_folder , "conf.d/apm.yaml.default" ) ) if "process" in build_tags : shutil . copy ( "./cmd/agent/dist/conf.d/process_agent.yaml.default" , os . path . join ( dist_folder , "conf.d/process_agent.yaml.default" ) , ) copy_tree ( "./cmd/agent/gui/views" , os . path . join ( dist_folder , "views" ) ) if development : copy_tree ( "./dev/dist/" , dist_folder )
Clean up and refresh Collector's assets and config files
Clean up and refresh Collector ' s assets and config files
"""
    Clean up and refresh Collector's assets and config files
    """ # ensure BIN_PATH exists # copy the dd-agent placeholder to the bin folder # System probe not supported on windows
_
build_tags
development
flavor
windows_sysprobe