func (c *networkCmd) doNetworkAttachProfile(client *lxd.Client, name string, args []string) error { if len(args) < 1 || len(args) > 2 { return errArgs } profile := args[0] devName := name if len(args) > 1 { devName = args[1] } network, err := client.NetworkGet(name) if err != nil { return err } nicType := "macvlan" if network.Type == "bridge" { nicType = "bridged" } props := []string{fmt.Sprintf("nictype=%s", nicType), fmt.Sprintf("parent=%s", name)} _, err = client.ProfileDeviceAdd(profile, devName, "nic", props) return err }