Change network to a boolean

This commit is contained in:
Donny Xia
2020-09-16 16:20:50 -07:00
parent 76bae738a0
commit f6c06b58ef
6 changed files with 129 additions and 43 deletions

View File

@@ -294,12 +294,13 @@ func (r RunFns) getFunctionFilters(global bool, fns ...*yaml.RNode) (
for i := range fns {
api := fns[i]
spec := runtimeutil.GetFunctionSpec(api)
if spec.Container.Network.Required {
if !r.Network {
// TODO(eddiezane): Provide error info about which function needs the network
return fltrs, errors.Errorf("network required but not enabled with --network")
}
spec.Container.Network.Name = runtimeutil.ContainerNetworkName(r.NetworkName)
if spec == nil {
// resource doesn't have function spec
continue
}
if spec.Container.Network && !r.Network {
// TODO(eddiezane): Provide error info about which function needs the network
return fltrs, errors.Errorf("network required but not enabled with --network")
}
// command line username and envs has higher priority
if !r.User.IsEmpty() {