| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 """ | 2 """ |
| 3 Simple script to setup unattended installs on KVM guests. | 3 Simple script to setup unattended installs on KVM guests. |
| 4 """ | 4 """ |
| 5 # -*- coding: utf-8 -*- | 5 # -*- coding: utf-8 -*- |
| 6 import os, sys, shutil, tempfile, re, ConfigParser, glob, inspect | 6 import os, sys, shutil, tempfile, re, ConfigParser, glob, inspect |
| 7 import common | 7 import common |
| 8 | 8 |
| 9 | 9 |
| 10 SCRIPT_DIR = os.path.dirname(sys.modules[__name__].__file__) | 10 SCRIPT_DIR = os.path.dirname(sys.modules[__name__].__file__) |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 for va in v_attributes: | 269 for va in v_attributes: |
| 270 self._setattr(va) | 270 self._setattr(va) |
| 271 | 271 |
| 272 # Silly attribution just to calm pylint down... | 272 # Silly attribution just to calm pylint down... |
| 273 self.tftp = self.tftp | 273 self.tftp = self.tftp |
| 274 if self.tftp: | 274 if self.tftp: |
| 275 self.tftp = os.path.join(KVM_TEST_DIR, self.tftp) | 275 self.tftp = os.path.join(KVM_TEST_DIR, self.tftp) |
| 276 if not os.path.isdir(self.tftp): | 276 if not os.path.isdir(self.tftp): |
| 277 os.makedirs(self.tftp) | 277 os.makedirs(self.tftp) |
| 278 | 278 |
| 279 self.cdrom_cd1 = os.path.join(KVM_TEST_DIR, self.cdrom_cd1) | 279 if self.cdrom_cd1: |
| 280 self.cdrom_cd1 = os.path.join(KVM_TEST_DIR, self.cdrom_cd1) |
| 280 self.cdrom_cd1_mount = tempfile.mkdtemp(prefix='cdrom_cd1_', dir='/tmp') | 281 self.cdrom_cd1_mount = tempfile.mkdtemp(prefix='cdrom_cd1_', dir='/tmp') |
| 281 if self.medium == 'nfs': | 282 if self.medium == 'nfs': |
| 282 self.nfs_mount = tempfile.mkdtemp(prefix='nfs_', dir='/tmp') | 283 self.nfs_mount = tempfile.mkdtemp(prefix='nfs_', dir='/tmp') |
| 283 | 284 |
| 284 self.floppy = os.path.join(KVM_TEST_DIR, self.floppy) | 285 if self.floppy: |
| 285 if not os.path.isdir(os.path.dirname(self.floppy)): | 286 self.floppy = os.path.join(KVM_TEST_DIR, self.floppy) |
| 286 os.makedirs(os.path.dirname(self.floppy)) | 287 if not os.path.isdir(os.path.dirname(self.floppy)): |
| 288 os.makedirs(os.path.dirname(self.floppy)) |
| 287 | 289 |
| 288 self.image_path = KVM_TEST_DIR | 290 self.image_path = KVM_TEST_DIR |
| 289 self.kernel_path = os.path.join(self.image_path, self.kernel) | 291 self.kernel_path = os.path.join(self.image_path, self.kernel) |
| 290 self.initrd_path = os.path.join(self.image_path, self.initrd) | 292 self.initrd_path = os.path.join(self.image_path, self.initrd) |
| 291 | 293 |
| 292 | 294 |
| 293 def _setattr(self, key): | 295 def _setattr(self, key): |
| 294 """ | 296 """ |
| 295 Populate class attributes with contents of environment variables. | 297 Populate class attributes with contents of environment variables. |
| 296 | 298 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 self.setup_nfs() | 580 self.setup_nfs() |
| 579 else: | 581 else: |
| 580 raise SetupError("Unexpected installation method %s" % | 582 raise SetupError("Unexpected installation method %s" % |
| 581 self.medium) | 583 self.medium) |
| 582 print "Unattended install setup finished successfuly" | 584 print "Unattended install setup finished successfuly" |
| 583 | 585 |
| 584 | 586 |
| 585 if __name__ == "__main__": | 587 if __name__ == "__main__": |
| 586 os_install = UnattendedInstall() | 588 os_install = UnattendedInstall() |
| 587 os_install.setup() | 589 os_install.setup() |
| OLD | NEW |