Warning on missing port information and no service created

Now when user will not provide any port information
a warning will be shown and also service will not
be created.

Fixes #58
This commit is contained in:
Suraj Deshmukh 2016-07-27 10:25:02 +00:00
parent 3e1ae61376
commit e0bcd324d5

View File

@ -932,10 +932,16 @@ func komposeConvert(komposeObject KomposeObject, opt convertOptions) {
logrus.Fatalf(err.Error())
}
// convert datasvc to json / yaml
datasvc, err := transformer(sc, opt.generateYaml)
if err != nil {
logrus.Fatalf(err.Error())
var datasvc []byte
// If ports not provided in configuration we will not make service
if len(ports) == 0 {
logrus.Warningf("[%s] Service cannot be created because of missing port.", name)
} else {
// convert datasvc to json / yaml
datasvc, err = transformer(sc, opt.generateYaml)
if err != nil {
logrus.Fatalf(err.Error())
}
}
// convert OpenShift DeploymentConfig to json / yaml