github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/payload/context/export_test.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package context 5 6 import ( 7 "github.com/juju/juju/payload" 8 ) 9 10 func AddPayload(ctx *Context, id string, pl payload.Payload) { 11 if _, ok := ctx.payloads[id]; !ok { 12 ctx.payloads[id] = pl 13 } else { 14 ctx.updates[pl.FullID()] = pl 15 } 16 } 17 18 func AddPayloads(ctx *Context, payloads ...payload.Payload) { 19 for _, pl := range payloads { 20 AddPayload(ctx, pl.FullID(), pl) 21 } 22 }