Backport support for ignition vmware properties
Backport support for guestinfo.ignition.config.data
This commit is contained in:
parent
8f7558a405
commit
cdb9cf4cdb
93
0001-support-coreos.config.-and-ignition.config.patch
Normal file
93
0001-support-coreos.config.-and-ignition.config.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From 41faa514b2598386c3a0c8a90ebd207e282cd1d5 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Nguyen <mnguyen@redhat.com>
|
||||
Date: Fri, 1 Mar 2019 12:10:47 -0500
|
||||
Subject: [PATCH] support coreos.config.* and ignition.config.*
|
||||
|
||||
This is backwards compatibility work for spec2x following the changes
|
||||
made in #663 to make options more distribution neutral.
|
||||
|
||||
ref: https://github.com/coreos/ignition/pull/663
|
||||
---
|
||||
internal/providers/cmdline/cmdline.go | 13 ++++++-------
|
||||
internal/providers/vmware/vmware_amd64.go | 20 ++++++++++++++++----
|
||||
2 files changed, 22 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/internal/providers/cmdline/cmdline.go b/internal/providers/cmdline/cmdline.go
|
||||
index 0bdba2d..1a393fb 100644
|
||||
--- a/internal/providers/cmdline/cmdline.go
|
||||
+++ b/internal/providers/cmdline/cmdline.go
|
||||
@@ -32,7 +32,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
- cmdlineUrlFlag = "coreos.config.url"
|
||||
+ cmdlineUrlFlagLegacy = "coreos.config.url"
|
||||
+ cmdlineUrlFlag = "ignition.config.url"
|
||||
)
|
||||
|
||||
func FetchConfig(f resource.Fetcher) (types.Config, report.Report, error) {
|
||||
@@ -83,12 +84,10 @@ func parseCmdline(cmdline []byte) (url string) {
|
||||
parts := strings.SplitN(strings.TrimSpace(arg), "=", 2)
|
||||
key := parts[0]
|
||||
|
||||
- if key != cmdlineUrlFlag {
|
||||
- continue
|
||||
- }
|
||||
-
|
||||
- if len(parts) == 2 {
|
||||
- url = parts[1]
|
||||
+ if key == cmdlineUrlFlagLegacy || key == cmdlineUrlFlag {
|
||||
+ if len(parts) == 2 {
|
||||
+ url = parts[1]
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/internal/providers/vmware/vmware_amd64.go b/internal/providers/vmware/vmware_amd64.go
|
||||
index e26baf0..9c0ffc7 100644
|
||||
--- a/internal/providers/vmware/vmware_amd64.go
|
||||
+++ b/internal/providers/vmware/vmware_amd64.go
|
||||
@@ -54,6 +54,8 @@ func fetchRawConfig(f resource.Fetcher) (config, error) {
|
||||
|
||||
var ovfData string
|
||||
var ovfEncoding string
|
||||
+ var ovfDataKey string
|
||||
+ var ovfEncodingKey string
|
||||
|
||||
ovfEnv, err := info.String("ovfenv", "")
|
||||
if err != nil {
|
||||
@@ -65,17 +67,27 @@ func fetchRawConfig(f resource.Fetcher) (config, error) {
|
||||
f.Logger.Warning("failed to parse OVF environment: %v. Continuing...", err)
|
||||
}
|
||||
|
||||
- ovfData = env.Properties["guestinfo.coreos.config.data"]
|
||||
- ovfEncoding = env.Properties["guestinfo.coreos.config.data.encoding"]
|
||||
+ if _, ok := env.Properties["guestinfo.coreos.config.data"]; ok {
|
||||
+ ovfDataKey = "guestinfo.coreos.config.data"
|
||||
+ ovfEncodingKey = "guestinfo.coreos.config.data.encoding"
|
||||
+ } else if _, ok := env.Properties["guestinfo.ignition.config.data"]; ok {
|
||||
+ ovfDataKey = "guestinfo.ignition.config.data"
|
||||
+ ovfEncodingKey = "guestinfo.ignition.config.data.encoding"
|
||||
+ } else {
|
||||
+ f.Logger.Debug("failed to find guestinfo ignition properties")
|
||||
+ }
|
||||
+
|
||||
+ ovfData = env.Properties[ovfDataKey]
|
||||
+ ovfEncoding = env.Properties[ovfEncodingKey]
|
||||
}
|
||||
|
||||
- data, err := info.String("coreos.config.data", ovfData)
|
||||
+ data, err := info.String(ovfDataKey[len("guestinfo."):], ovfData)
|
||||
if err != nil {
|
||||
f.Logger.Debug("failed to fetch config: %v", err)
|
||||
return config{}, err
|
||||
}
|
||||
|
||||
- encoding, err := info.String("coreos.config.data.encoding", ovfEncoding)
|
||||
+ encoding, err := info.String(ovfEncodingKey[len("guestinfo."):], ovfEncoding)
|
||||
if err != nil {
|
||||
f.Logger.Debug("failed to fetch config encoding: %v", err)
|
||||
return config{}, err
|
||||
--
|
||||
2.19.1
|
||||
|
@ -73,13 +73,15 @@
|
||||
|
||||
Name: ignition
|
||||
Version: 0.31.0
|
||||
Release: 5.git%{shortcommit}%{?dist}
|
||||
Release: 6.git%{shortcommit}%{?dist}
|
||||
Summary: First boot installer and configuration tool
|
||||
License: ASL 2.0 and BSD
|
||||
URL: https://%{provider_prefix}
|
||||
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
|
||||
Source1: https://%{dracutprovider_prefix}/archive/%{dracutcommit}/%{dracutrepo}-%{dracutshortcommit}.tar.gz
|
||||
|
||||
Patch0: 0001-support-coreos.config.-and-ignition.config.patch
|
||||
|
||||
# For RHEL7 we'll want to specify gopath and list of arches since there is no
|
||||
# gopath or go_arches macro. We'll also want to make sure we pull in golang
|
||||
# 1.10 require golang >= 1.10
|
||||
@ -334,13 +336,13 @@ This package contains a tool for validating Ignition configurations.
|
||||
# setup command reference: http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html
|
||||
# unpack source0 and apply patches
|
||||
%setup -T -b 0 -q -n %{repo}-%{commit}
|
||||
%patch0 -p1
|
||||
|
||||
# unpack source1 (dracut modules)
|
||||
%setup -T -D -a 1 -q -n %{repo}-%{commit}
|
||||
cd %{dracutrepo}-%{dracutcommit}
|
||||
mv LICENSE ../LICENSE.dracut
|
||||
|
||||
|
||||
%build
|
||||
# Set up PWD as a proper import path for go
|
||||
mkdir -p src/%{provider}.%{provider_tld}/%{project}
|
||||
@ -493,6 +495,9 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Mar 20 2019 Michael Nguyen <mnguyen@redhat.com> - 0.31.0-6.gitf59a653
|
||||
- Backport patch for supporting guestinfo.ignition.config.data
|
||||
|
||||
* Mon Mar 18 2019 Dusty Mabe <dusty@dustymabe.com> - 0.31.0-5.gitf59a653
|
||||
- Use the spec2x branch of ignition-dracut upstream
|
||||
- * Since ignition-dracut master has moved to supporting ignition
|
||||
|
Loading…
Reference in New Issue
Block a user