~verterok/charms/trusty/mongodb/fix-data_directory-migration

« back to all changes in this revision

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

  • Committer: Marco Ceppi
  • Date: 2015-03-24 19:55:48 UTC
  • mfrom: (66.1.3 mongodb)
  • Revision ID: marco@ceppi.net-20150324195548-qms64mwxd1w70vhe
[brad-marshall] Adds nrpe-external-master interface and adds basic nrpe checks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
3
3
 
4
 
__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>'
 
4
# Copyright 2014-2015 Canonical Limited.
 
5
#
 
6
# This file is part of charm-helpers.
 
7
#
 
8
# charm-helpers is free software: you can redistribute it and/or modify
 
9
# it under the terms of the GNU Lesser General Public License version 3 as
 
10
# published by the Free Software Foundation.
 
11
#
 
12
# charm-helpers is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU Lesser General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU Lesser General Public License
 
18
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
5
19
 
6
20
import io
7
21
import os
8
22
 
 
23
__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>'
 
24
 
9
25
 
10
26
class Fstab(io.FileIO):
11
27
    """This class extends file in order to implement a file reader/writer
61
77
        for line in self.readlines():
62
78
            line = line.decode('us-ascii')
63
79
            try:
64
 
                if line.strip() and not line.startswith("#"):
 
80
                if line.strip() and not line.strip().startswith("#"):
65
81
                    yield self._hydrate_entry(line)
66
82
            except ValueError:
67
83
                pass
88
104
 
89
105
        found = False
90
106
        for index, line in enumerate(lines):
91
 
            if not line.startswith("#"):
 
107
            if line.strip() and not line.strip().startswith("#"):
92
108
                if self._hydrate_entry(line) == entry:
93
109
                    found = True
94
110
                    break