Skip to content

Commit 4fb379f

Browse files
committed
cargo: add feature flag which disables nmstate by default
With the latest release for f42 dependencies which are required for nmstate will no longer be available. There is a PR which has landed nmstate/nmstate#2820 but a build of nmstate needs to land with those changes in f42. To prevent issues for coreos-installer add a featureflag to make nmstate dependency an optional one. If the feature 'use-nmstate' is not available coreos-installer will lose functionality around customizing network settings. By adding the feature 'use-nmstate' functionality would be restored. resolves: #1602
1 parent 326f6bf commit 4fb379f

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ all-features = true
2828
# rdcore is only useful inside the initrd of a CoreOS system
2929
rdcore = []
3030
docgen = ["clap/string", "dep:clap_mangen"]
31+
# nmstate has deprecated deps and cannot be used in f42 in its current state
32+
# nmstate/nmstate#2820 should make allow for this feature to be removed.
33+
use-nmstate = ["nmstate"]
3134

3235
[lib]
3336
name = "libcoreinst"
@@ -64,7 +67,7 @@ ignition-config = ">= 0.3, < 0.6"
6467
lazy_static = "^1.4"
6568
libc = "^0.2"
6669
nix = { version = ">= 0.24, < 0.28", "default_features" = false, "features" = [ "dir", "ioctl", "mount", "process", "sched", "signal", "user"] }
67-
nmstate = { version = ">= 2.2.3, < 3", default-features = false, features = ["gen_conf"] }
70+
nmstate = { version = ">= 2.2.3, < 3", default-features = false, features = ["gen_conf"], optional = true }
6871
openssl = "^0.10"
6972
pipe = ">= 0.3, < 0.5"
7073
regex = ">= 1.4, < 2"

docs/release-notes.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Minor changes:
1515

1616
Internal changes:
1717
- s390x: Use options and logic compatible with both C-based `genprotimg` and Rust-based `pvimg`
18+
- nmstate: add feature-flag to remove hard dependency
1819

1920
Packaging changes:
2021

src/cmdline/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ pub struct CommonCustomizeConfig {
299299
/// environment, including when Ignition is run. If installer is enabled
300300
/// via additional options, network settings will also be applied in the
301301
/// destination system, including when Ignition is run.
302+
#[cfg(feature = "use-nmstate")]
302303
#[arg(long, value_name = "path")]
303304
pub network_nmstate: Vec<String>,
304305
/// Ignition PEM CA bundle for live & dest

src/live/customize.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
//! Infrastructure for high-level ISO/PXE customizations
1616
1717
use anyhow::{bail, Context, Result};
18+
#[cfg(feature = "use-nmstate")]
1819
use nmstate::NetworkState;
1920
use serde::Deserialize;
2021
use serde_json;
2122
use std::fs::read;
23+
#[cfg(feature = "use-nmstate")]
2224
use std::path::Path;
2325

2426
use crate::cmdline::*;
@@ -122,6 +124,7 @@ impl LiveInitrd {
122124
for path in &common.network_keyfile {
123125
conf.network_keyfile(path)?;
124126
}
127+
#[cfg(feature = "use-nmstate")]
125128
for path in &common.network_nmstate {
126129
conf.network_nmstate(path)?;
127130
}
@@ -201,7 +204,7 @@ impl LiveInitrd {
201204
self.installer_copy_network = true;
202205
Ok(())
203206
}
204-
207+
#[cfg(feature = "use-nmstate")]
205208
pub fn network_nmstate(&mut self, path: &str) -> Result<()> {
206209
if !self.features.live_initrd_network {
207210
bail!("This OS image does not support customizing network settings.");

0 commit comments

Comments
 (0)