added parameters for fuel: username, password; moved: fuelip -> fuel_ip

This commit is contained in:
adobdin 2016-06-01 15:45:19 +00:00
parent 9edf36de41
commit 54c2264722
6 changed files with 25 additions and 10 deletions

View File

@ -8,7 +8,9 @@ ssh_opts:
env_vars:
- 'OPENRC=/root/openrc'
- 'IPTABLES_STR="iptables -nvL"'
fuelip: '127.0.0.1'
# fuel_ip: '127.0.0.1'
# fuel_user: 'admin'
# fuel_pass: 'admin'
rqdir: './rq'
rqfile: './rq.yaml'
soft_filter:

View File

@ -12,7 +12,7 @@ Here is the description of available parameters in configuration file:
* **opts** parameters to send to ssh command directly (recommended to leave at default)
* **vars** environment variables to set for SSH
* **fuelip** the IP address of the master node in the environment
* **fuel_ip** the IP address of the master node in the environment
* **rqdir** the path of *rqdir*, the directory containing info about commands to execute and logs to gather
* **out-dir** directory to store output data
* **timeout** timeout for SSH commands in seconds

View File

@ -83,6 +83,9 @@ def parse_args():
help=('Collect logs from nodes. Logs are not collected'
' by default due to their size.'),
action='store_true', dest='getlogs')
parser.add_argument('--fuel-ip', help='fuel ip address')
parser.add_argument('--fuel-user', help='fuel username')
parser.add_argument('--fuel-pass', help='fuel password')
parser.add_argument('--only-logs',
action='store_true',
help=('Only collect logs, do not run commands or'
@ -155,6 +158,12 @@ def main(argv=None):
level=loglevel,
format='%(asctime)s %(levelname)s %(message)s')
conf = load_conf(args.config)
if args.fuel_ip:
conf['fuel_ip'] = args.fuel_ip
if args.fuel_user:
conf['fuel_user'] = args.fuel_user
if args.fuel_pass:
conf['fuel_pass'] = args.fuel_pass
if args.put or args.command or args.script or args.get:
conf['shell_mode'] = True
if args.no_clean:

View File

@ -12,7 +12,9 @@ def load_conf(filename):
'-oUserKnownHostsFile=/dev/null', '-oLogLevel=error',
'-lroot', '-oBatchMode=yes']
conf['env_vars'] = ['OPENRC=/root/openrc', 'IPTABLES_STR="iptables -nvL"']
conf['fuelip'] = '127.0.0.1'
conf['fuel_ip'] = '127.0.0.1'
conf['fuel_user'] = 'admin'
conf['fuel_pass'] = 'admin'
conf['timeout'] = 15
conf['prefix'] = 'nice -n 19 ionice -c 3'
rqdir = 'rq'

View File

@ -1,5 +1,5 @@
project_name = 'timmy'
version = '1.2.0'
version = '1.3.0'
if __name__ == '__main__':
exit(0)

View File

@ -453,8 +453,8 @@ class NodeManager(object):
r_sub(attr, src, attr, d, p, once_p, dst)
def fuel_init(self):
if not self.conf['fuelip']:
logging.error('NodeManager fuel_init: fuelip not set')
if not self.conf['fuel_ip']:
logging.error('NodeManager fuel_init: fuel_ip not set')
sys.exit(7)
fuelnode = Node(id=0,
cluster=0,
@ -463,16 +463,18 @@ class NodeManager(object):
roles=['fuel'],
status='ready',
online=True,
ip=self.conf['fuelip'],
ip=self.conf['fuel_ip'],
conf=self.conf)
# soft-skip Fuel if it is hard-filtered
if not self.filter(fuelnode, self.conf['hard_filter']):
fuelnode.filtered_out = True
self.nodes[self.conf['fuelip']] = fuelnode
self.nodes[self.conf['fuel_ip']] = fuelnode
def get_nodes_json(self):
fuelnode = self.nodes[self.conf['fuelip']]
fuel_node_cmd = 'fuel node list --json'
fuelnode = self.nodes[self.conf['fuel_ip']]
fuel_node_cmd = ('fuel node list --json --user %s --password %s' %
(self.conf['fuel_user'],
self.conf['fuel_pass']))
nodes_json, err, code = tools.ssh_node(ip=fuelnode.ip,
command=fuel_node_cmd,
ssh_opts=fuelnode.ssh_opts,