Revert "Adding Filesystem check function to templater"

This reverts commit 154bcec95c

We don't use this function anywhere, moreover
fs related functions are way beyond the reasonable
functionality of templater. Especially taking
into account that we have only 1 function.

Change-Id: I919d8466ff1eab2d2687db7055bf974b7b608d8e
This commit is contained in:
Alexey Odinokov 2021-02-26 18:39:44 +00:00
parent f4b7c70537
commit b70848b57b
4 changed files with 0 additions and 65 deletions

View File

@ -1,24 +0,0 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package extlib
import (
"opendev.org/airship/airshipctl/pkg/fs"
)
func fileExists(path string) bool {
docfs := fs.NewDocumentFs()
return docfs.Exists(path)
}

View File

@ -1,26 +0,0 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package extlib
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestFileExists(t *testing.T) {
assert.Equal(t, true, fileExists("fs_test.go"))
assert.Equal(t, false, fileExists("fs_test_nonexistent.go"))
}

View File

@ -32,7 +32,6 @@ var genericMap = map[string]interface{}{
"genCAWithKeyEx": generateCertificateAuthorityWithPEMKeyEx,
"genSignedCertEx": generateSignedCertificateEx,
"genSignedCertWithKeyEx": generateSignedCertificateWithPEMKeyEx,
"fileExists": fileExists,
"regexGen": regexGen,
"toYaml": toYaml,
"toUint32": toUint32,

View File

@ -186,20 +186,6 @@ template: |
"at <regexGen .regex (.limit | int)>: error calling " +
"regexGen: error parsing regexp: missing closing ]: `[a-z`",
},
{
cfg: `
apiVersion: airshipit.org/v1alpha1
kind: Templater
metadata:
name: notImportantHere
template: |
FileExists: {{ fileExists "./templater.go" }}
NoFileExists: {{ fileExists "./templater1.go" }}
`,
expectedOut: `FileExists: true
NoFileExists: false
`,
},
}
for _, tc := range testCases {