MCPcopy Create free account
hub / github.com/canonical/cloud-init / parse_args

Function parse_args

tools/netplan_schema_check.py:8–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def parse_args() -> argparse.Namespace:
9 parser = argparse.ArgumentParser(
10 description="""
11This script validates netplan example files against the cloud-init networkv2
12schema. The goal is to provide an easy way to track drift between networkv2
13and netplan.
14
15Netplan does not provide a centralized schema file to compare against directly,
16but does maintain a reasonably comprehensive examples directory. This script
17relies on that directory to glean the netplan schema.
18 """,
19 formatter_class=argparse.RawTextHelpFormatter,
20 )
21 parser.add_argument(
22 "--schema-file",
23 required=True,
24 help="""
25The cloud-init networkv2 schema file found in
26cloudinit/config/schemas/schema-network-config-v2.json
27in this repository.
28 """,
29 )
30 parser.add_argument(
31 "--netplan-examples",
32 required=True,
33 help="""
34The examples/ directory in the netplan repo. The most
35recent netplan repo can be cloned from
36https://github.com/canonical/netplan.
37 """,
38 )
39 return parser.parse_args()
40
41
42def validate_netplan_against_networkv2(schema_file, netplan_examples):

Callers 1

Calls 1

parse_argsMethod · 0.80

Tested by

no test coverage detected