Skip to content

Commit

Permalink
Merge pull request #21 from Azure/pr-fix-logic-is-internal
Browse files Browse the repository at this point in the history
fix logic for IsExtensionInternal
  • Loading branch information
boumenot authored Sep 12, 2017
2 parents 8045f1b + db4213b commit 0d6edb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 2 additions & 7 deletions manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,7 @@ func newExtensionImageManifest(filename string, regions []string) (extensionMani
}

manifest.Regions = strings.Join(regions, ";")

if !isGuestAgent(manifest.ProviderNameSpace) {
manifest.IsInternalExtension = false
} else {
log.Debug("VM agent namespace detected, IsInternalExtension ignored")
}
manifest.IsInternalExtension = isGuestAgent(manifest.ProviderNameSpace)

return &manifest, nil
}
Expand All @@ -131,7 +126,7 @@ func newExtensionImageGlobalManifest(filename string) (extensionManifest, error)
return nil, err
}

manifest.IsInternalExtension = !isGuestAgent(manifest.ProviderNameSpace)
manifest.IsInternalExtension = isGuestAgent(manifest.ProviderNameSpace)
return &manifest, nil
}

Expand Down
10 changes: 10 additions & 0 deletions manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,13 @@ func TestRoundTripXmlExtensionImageGlobal(t *testing.T) {
t.Fatal(err)
}
}

func TestIsGuestAgent(t *testing.T) {
if !isGuestAgent("Microsoft.OSTCLinuxAgent") {
t.Error("true if namespace == \"Microsoft.OSTCAgentLinux\"")
}

if isGuestAgent("Is.Fake.Namespace") {
t.Error("true if namespace != \"Microsoft.OSTCAgentLinux\"")
}
}

0 comments on commit 0d6edb2

Please sign in to comment.