Skip to content

Commit

Permalink
Generate metaData even if only cloudInit is specified.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Jan 30, 2025
1 parent 4956658 commit e447a94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ data:
# Forward the cloud-init data if provided
<#if spec.cloudInit??>
cloudInit:
<#if spec.cloudInit.metaData??>
metaData: ${ toJson(adjustCloudInitMeta(spec.cloudInit.metaData, cr.metadata())) }
<#else>
metaData: {}
</#if>
metaData: ${ toJson(adjustCloudInitMeta(spec.cloudInit.metaData!{}, cr.metadata())) }
<#if spec.cloudInit.userData??>
userData: ${ toJson(spec.cloudInit.userData) }
<#else>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
import freemarker.template.TemplateExceptionHandler;
import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import freemarker.template.utility.DeepUnwrap;
import io.kubernetes.client.custom.Quantity;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
Expand All @@ -53,7 +55,6 @@
import org.jdrupes.vmoperator.manager.events.ResetVm;
import org.jdrupes.vmoperator.manager.events.VmChannel;
import org.jdrupes.vmoperator.manager.events.VmDefChanged;
import org.jdrupes.vmoperator.util.DataPath;
import org.jdrupes.vmoperator.util.ExtendedObjectWrapper;
import org.jgrapes.core.Channel;
import org.jgrapes.core.Component;
Expand Down Expand Up @@ -354,8 +355,9 @@ public Object exec(@SuppressWarnings("rawtypes") List arguments)
return "";
}
try {
var imageUri = new URI("file://" + Constants.IMAGE_REPO_PATH
+ "/").resolve(image);
var imageUri
= new URI("file://" + Constants.IMAGE_REPO_PATH + "/")
.resolve(image);
if ("file".equals(imageUri.getScheme())) {
return imageUri.getPath();
}
Expand All @@ -374,9 +376,8 @@ public Object exec(@SuppressWarnings("rawtypes") List arguments)
public Object exec(@SuppressWarnings("rawtypes") List arguments)
throws TemplateModelException {
@SuppressWarnings("unchecked")
var res = (Map<String, Object>) DataPath
.deepCopy(((AdapterTemplateModel) arguments.get(0))
.getAdaptedObject(Object.class));
var res = new HashMap<>((Map<String, Object>) DeepUnwrap
.unwrap((TemplateModel) arguments.get(0)));
var metadata
= (V1ObjectMeta) ((AdapterTemplateModel) arguments.get(1))
.getAdaptedObject(Object.class);
Expand Down

0 comments on commit e447a94

Please sign in to comment.