Fix the issue of returning '* file not found' error

return default empty when file is not existing
This commit is contained in:
Steven Zou 2018-07-23 14:53:40 +08:00
parent bb380e6dbc
commit 2f0b706f84

View File

@ -55,17 +55,26 @@ func (cho *ChartOperator) GetChartDetails(content []byte) (*ChartVersionDetails,
//Parse the requirements of chart //Parse the requirements of chart
requirements, err := chartutil.LoadRequirements(chartData) requirements, err := chartutil.LoadRequirements(chartData)
if err != nil { if err != nil {
//If no requirements.yaml, return empty dependency list
if _, ok := err.(chartutil.ErrNoRequirementsFile); ok {
requirements = &chartutil.Requirements{
Dependencies: make([]*chartutil.Dependency, 0),
}
} else {
return nil, err return nil, err
} }
}
var values map[string]interface{} var values map[string]interface{}
files := make(map[string]string) files := make(map[string]string)
//Parse values //Parse values
if chartData.Values != nil { if chartData.Values != nil {
values = parseRawValues([]byte(chartData.Values.GetRaw())) values = parseRawValues([]byte(chartData.Values.GetRaw()))
if len(values) > 0 {
//Append values.yaml file //Append values.yaml file
files["values.yaml"] = chartData.Values.Raw files["values.yaml"] = chartData.Values.Raw
} }
}
//Append other files like 'README.md' //Append other files like 'README.md'
for _, v := range chartData.GetFiles() { for _, v := range chartData.GetFiles() {