Help using telnetlib to install/remove rpms
Rebecca Hepper
Rebecca.R.Hepper at seagate.com
Thu Aug 2 15:02:07 EDT 2001
Hello All,
I recently began looking at trying to use telnetlib to remove an old
rpm and install a new rpm. I can manually telnet to the machine and
install/remove rpms but I can't get my python code to work. The login
works OK but the erasing and installing of the rpms does not work. I
have pasted my code below. Can you see something that I have done
wrong?
Also, do you have any ideas on how I can do an "rpm -q myrpm" and get
the exact version number so I know what to erase?
Thank you.
max_wait = 30
tn=Telnet(ipAddress)
tn.read_until("login: ", max_wait)
tn.write("username\n")
tn.read_until("Password: ", max_wait)
tn.write("password\n")
# change to superuser, can't install rpm as normal user
tn.write("su\n")
tn.read_until("Password: ", max_wait)
tn.write("password\n")
tn.write("rpm -e myrpm-7.00-1\n")
tn.write("rpm -i myrpm-7.01-1.i386.rpm\n")
tn.write("exit\n")
More information about the Python-list
mailing list