Debian Codegraph @

lib/puppet/provider/ceph_config/ini_setting.rb

raw
1 # Copyright (C) Dan Bode <[email protected]>
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 # Author: Dan Bode <[email protected]>
16 # Author: Andrew Woodward <xarses>
17
18 Puppet::Type.type(:ceph_config).provide(
19 :ini_setting,
20 :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
21 ) do
22
23 def section
24 resource[:name].split('/', 2).first
25 end
26
27 def setting
28 resource[:name].split('/', 2).last
29 end
30
31 def separator
32 ' = '
33 end
34
35 def self.file_path
36 '/etc/ceph/ceph.conf'
37 end
38
39 # required to be able to hack the path in unit tests
40 # also required if a user wants to otherwise overwrite the default file_path
41 # Note: purge will not work on over-ridden file_path
42 def file_path
43 if not resource[:path]
44 self.class.file_path
45 else
46 resource[:path]
47 end
48 end
49
50 end