This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
from types import MethodType | |
def _init(self, *args, **kwargs): | |
if not self._typespec: | |
return | |
if len(self._fields) != len(self._typespec): | |
raise TypeError("Incorrect type in constructor") | |
for field, ts in zip(self._fields, self._typespec): | |
if ts and not isinstance(getattr(self, field), ts): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_node(instance) | |
query_node = Chef::Search::Query.new | |
query = "name:#{instance}" | |
if block_given? | |
query_node.search('node', query) do |node| | |
yield node | |
end | |
else | |
query_node.search('node', query).first.first | |
end |
NewerOlder