Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the ability for the haproxy plugin to use the haproxy

web status page in addition to ssh.

Also added a get_setting option to hostlists to allow it and
it's plugins to get their settings.
  • Loading branch information...
commit 8ea94372f61227f527ee6340cdf0051480dcf9d8 1 parent d581b11
@dwighthubbard dwighthubbard authored
Showing with 17 additions and 14 deletions.
  1. +17 −0 hostlists/hostlists.py
  2. +0 −14 hostlists_plugins/file.py
View
17 hostlists/hostlists.py
@@ -31,11 +31,17 @@
import optparse
import site
import imp
+import json
# Global plugin cache so we don't constantly reload the plugin modules
global_plugins={}
+
+# A list of operators we use for set options
SET_OPERATORS=['-']
+# Config file
+CONF_FILE=os.path.expanduser('~/.hostlists.conf')
+
def _get_plugins():
""" Find all the hostlists plugins """
plugins=global_plugins
@@ -64,6 +70,17 @@ def _get_plugins():
pass
return plugins
+def get_setting(key):
+ try:
+ settings=json.load(open(CONF_FILE,'r'))
+ except IOError:
+ # Couldn't open the settings file
+ #print 'No such conf file'
+ return None
+ if key in settings.keys():
+ return settings[key]
+ return None
+
def expand(range_list,onepass=False):
"""
Expand a list of lists and set operators into a final host lists
View
14 hostlists_plugins/file.py
@@ -1,20 +1,6 @@
#!/usr/bin/env python
""" hostlists plugin to get hosts from a file """
-"""
- Copyright (c) 2012 Yahoo! Inc. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. See accompanying LICENSE file.
-"""
def name():
return ['file']
Please sign in to comment.
Something went wrong with that request. Please try again.