Skip to content

Commit 8fe3603

Browse files
Merge pull request #10041 from bear-redhat/issue/CORS-4275
CORS-4275: Add Windows support
2 parents e064c5f + 5166c3e commit 8fe3603

32 files changed

+158
-63
lines changed

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# the following files will be injected into the bootstrap node (CoreOS) as-is,
2+
# which must be in Unix line endings (LF)
3+
data/data/bootstrap/systemd/**/*.service text eol=lf
4+
data/data/bootstrap/systemd/**/*.socket text eol=lf
5+
data/data/bootstrap/systemd/**/*.conf text eol=lf
6+
data/data/bootstrap/files/** text eol=lf

pkg/asset/agent/image/ignition.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,14 @@ func (a *Ignition) Generate(ctx context.Context, dependencies asset.Parents) err
316316

317317
// add ZTP manifests to manifestPath
318318
for _, file := range agentManifests.FileList {
319-
manifestFile := ignition.FileFromBytes(filepath.Join(manifestPath, filepath.Base(file.Filename)),
319+
manifestFile := ignition.FileFromBytes(path.Join(manifestPath, filepath.Base(file.Filename)),
320320
"root", 0600, file.Data)
321321
config.Storage.Files = append(config.Storage.Files, manifestFile)
322322
}
323323

324324
// add AgentConfig if provided
325325
if agentConfigAsset.Config != nil {
326-
agentConfigFile := ignition.FileFromBytes(filepath.Join(manifestPath, filepath.Base(agentConfigAsset.File.Filename)),
326+
agentConfigFile := ignition.FileFromBytes(path.Join(manifestPath, filepath.Base(agentConfigAsset.File.Filename)),
327327
"root", 0600, agentConfigAsset.File.Data)
328328
config.Storage.Files = append(config.Storage.Files, agentConfigFile)
329329
}
@@ -588,7 +588,7 @@ func addMacAddressToHostnameMappings(
588588
}
589589
for _, host := range agentHostsAsset.Hosts {
590590
if host.Hostname != "" {
591-
file := ignition.FileFromBytes(filepath.Join(hostnamesPath,
591+
file := ignition.FileFromBytes(path.Join(hostnamesPath,
592592
strings.ToLower(filepath.Base(host.Interfaces[0].MacAddress))),
593593
"root", 0600, []byte(host.Hostname))
594594
config.Storage.Files = append(config.Storage.Files, file)
@@ -602,8 +602,8 @@ func addHostConfig(config *igntypes.Config, agentHosts *agentconfig.AgentHosts)
602602
return err
603603
}
604604

605-
for path, content := range confs {
606-
hostConfigFile := ignition.FileFromBytes(filepath.Join("/etc/assisted/hostconfig", path), "root", 0644, content)
605+
for pathName, content := range confs {
606+
hostConfigFile := ignition.FileFromBytes(path.Join("/etc/assisted/hostconfig", pathName), "root", 0644, content)
607607
config.Storage.Files = append(config.Storage.Files, hostConfigFile)
608608
}
609609
return nil

pkg/asset/agent/image/unconfigured_ignition.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"net/url"
66
"os"
7+
"path"
78
"path/filepath"
89
"strings"
910

@@ -236,7 +237,7 @@ func (a *UnconfiguredIgnition) Generate(_ context.Context, dependencies asset.Pa
236237
}
237238

238239
for _, file := range ztpManifestsToInclude {
239-
manifestFile := ignition.FileFromBytes(filepath.Join(manifestPath, filepath.Base(file.Filename)),
240+
manifestFile := ignition.FileFromBytes(path.Join(manifestPath, filepath.Base(file.Filename)),
240241
"root", 0600, file.Data)
241242
config.Storage.Files = append(config.Storage.Files, manifestFile)
242243
}

pkg/asset/ignition/bootstrap/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ func (a *Common) addParentFiles(dependencies asset.Parents) {
682682

683683
rootCA := &tls.RootCA{}
684684
dependencies.Get(rootCA)
685-
a.Config.Storage.Files = replaceOrAppend(a.Config.Storage.Files, ignition.FileFromBytes(filepath.Join(rootDir, rootCA.CertFile().Filename), "root", 0644, rootCA.Cert()))
685+
a.Config.Storage.Files = replaceOrAppend(a.Config.Storage.Files, ignition.FileFromBytes(path.Join(rootDir, rootCA.CertFile().Filename), "root", 0644, rootCA.Cert()))
686686
}
687687

688688
func replaceOrAppend(files []igntypes.File, file igntypes.File) []igntypes.File {

pkg/asset/ignition/bootstrap/cvoignore.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"os"
8+
"path"
89

910
"github.com/pkg/errors"
1011
"github.com/sirupsen/logrus"
@@ -18,10 +19,8 @@ import (
1819

1920
var (
2021
_ asset.WritableAsset = (*CVOIgnore)(nil)
21-
)
2222

23-
const (
24-
cvoOverridesFilename = "manifests/cvo-overrides.yaml"
23+
cvoOverridesFilename = path.Join("manifests", "cvo-overrides.yaml")
2524
originalOverridesFilename = "original_cvo_overrides.patch"
2625
)
2726

pkg/asset/ignition/node.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ignition
22

33
import (
44
"fmt"
5+
"path"
56
"path/filepath"
67

78
"github.com/clarketm/json"
@@ -30,7 +31,10 @@ func Marshal(input interface{}) ([]byte, error) {
3031
func FilesFromAsset(pathPrefix string, username string, mode int, asset asset.WritableAsset) []igntypes.File {
3132
var files []igntypes.File
3233
for _, f := range asset.Files() {
33-
files = append(files, FileFromBytes(filepath.Join(pathPrefix, f.Filename), username, mode, f.Data))
34+
// f.Filename is using platform-specific path separators
35+
// while its used in CoreOS, thus we need to convert it to Unix path separators
36+
normalizedFilename := path.Join(pathPrefix, filepath.ToSlash(f.Filename))
37+
files = append(files, FileFromBytes(normalizedFilename, username, mode, f.Data))
3438
}
3539
return files
3640
}

pkg/asset/manifests/additionaltrustbundleconfig.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"crypto/x509"
66
"encoding/pem"
77
"fmt"
8-
"path/filepath"
8+
"path"
99
"strings"
1010

1111
"github.com/pkg/errors"
@@ -20,7 +20,7 @@ import (
2020
)
2121

2222
var (
23-
additionalTrustBundleConfigFileName = filepath.Join(manifestDir, "user-ca-bundle-config.yaml")
23+
additionalTrustBundleConfigFileName = path.Join(manifestDir, "user-ca-bundle-config.yaml")
2424
)
2525

2626
const (

pkg/asset/manifests/cloudproviderconfig.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"path/filepath"
7+
"path"
88

99
"github.com/IBM/vpc-go-sdk/vpcv1"
1010
"github.com/pkg/errors"
@@ -43,7 +43,7 @@ import (
4343
)
4444

4545
var (
46-
cloudProviderConfigFileName = filepath.Join(manifestDir, "cloud-provider-config.yaml")
46+
cloudProviderConfigFileName = path.Join(manifestDir, "cloud-provider-config.yaml")
4747
)
4848

4949
const (

pkg/asset/manifests/clustercsidriver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package manifests
22

33
import (
44
"context"
5-
"path/filepath"
5+
"path"
66

77
"github.com/pkg/errors"
88

@@ -19,7 +19,7 @@ import (
1919
)
2020

2121
var (
22-
clusterCSIDriverConfigFileName = filepath.Join(manifestDir, "cluster-csi-driver-config.yaml")
22+
clusterCSIDriverConfigFileName = path.Join(manifestDir, "cluster-csi-driver-config.yaml")
2323
)
2424

2525
// ClusterCSIDriverConfig generates the cluster-csi-driver-config.yaml file.

pkg/asset/manifests/dns.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package manifests
33
import (
44
"context"
55
"fmt"
6-
"path/filepath"
6+
"path"
77
"strings"
88

99
"github.com/pkg/errors"
@@ -35,7 +35,7 @@ import (
3535
)
3636

3737
var (
38-
dnsCfgFilename = filepath.Join(manifestDir, "cluster-dns-02-config.yml")
38+
dnsCfgFilename = path.Join(manifestDir, "cluster-dns-02-config.yml")
3939

4040
combineGCPZoneInfo = func(project, zoneName string) string {
4141
return fmt.Sprintf("project/%s/managedZones/%s", project, zoneName)

0 commit comments

Comments
 (0)