On Sun, 2010-08-08 at 02:47 -0400, "S.Çağlar Onur" wrote:
> Hi,
>
> return tmp_hosts,tmp_certs
> @@ -460,7 +474,8 @@ class Overlord(object):
>
> self.delegate = delegate
> self.mapfile = mapfile
> -
> + self.minionmap = {}
> +
> #overlord_query stuff
> self.overlord_query = OverlordQuery()
> if self.config.puppet_minions:
> @@ -468,11 +483,6 @@ class Overlord(object):
> else:
> self._mc = Minions
>
> - self.minions_class = self._mc(self.server_spec,
> port=self.port,
> - noglobs=self.noglobs,
> verbose=self.verbose,
> - exclude_spec=self.exclude_spec)
> - self.minions = self.minions_class.get_urls()
> -
> if len(self.minions) == 0:
> raise Func_Client_Exception, 'Can\'t find any minions
> matching \"%s\". ' % self.server_spec
>
>
If you remove the minions attribute creation there - how does the above
section of code not ALWAYS fail or at least traceout?
> @@ -483,7 +493,13 @@ class Overlord(object):
> except e:
> sys.stderr.write("mapfile load failed, switching
> delegation off")
> self.delegate = False
> -
> +
> + self.minions_class = self._mc(self.server_spec,
> port=self.port,
> + noglobs=self.noglobs,
> verbose=self.verbose,
> +
> delegate=self.delegate,minionmap=self.minionmap,
> + exclude_spec=self.exclude_spec)
> + self.minions = self.minions_class.get_urls()
> +
> if init_ssl:
> self.setup_ssl()
>
> @@ -730,7 +746,8 @@ class Overlord(object):
> #Next, we run everything that can be run directly beneath
> this overlord
> #Why do we do this after delegation calls? Imagine what
> happens when
> #reboot is called...
> - directhash.update(self.run_direct(module,method,args,nforks))
> + if single_paths != []
> +
> directhash.update(self.run_direct(module,method,args,nforks))
>
> #poll async results if we've async turned on
> if self.async:
> diff --git a/func/overlord/delegation_tools.py
> b/func/overlord/delegation_tools.py
> index 0f3b43e..85de837 100644
> --- a/func/overlord/delegation_tools.py
> +++ b/func/overlord/delegation_tools.py
> @@ -15,6 +15,7 @@
> ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> ##
>
> +from func import utils as func_utils
> import fnmatch
>
> class groupby(object):
> @@ -60,17 +61,19 @@ def group_paths(ungrouped_list):
>
> return (single_paths,path_group)
>
> -def get_paths_for_glob(glob, minionmap):
> +def get_paths_for_glob(glob_list, minionmap):
> """
> Given a glob, returns shortest path to all minions
> matching it in the delegation dictionary tree
> """
>
> pathlist = []
> - for elem in match_glob_in_tree(glob,minionmap):
> - result = get_shortest_path(elem,minionmap)
> - if result not in pathlist: #prevents duplicates
> - pathlist.append(result)
> + for glob in glob_list,split(";"):
> + glob = func_utils.extend_hostname_to_fqdn(glob)[0]
> + for elem in match_glob_in_tree(glob,minionmap):
> + result = get_shortest_path(elem,minionmap)
> + if result not in pathlist: #prevents duplicates
> + pathlist.append(result)
> return pathlist
>
> def list_all_minions(minionmap):
> diff --git a/func/utils.py b/func/utils.py
> index 632d727..7658ede 100644
> --- a/func/utils.py
> +++ b/func/utils.py
> @@ -141,6 +141,13 @@ def get_hostname_by_route():
> # an ip address
> return socket.gethostbyname(socket.gethostname())
>
> +def extend_hostname_to_fqdn(hostname):
> + try:
> + (fqdn, aliases, ips) = socket.gethostbyname_ex(hostname)
> + except socket.gaierror, e:
> + return (hostname, [])
> + else:
> + return (fqdn, aliases)
>
> def get_fresh_method_instance(function_ref):
> """
Not sure I'm in love with how extend_hostname_to_fqdn() works - the
trick is to assume that whatever we're handed is _something_ valid - and
also to not assume that what is NOW the fqdn was always the fqdn.
-sv
_______________________________________________
Func-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/func-list