Fix LXC without group error
This commit is contained in:
parent
e8761ab285
commit
08e0e97e12
|
@ -19,7 +19,10 @@ for ctname in ctnames:
|
||||||
ct = lxc.Container(ctname)
|
ct = lxc.Container(ctname)
|
||||||
|
|
||||||
if ct.running:
|
if ct.running:
|
||||||
for group in ct.get_running_config_item('lxc.group').rstrip().split('\n'):
|
groups = ct.get_running_config_item('lxc.group')
|
||||||
|
if not groups:
|
||||||
|
groups = 'ungrouped'
|
||||||
|
for group in groups.rstrip().split('\n'):
|
||||||
if not group in inventory:
|
if not group in inventory:
|
||||||
inventory[group] = {
|
inventory[group] = {
|
||||||
'hosts': [],
|
'hosts': [],
|
||||||
|
|
|
@ -19,7 +19,10 @@ for ctname in ctnames:
|
||||||
ct = lxc.Container(ctname)
|
ct = lxc.Container(ctname)
|
||||||
|
|
||||||
if ct.running:
|
if ct.running:
|
||||||
for group in ct.get_running_config_item('lxc.group').rstrip().split('\n'):
|
groups = ct.get_running_config_item('lxc.group')
|
||||||
|
if not groups:
|
||||||
|
groups = 'ungrouped'
|
||||||
|
for group in groups.rstrip().split('\n'):
|
||||||
if not group in inventory:
|
if not group in inventory:
|
||||||
inventory[group] = {
|
inventory[group] = {
|
||||||
'hosts': [],
|
'hosts': [],
|
||||||
|
|
Loading…
Reference in a new issue