| 1652 | } |
| 1653 | |
| 1654 | func (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 | |
| 1673 | func (p linux) PrepareForNetworkingChange() error { |
| 1674 | err := p.fs.RemoveAll("/etc/udev/rules.d/70-persistent-net.rules") |