Check if config fields are nil

This commit is contained in:
Priya Wadhwa 2018-04-13 13:54:52 -07:00
parent 20b659aa32
commit a8ecbbd365
No known key found for this signature in database
GPG Key ID: 0D0DAFD8F7AA73AE
2 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,9 @@ func (r *ExposeCommand) ExecuteCommand(config *manifest.Schema2Config) error {
logrus.Info("cmd: EXPOSE")
// Grab the currently exposed ports
existingPorts := config.ExposedPorts
if existingPorts == nil {
existingPorts = make(map[manifest.Schema2Port]struct{})
}
// Add any new ones in
for _, p := range r.cmd.Ports {
// Resolve any environment variables

View File

@ -35,7 +35,9 @@ func (r *LabelCommand) ExecuteCommand(config *manifest.Schema2Config) error {
func updateLabels(labels []instructions.KeyValuePair, config *manifest.Schema2Config) error {
existingLabels := config.Labels
if existingLabels == nil {
existingLabels = make(map[string]string)
}
// Let's unescape values before setting the label
for index, kvp := range labels {
unescaped, err := util.ResolveEnvironmentReplacement(kvp.Value, []string{}, false)