Skip to content

Commit

Permalink
Restore support for deprecated sections like drbd, ...
Browse files Browse the repository at this point in the history
In this case we can't fetch the resource type as it is deduced from the
section prefix.
  • Loading branch information
cvaroqui committed Jul 22, 2017
1 parent 590b413 commit 28a8cdf
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/svc.py
Expand Up @@ -5163,15 +5163,19 @@ def handle_references(self, s, scope=False, impersonate=None, config=None):
def conf_get(self, s, o, t=None, scope=None, impersonate=None,
use_default=True, config=None):
"""
Handle keyword deprecation.
Handle keyword and section deprecation.
"""
section = s.split("#")[0]
try:
rtype = self.config.get(s, "type")
if section in svcDict.deprecated_sections:
section, rtype = svcDict.deprecated_sections[section]
fkey = ".".join((section, rtype, o))
except:
rtype = None
fkey = ".".join((section, o))
else:
try:
rtype = self.config.get(s, "type")
fkey = ".".join((section, rtype, o))
except:
rtype = None
fkey = ".".join((section, o))

deprecated_keyword = svcDict.reverse_deprecated_keywords.get(fkey)

Expand Down Expand Up @@ -5216,6 +5220,7 @@ def _conf_get(self, s, o, t=None, scope=None, impersonate=None,
key = svcDict.svc_keys[section].getkey(o, rtype)
if key is None:
if scope is None and t is None:
raise
raise ValueError("%s.%s not found in the services configuration dictionary" % \
(s, o))
else:
Expand Down

0 comments on commit 28a8cdf

Please sign in to comment.