mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-20 08:18:24 +00:00
Merge pull request #8966 from microsoft/danmihai1/k8s-sandbox-vcpus-allocation
genpolicy: ignore empty YAML as input
This commit is contained in:
@@ -374,8 +374,8 @@ impl AgentPolicy {
|
|||||||
|
|
||||||
for document in serde_yaml::Deserializer::from_str(&yaml_contents) {
|
for document in serde_yaml::Deserializer::from_str(&yaml_contents) {
|
||||||
let doc_mapping = Value::deserialize(document)?;
|
let doc_mapping = Value::deserialize(document)?;
|
||||||
|
if doc_mapping != Value::Null {
|
||||||
let yaml_string = serde_yaml::to_string(&doc_mapping)?;
|
let yaml_string = serde_yaml::to_string(&doc_mapping)?;
|
||||||
|
|
||||||
let silent = config.silent_unsupported_fields;
|
let silent = config.silent_unsupported_fields;
|
||||||
let (mut resource, kind) = yaml::new_k8s_resource(&yaml_string, silent)?;
|
let (mut resource, kind) = yaml::new_k8s_resource(&yaml_string, silent)?;
|
||||||
resource.init(config.use_cache, &doc_mapping, silent).await;
|
resource.init(config.use_cache, &doc_mapping, silent).await;
|
||||||
@@ -397,6 +397,7 @@ impl AgentPolicy {
|
|||||||
// YAML file.
|
// YAML file.
|
||||||
resources.push(resource);
|
resources.push(resource);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let settings = settings::Settings::new(&config.json_settings_path);
|
let settings = settings::Settings::new(&config.json_settings_path);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user