You could also write a program in Python to parse and update lvupdate.data. The ConfigParser
module can parse and update configuration files similar to those of Microsoft Windows. The AIX stanza files are similar enough that some setting some options and overloading a method is all that's necessary to parse and update AIX stanza files. Then its a small matter of using ConfigParser
to parse lvupdate.data, then ensure the "llvupdate" stanza (which ConfigParser
calls a "section") exists with the attribute "llu" set to "yes". Then use ConfigParser
to write out the updated lvupdate.data.
One down side to using this method is that it does not preserve comments. If that's a problem, using Ansible might be a better idea.
I've written a Python package "aixstanzaparser" to parse and update AIX stanza files, like I suggested just above. You can install it in your Python virtual environment with
pip install aixstanzaparser
Here's a small Python program that will read and parse /var/adm/ras/liveupdate/lvupdate.data and update it to include "llu = yes" as above.
import aixstanzaparser
# Create parser instance
config = aixstanzaparser.AIXStanzaParser()
# Read and parse lvupdate.date
config.read("lvupdate.data")
# Update llvupdate.llu to yes
if 'llvupdate' not in config.sections():
config['llvupdate'] = {}
config['llvupdate']['llu'] = "yes"
# write updated lvupdate.data
with open("lvupdate.data", "w") as configfile:
config.write(configfile)
And the resulting file shows our updated "llu = yes":
general:
kext_check =
disks:
nhdisk =
mhdisk =
tohdisk =
tshdisk =
hmc:
lpar_id =
management_console =
user =
llvupdate:
llu = yes