remove unused code

Signed-off-by: Shoubhik Bose <shbose@redhat.com>
pull/9152/head
Shoubhik Bose 5 years ago
parent d1c22b137a
commit f30761ee0d

@ -114,32 +114,6 @@ var manifestWithTestHook = `kind: Pod
cmd: fake-command cmd: fake-command
` `
var rbacManifests = `apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: schedule-agents
rules:
- apiGroups: [""]
resources: ["pods", "pods/exec", "pods/log"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: schedule-agents
namespace: {{ default .Release.Namespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: schedule-agents
subjects:
- kind: ServiceAccount
name: schedule-agents
namespace: {{ .Release.Namespace }}
`
type chartOptions struct { type chartOptions struct {
*chart.Chart *chart.Chart
} }
@ -247,15 +221,6 @@ func withSampleIncludingIncorrectTemplates() chartOption {
} }
} }
func withMultipleManifestTemplate() chartOption {
return func(opts *chartOptions) {
sampleTemplates := []*chart.File{
{Name: "templates/rbac", Data: []byte(rbacManifests)},
}
opts.Templates = append(opts.Templates, sampleTemplates...)
}
}
func withKube(version string) chartOption { func withKube(version string) chartOption {
return func(opts *chartOptions) { return func(opts *chartOptions) {
opts.Metadata.KubeVersion = version opts.Metadata.KubeVersion = version

@ -21,7 +21,6 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
"text/template" "text/template"
@ -63,8 +62,6 @@ const releaseNameMaxLen = 53
// since there can be filepath in front of it. // since there can be filepath in front of it.
const notesFileSuffix = "NOTES.txt" const notesFileSuffix = "NOTES.txt"
const defaultDirectoryPermission = 0755
// Install performs an installation operation. // Install performs an installation operation.
type Install struct { type Install struct {
cfg *Configuration cfg *Configuration
@ -485,50 +482,6 @@ func (i *Install) replaceRelease(rel *release.Release) error {
return i.recordRelease(last) return i.recordRelease(last)
} }
// write the <data> to <output-dir>/<name>. <append> controls if the file is created or content will be appended
func writeToFile(outputDir string, name string, data string, append bool) error {
outfileName := strings.Join([]string{outputDir, name}, string(filepath.Separator))
err := ensureDirectoryForFile(outfileName)
if err != nil {
return err
}
f, err := createOrOpenFile(outfileName, append)
if err != nil {
return err
}
defer f.Close()
_, err = f.WriteString(fmt.Sprintf("---\n# Source: %s\n%s\n", name, data))
if err != nil {
return err
}
fmt.Printf("wrote %s\n", outfileName)
return nil
}
func createOrOpenFile(filename string, append bool) (*os.File, error) {
if append {
return os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0600)
}
return os.Create(filename)
}
// check if the directory exists to create file. creates if don't exists
func ensureDirectoryForFile(file string) error {
baseDir := path.Dir(file)
_, err := os.Stat(baseDir)
if err != nil && !os.IsNotExist(err) {
return err
}
return os.MkdirAll(baseDir, defaultDirectoryPermission)
}
// NameAndChart returns the name and chart that should be used. // NameAndChart returns the name and chart that should be used.
// //
// This will read the flags and handle name generation if necessary. // This will read the flags and handle name generation if necessary.

Loading…
Cancel
Save