Removed unused functions

Fixes #534 by removing functions askForConfirmation in app.go, TransformData and RandStringBytes in utils.go
This commit is contained in:
Suraj Narwade 2017-04-04 11:24:35 +05:30
parent a24084d2a6
commit 3a086b4f2f
2 changed files with 0 additions and 55 deletions

View File

@ -17,7 +17,6 @@ limitations under the License.
package app
import (
"fmt"
"strings"
log "github.com/Sirupsen/logrus"
@ -306,19 +305,3 @@ func getTransformer(opt kobject.ConvertOptions) transformer.Transformer {
}
return t
}
func askForConfirmation() bool {
var response string
_, err := fmt.Scanln(&response)
if err != nil {
log.Fatal(err)
}
if response == "yes" {
return true
} else if response == "no" {
return false
} else {
fmt.Println("Please type yes or no and then press enter:")
return askForConfirmation()
}
}

View File

@ -17,37 +17,21 @@ limitations under the License.
package transformer
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"os"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/ghodss/yaml"
"github.com/kubernetes-incubator/kompose/pkg/kobject"
"path/filepath"
"github.com/pkg/errors"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789"
const Selector = "io.kompose.service"
// RandStringBytes generates randomly n-character string
func RandStringBytes(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = letterBytes[rand.Intn(len(letterBytes))]
}
return string(b)
}
// CreateOutFile creates the file to write to if --out is specified
func CreateOutFile(out string) (*os.File, error) {
var f *os.File
@ -130,28 +114,6 @@ func ConfigAnnotations(service kobject.ServiceConfig) map[string]string {
return annotations
}
// TransformData transforms data to json/yaml
func TransformData(obj runtime.Object, GenerateJSON bool) ([]byte, error) {
// Convert to versioned object
objectVersion := obj.GetObjectKind().GroupVersionKind()
version := unversioned.GroupVersion{Group: objectVersion.Group, Version: objectVersion.Version}
versionedObj, err := api.Scheme.ConvertToVersion(obj, version)
if err != nil {
return nil, err
}
// convert data to json / yaml
data, err := yaml.Marshal(versionedObj)
if GenerateJSON == true {
data, err = json.MarshalIndent(versionedObj, "", " ")
}
if err != nil {
return nil, err
}
log.Debugf("%s\n", data)
return data, nil
}
// Print either prints to stdout or to file/s
func Print(name, path string, trailing string, data []byte, toStdout, generateJSON bool, f *os.File) (string, error) {
file := ""