|
21 | 21 | import yaml |
22 | 22 | from typing import Optional, Tuple, Callable, Union |
23 | 23 |
|
24 | | -from cloudinit import netinfo |
| 24 | +from cloudinit import features, netinfo |
25 | 25 | from cloudinit import signal_handler |
26 | 26 | from cloudinit import sources |
27 | 27 | from cloudinit import socket |
@@ -486,7 +486,9 @@ def main_init(name, args): |
486 | 486 | mode = sources.DSMODE_LOCAL if args.local else sources.DSMODE_NETWORK |
487 | 487 |
|
488 | 488 | if mode == sources.DSMODE_NETWORK: |
489 | | - if not os.path.exists(init.paths.get_runpath(".skip-network")): |
| 489 | + if features.MANUAL_NETWORK_WAIT and not os.path.exists( |
| 490 | + init.paths.get_runpath(".skip-network") |
| 491 | + ): |
490 | 492 | LOG.debug("Will wait for network connectivity before continuing") |
491 | 493 | init.distro.wait_for_network() |
492 | 494 | existing = "trust" |
@@ -560,20 +562,21 @@ def main_init(name, args): |
560 | 562 | init.apply_network_config(bring_up=bring_up_interfaces) |
561 | 563 |
|
562 | 564 | if mode == sources.DSMODE_LOCAL: |
563 | | - should_wait, reason = _should_wait_on_network(init.datasource) |
564 | | - if should_wait: |
565 | | - LOG.debug( |
566 | | - "Network connectivity determined necessary for " |
567 | | - "cloud-init's network stage. Reason: %s", |
568 | | - reason, |
569 | | - ) |
570 | | - else: |
571 | | - LOG.debug( |
572 | | - "Network connectivity determined unnecessary for " |
573 | | - "cloud-init's network stage. Reason: %s", |
574 | | - reason, |
575 | | - ) |
576 | | - util.write_file(init.paths.get_runpath(".skip-network"), "") |
| 565 | + if features.MANUAL_NETWORK_WAIT: |
| 566 | + should_wait, reason = _should_wait_on_network(init.datasource) |
| 567 | + if should_wait: |
| 568 | + LOG.debug( |
| 569 | + "Network connectivity determined necessary for " |
| 570 | + "cloud-init's network stage. Reason: %s", |
| 571 | + reason, |
| 572 | + ) |
| 573 | + else: |
| 574 | + LOG.debug( |
| 575 | + "Network connectivity determined unnecessary for " |
| 576 | + "cloud-init's network stage. Reason: %s", |
| 577 | + reason, |
| 578 | + ) |
| 579 | + util.write_file(init.paths.get_runpath(".skip-network"), "") |
577 | 580 |
|
578 | 581 | if init.datasource.dsmode != mode: |
579 | 582 | LOG.debug( |
|
0 commit comments