Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Revert "fleetd: implemented GetUnitsByNames dbus method"
Browse files Browse the repository at this point in the history
This reverts commit 4edc9ba.
  • Loading branch information
Dongsu Park committed Aug 9, 2016
1 parent 1a53a7a commit 3b16720
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 166 deletions.
42 changes: 16 additions & 26 deletions systemd/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,17 @@ func (m *systemdUnitManager) GetUnitStates(filter pkg.Set) (map[string]*unit.Uni
// operations could mutate the hashes before we've retrieved the state
// for every unit in the filter, since they won't necessarily all be
// present in the initial ListUnits() call.
fallback := false

m.mutex.Lock()
defer m.mutex.Unlock()
dbusStatuses, err := m.systemd.ListUnitsByNames(filter.Values())
dbusStatuses, err := m.systemd.ListUnits()

if err != nil {
fallback = true
log.Debugf("ListUnitsByNames is not implemented in your systemd version (requires at least systemd 230), fallback to ListUnits: %v", err)
dbusStatuses, err = m.systemd.ListUnits()
if err != nil {
return nil, err
}
return nil, err
}

states := make(map[string]*unit.UnitState)
for _, dus := range dbusStatuses {
if fallback && !filter.Contains(dus.Name) {
// If filter could not be applied on DBus side, we will filter unit files here
if !filter.Contains(dus.Name) {
continue
}

Expand All @@ -237,23 +229,21 @@ func (m *systemdUnitManager) GetUnitStates(filter pkg.Set) (map[string]*unit.Uni
states[dus.Name] = us
}

// grab data on subscribed units that didn't show up in ListUnits in fallback mode, most
// grab data on subscribed units that didn't show up in ListUnits, most
// likely due to being inactive
if fallback {
for _, name := range filter.Values() {
if _, ok := states[name]; ok {
continue
}

us, err := m.getUnitState(name)
if err != nil {
return nil, err
}
if h, ok := m.hashes[name]; ok {
us.UnitHash = h.String()
}
states[name] = us
for _, name := range filter.Values() {
if _, ok := states[name]; ok {
continue
}

us, err := m.getUnitState(name)
if err != nil {
return nil, err
}
if h, ok := m.hashes[name]; ok {
us.UnitHash = h.String()
}
states[name] = us
}

return states, nil
Expand Down
6 changes: 3 additions & 3 deletions vendor.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ github.com/coreos/etcd/client b2d33e6dcb24cddc0395f1bbe2213a27aef0fb46
github.com/coreos/etcd/pkg/pathutil b2d33e6dcb24cddc0395f1bbe2213a27aef0fb46
github.com/coreos/etcd/pkg/types b2d33e6dcb24cddc0395f1bbe2213a27aef0fb46
github.com/coreos/go-semver/semver a9a0c39c7e4a2929f73d4b757d1860fbb8e66d06
github.com/coreos/go-systemd/activation 6dc8b843c670f2027cc26b164935635840a40526
github.com/coreos/go-systemd/dbus 6dc8b843c670f2027cc26b164935635840a40526
github.com/coreos/go-systemd/unit 6dc8b843c670f2027cc26b164935635840a40526
github.com/coreos/go-systemd/activation 1f2251651d199b698a0be8c8bf2283178a2a97ed
github.com/coreos/go-systemd/dbus 1f2251651d199b698a0be8c8bf2283178a2a97ed
github.com/coreos/go-systemd/unit 1f2251651d199b698a0be8c8bf2283178a2a97ed
github.com/godbus/dbus 9bb9dbf0e53309fa81d26e7230cbb6cff9373cad
github.com/golang/protobuf/proto dda510ac0fd43b39770f22ac6260eb91d377bce3
github.com/jonboulle/clockwork b473f398c464f1988327f67c9e6aa7fba62f80d2
Expand Down
25 changes: 0 additions & 25 deletions vendor/github.com/coreos/go-systemd/activation/listeners.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 6 additions & 22 deletions vendor/github.com/coreos/go-systemd/dbus/dbus.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 16 additions & 90 deletions vendor/github.com/coreos/go-systemd/dbus/methods.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b16720

Please sign in to comment.