~thedac/charms/trusty/rabbitmq-server/backport-cluster-race-fixes

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/fstab.py

  • Committer: james.page at ubuntu
  • Date: 2015-03-26 13:07:43 UTC
  • mfrom: (82.2.3 rabbitmq-server)
  • Revision ID: james.page@ubuntu.com-20150326130743-opg59sdo60s2lx6j
Merge in trunk charm changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# You should have received a copy of the GNU Lesser General Public License
18
18
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
 
__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>'
21
 
 
22
20
import io
23
21
import os
24
22
 
 
23
__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>'
 
24
 
25
25
 
26
26
class Fstab(io.FileIO):
27
27
    """This class extends file in order to implement a file reader/writer
77
77
        for line in self.readlines():
78
78
            line = line.decode('us-ascii')
79
79
            try:
80
 
                if line.strip() and not line.startswith("#"):
 
80
                if line.strip() and not line.strip().startswith("#"):
81
81
                    yield self._hydrate_entry(line)
82
82
            except ValueError:
83
83
                pass
104
104
 
105
105
        found = False
106
106
        for index, line in enumerate(lines):
107
 
            if not line.startswith("#"):
 
107
            if line.strip() and not line.strip().startswith("#"):
108
108
                if self._hydrate_entry(line) == entry:
109
109
                    found = True
110
110
                    break