Skip to content

Conversation

@jaspals3123
Copy link
Collaborator

No description provided.

Returns:
bool: True if network is accessible, False otherwise
"""
cmd = "ping"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be defined as a class var like "CMD_PING" so it can get picked up by the auto doc generation script.

# Run ping command
result = self._run_sut_cmd(f"{cmd} {url} {ping_option}")

network_accessible = result.exit_code == 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont need this extra var here, just use the result like:
if result.exit_code == 0:....

@alexandraBara
Copy link
Collaborator

alexandraBara commented Feb 2, 2026

Please update the functional test for this plugin and add the collector arg to the plugin_config: https://github.com/amd/node-scraper/blob/development/test/functional/fixtures/network_plugin_config.json

@alexandraBara alexandraBara changed the title adding url collector arg and test enhancements NetworkPlugin update: adding url collector arg and test enhancements Feb 2, 2026


class NetworkCollectorArgs(CollectorArgs):
url: Optional[str] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need another cmd here, it needs to be an optional with these choices:

 if cmd not in {"ping", "wget", "curl"}:
            raise ValueError("Invalid command")

uncollected_commands,
)

def _check_network_connectivity(self, url: str) -> bool:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check needs to be optional based on whether the user has specified collector_arg.url
We need a logic like this:

  if args.url:
    network_cmd = args.network_cmd
    if not network_cmd:
      network_cmd = "ping"
    --> now run _check_network_connectivity(url, network_cmd)
      

the logic is this: if user specifies url, then we need to check connectivity. If url is specified and network_cmd is not specified, then default network_cmd to "ping".

network_accessible: Optional[bool] = None

# Check network connectivity if URL is provided
if args and args.url:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my comment above should be added here to this if logic: https://github.com/amd/node-scraper/pull/120/changes#r2760251742

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants