コード例 #1
0
ファイル: chef.py プロジェクト: occopus/config-manager
 def perform(self, cm):
     node = chef.Node(self.node_id, api=cm.chefapi)
     dotted_attr = \
         attribute if isinstance(self.attribute, str) \
         else '.'.join(self.attribute) if hasattr(self.attribute, '__iter__') \
         else util.f_raise(TypeError(
             'Unknown attribute specification: {0}'.format(self.attribute)))
     try:
         return node.attributes.get_dotted(dotted_attr)
     except KeyError:
         raise KeyError('Unresolved node attribute: %s', dotted_attr)
コード例 #2
0
ファイル: chef.py プロジェクト: novakadam94/config-manager
 def get_node_attribute(self, node_id, attribute):
     node = chef.Node(node_id, api=self.chefapi)
     dotted_attr = \
         attribute if isinstance(attribute, basestring) \
         else '.'.join(attribute) if hasattr(attribute, '__iter__') \
         else util.f_raise(TypeError(
             'Unknown attribute specification: {0}'.format(attribute)))
     try:
         return node.attributes.get_dotted(dotted_attr)
     except KeyError:
         raise KeyError('Unresolved node attribute: %s', dotted_attr)
コード例 #3
0
ファイル: general_tests.py プロジェクト: novakadam94/util
 def test_f_raise(self):
     with self.assertRaises(Exception):
        util.f_raise(Exception())
コード例 #4
0
ファイル: general_tests.py プロジェクト: occopus/util
 def test_f_raise(self):
     with self.assertRaises(Exception):
         util.f_raise(Exception())