Skip to content

Commit a168b5e

Browse files
committed
Simplify more
1 parent 05f4269 commit a168b5e

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

state/apiserver/deployer/deployer.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ func NewDeployerAPI(
4949
}
5050
// Then we just check if the unit is already known.
5151
return func(tag names.Tag) bool {
52-
// gcc has horrible problems comparing types and interfaces
53-
// so convert to concrete types.
54-
utag, ok := tag.(names.UnitTag)
55-
if !ok {
56-
return false
57-
}
5852
for _, unit := range units {
59-
if names.NewUnitTag(unit) == utag {
53+
// TODO (thumper): remove the names.Tag conversion when gccgo
54+
// implements concrete-type-to-interface comparison correctly.
55+
if names.Tag(names.NewUnitTag(unit)) == tag {
6056
return true
6157
}
6258
}

state/apiserver/networker/networker.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,13 @@ func NewNetworkerAPI(
5252
// Only machine tags are allowed.
5353
return false
5454
}
55-
56-
// gcc has horrible problems comparing types and interfaces
57-
// so convert to concrete types.
58-
authMachine, ok := authEntityTag.(names.MachineTag)
59-
if !ok {
60-
// the auth tag should always be a machine...
61-
return false
62-
}
6355
id := tag.Id()
6456
for parentId := state.ParentId(id); parentId != ""; parentId = state.ParentId(parentId) {
6557
// Until a top-level machine is reached.
66-
if names.NewMachineTag(parentId) == authMachine {
58+
59+
// TODO (thumper): remove the names.Tag conversion when gccgo
60+
// implements concrete-type-to-interface comparison correctly.
61+
if names.Tag(names.NewMachineTag(parentId)) == authEntityTag {
6762
// All containers with the authenticated machine as a
6863
// parent are accessible by it.
6964
return true

0 commit comments

Comments
 (0)