~freyes/charms/trusty/nova-cloud-controller/single-nova-consoleauth

« back to all changes in this revision

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

  • Committer: Felipe Reyes
  • Date: 2015-03-06 15:45:22 UTC
  • mfrom: (140.1.3 nova-cloud-controller)
  • Revision ID: felipe.reyes@canonical.com-20150306154522-z00f5lfyyekd9pi8
Commit after merge

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