MCPcopy Create free account
hub / github.com/cloudfoundry/bosh-agent / GetMonitCredentials

Method GetMonitCredentials

platform/linux_platform.go:1654–1671  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1652}
1653
1654func (p linux) GetMonitCredentials() (username, password string, err error) {
1655 monitUserFilePath := path.Join(p.dirProvider.BaseDir(), "monit", "monit.user")
1656 credContent, err := p.fs.ReadFileString(monitUserFilePath)
1657 if err != nil {
1658 err = bosherr.WrapError(err, "Reading monit user file")
1659 return
1660 }
1661
1662 credParts := strings.SplitN(credContent, ":", 2)
1663 if len(credParts) != 2 {
1664 err = bosherr.Error("Malformated monit user file, expecting username and password separated by ':'")
1665 return
1666 }
1667
1668 username = credParts[0]
1669 password = credParts[1]
1670 return
1671}
1672
1673func (p linux) PrepareForNetworkingChange() error {
1674 err := p.fs.RemoveAll("/etc/udev/rules.d/70-persistent-net.rules")

Callers

nothing calls this directly

Calls 2

BaseDirMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected