author | Jon Tibble <meths@btinternet.com> |
Tue, 26 Jun 2012 14:11:05 +0100 | |
branch | oi_151a |
changeset 1447 | f7571d01f887 |
parent 1433 | 8c642698bcb5 |
permissions | -rw-r--r-- |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1 |
#!/usr/bin/python2.6 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2 |
# |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
4 |
# |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
8 |
# |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
13 |
# |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
19 |
# |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
21 |
# |
817
8abc87bee984
15571 long volume IDs break x86 ISO image builds if customized grub menu is long
Alexander Eremin <eremin@milax.org>
parents:
793
diff
changeset
|
22 |
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
23 |
# |
350
cbcc5f485007
4673 Grub text only mode is required
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
338
diff
changeset
|
24 |
'''Install Completion Tasks (ICT) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
25 |
|
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
26 |
Each ICT is implemented as a method of class ict. |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
27 |
|
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
28 |
Guide to calling ICTs |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
29 |
|
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
30 |
The most efficient way to invoke ICTs is to create an ict class instance, |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
31 |
then to invoke the ICT methods of the ict class: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
32 |
- create an ict class instance, providing at least root target directory |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
33 |
- call ICT as a method of the class instance just created |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
34 |
- returned status is a tuple of exit status code and any other return |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
35 |
information |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
36 |
- logging is done by ICT, but you can return exit status to caller |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
37 |
- logging service options are inherited from the environment |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
38 |
- logging level can be set (second parameter) and overridden in environment |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
39 |
LS_DBG_LVL=(1-4) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
40 |
- do not abort if an ICT fails (unless it is an untenable situation) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
41 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
42 |
ICTs can also be invoked singly through a command line using function |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
43 |
exec_ict(): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
44 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
45 |
python ict.py <ICT method> <target directory> [<ICT-specific parameter>] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
46 |
Example command line: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
47 |
python ict.py ict_test /a #runs test ICT |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
48 |
|
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
49 |
Guide to writing ICTs |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
50 |
|
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
51 |
- Locate ict class (line starts with "def ict") |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
52 |
- Within the ict class, find "end Install Completion Tasks" |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
53 |
- Add new ICT as method just before that |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
54 |
- ICTs are methods of the ict class |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
55 |
- ICTs have 'self' as 1st parameter - add other parameters as desired |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
56 |
- Create error return code(s) |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
57 |
- ICTs should return either status code, or a tuple with status code first |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
58 |
- See __init__ method for initialization of class members |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
59 |
- self.basedir is the root directory of the target |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
60 |
- for first line of ICT, use _register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
61 |
as a trace aid |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
62 |
- do not allow unhandled exceptions |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
63 |
- if a critical condition is encountered, log error and sys.exit() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
64 |
with error status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
65 |
- as a last exception handler, instead of raising the exception, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
66 |
log the traceback, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
67 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
68 |
e.g.: |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
69 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
70 |
prerror('Unexpected error doing something.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
71 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
72 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
73 |
- use the module utility routines: |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
74 |
prerror(string) - log error message |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
75 |
_dbg_msg(string) - log output debugging message |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
76 |
info_msg(string) - log informational message |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
77 |
_cmd_out(cmd) - execute shell command, returning only exit status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
78 |
_cmd_status(cmd) - execute shell command, returning exit status and stdout |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
79 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
80 |
- place ICT comments just before or after def statement for module |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
81 |
pydoc to generate documentation |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
82 |
|
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
83 |
Skeleton ICT: |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
84 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
85 |
from osol_install.ict import * |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
86 |
icto = ict('/a') |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
87 |
status = icto.<some ICT (class method)>(<parameters depend on ICT>) |
350
cbcc5f485007
4673 Grub text only mode is required
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
338
diff
changeset
|
88 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
89 |
ICT initial project tasks from Transfer Module (TM): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
90 |
Setting default keyboard layout TM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
91 |
Creating initial SMF repository TM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
92 |
Creating /etc/mnttab TM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
93 |
Cleanup unnecessary symbolic links and files from the alternate root. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
94 |
(clobber files) TM |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
95 |
''' |
728
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
96 |
import errno |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
97 |
import os |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
98 |
import os.path |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
99 |
import sys |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
100 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
101 |
from stat import S_IREAD, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
102 |
S_IWRITE, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
103 |
S_IEXEC, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
104 |
S_IRUSR, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
105 |
S_IWUSR, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
106 |
S_IRGRP, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
107 |
S_IXGRP, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
108 |
S_IROTH, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
109 |
S_IXOTH, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
110 |
S_ISLNK |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
111 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
112 |
import fcntl |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
113 |
import array |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
114 |
import struct |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
115 |
import shutil |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
116 |
import tempfile |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
117 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
118 |
import inspect |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
119 |
import filecmp |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
120 |
import traceback |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
121 |
import re |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
122 |
import platform |
416
caa677cf235d
3914 mkmenu wastes time scanning an entire partition when the first block will do
William Schumann <william.schumann@sun.com>
parents:
412
diff
changeset
|
123 |
import signal |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
124 |
import commands |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
125 |
|
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
126 |
from pkg.cfgfiles import PasswordFile, UserattrFile |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
127 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
128 |
from osol_install.liblogsvc import LS_DBGLVL_ERR, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
129 |
LS_DBGLVL_INFO, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
130 |
init_log, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
131 |
write_dbg, \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
132 |
write_log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
133 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
134 |
ICTID = 'ICT' |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
135 |
( |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
136 |
ICT_INVALID_PARAMETER, |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
137 |
ICT_INVALID_PLATFORM, |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
138 |
ICT_NOT_MULTIBOOT, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
139 |
ICT_ADD_FAILSAFE_MENU_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
140 |
ICT_KIOCLAYOUT_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
141 |
ICT_OPEN_KEYBOARD_DEVICE_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
142 |
ICT_KBD_LAYOUT_NAME_NOT_FOUND, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
143 |
ICT_UPDATE_BOOTPROP_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
144 |
ICT_MKMENU_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
145 |
ICT_SPLASH_IMAGE_FAILURE, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
146 |
ICT_REMOVE_LIVECD_COREADM_CONF_FAILURE, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
147 |
ICT_SET_BOOT_ACTIVE_TEMP_FILE_FAILURE, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
148 |
ICT_FDISK_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
149 |
ICT_UPDATE_DUMPADM_NODENAME_FAILED, |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
150 |
ICT_CONFIGURE_NWAM_FAILED, |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
151 |
ICT_ENABLE_NWAM_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
152 |
ICT_FIX_FAILSAFE_MENU_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
153 |
ICT_CREATE_SMF_REPO_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
154 |
ICT_CREATE_MNTTAB_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
155 |
ICT_PACKAGE_REMOVAL_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
156 |
ICT_DELETE_BOOT_PROPERTY_FAILURE, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
157 |
ICT_GET_ROOTDEV_LIST_FAILED, |
272
6ffbbcf6242a
3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
247
diff
changeset
|
158 |
ICT_SETUP_DEV_NAMESPACE_FAILED, |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
159 |
ICT_UPDATE_ARCHIVE_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
160 |
ICT_COPY_SPLASH_XPM_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
161 |
ICT_SMF_CORRECT_SYS_PROFILE_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
162 |
ICT_REMOVE_BOOTPATH_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
163 |
ICT_ADD_SPLASH_IMAGE_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
164 |
ICT_SYSIDTOOL_ENTRIES_FAILED, |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
165 |
ICT_SYSIDTOOL_CP_STATE_FAILED, |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
166 |
ICT_SET_FLUSH_CONTENT_CACHE_ON_SUCCESS_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
167 |
ICT_FIX_GRUB_ENTRY_FAILED, |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
168 |
ICT_CREATE_SPARC_BOOT_MENU_FAILED, |
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
169 |
ICT_COPY_SPARC_BOOTLST_FAILED, |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
170 |
ICT_CLOBBER_FILE_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
171 |
ICT_CLEANUP_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
172 |
ICT_REBUILD_PKG_INDEX_FAILED, |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
173 |
ICT_PKG_RESET_UUID_FAILED, |
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
174 |
ICT_PKG_SEND_UUID_FAILED, |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
175 |
ICT_SET_SWAP_AS_DUMP_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
176 |
ICT_EXPLICIT_BOOTFS_FAILED, |
324
1c6e18788b0e
3731 initial menu.lst needs update to enable happy face boot
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
321
diff
changeset
|
177 |
ICT_ENABLE_HAPPY_FACE_BOOT_FAILED, |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
178 |
ICT_POPEN_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
179 |
ICT_REMOVE_LIVECD_ENVIRONMENT_FAILED, |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
180 |
ICT_SET_ROOT_PW_FAILED, |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
181 |
ICT_CREATE_NU_FAILED, |
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
182 |
ICT_OPEN_PROM_DEVICE_FAILED, |
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
183 |
ICT_IOCTL_PROM_FAILED, |
658
831357e2155d
6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents:
649
diff
changeset
|
184 |
ICT_SET_PART_ACTIVE_FAILED, |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
185 |
ICT_SVCCFG_FAILURE, |
760
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
186 |
ICT_SET_AUTOHOME_FAILED, |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
187 |
ICT_COPY_CAPABILITY_FAILED, |
852
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
188 |
ICT_APPLY_SYSCONFIG_FAILED, |
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
189 |
ICT_GENERATE_SC_PROFILE_FAILED, |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
190 |
ICT_SETUP_RBAC_FAILED, |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
191 |
ICT_SETUP_SUDO_FAILED |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
192 |
) = range(200,256) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
193 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
194 |
# Global variables |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
195 |
DEBUGLVL = LS_DBGLVL_ERR |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
196 |
CUR_ICT_FRAME = None # frame info for debugging and tracing |
1403
4c3409611c91
imported patch oi-branding-lib-libict-pymod
Alasdair Lumsden <al@everycity.co.uk>
parents:
897
diff
changeset
|
197 |
MENU_LST_DEFAULT_TITLE = "OpenIndiana" |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
198 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
199 |
|
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
200 |
#Module functions - intended for local use, but usable by importers |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
201 |
def _register_task(fm): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
202 |
'''register current ICT for logging, debugging and tracing |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
203 |
By convention, use as 1st executable line in ICT |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
204 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
205 |
global CUR_ICT_FRAME |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
206 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
207 |
CUR_ICT_FRAME = fm |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
208 |
if CUR_ICT_FRAME != None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
209 |
cf = inspect.getframeinfo(CUR_ICT_FRAME) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
210 |
write_log(ICTID, 'current task:' + cf[2] + '\n') |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
211 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
212 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
213 |
def prerror(msg): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
214 |
'''Log an error message to logging service and stderr |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
215 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
216 |
msg1 = msg + "\n" |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
217 |
write_dbg(ICTID, LS_DBGLVL_ERR, msg1) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
218 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
219 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
220 |
def _move_in_updated_config_file(new, orig): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
221 |
'''move in new version of file to original file location, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
222 |
overwriting original |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
223 |
side effect: deletes temporary file upon failure |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
224 |
''' |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
225 |
# if files are identical |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
226 |
if os.path.exists(new) and os.path.exists(orig) and filecmp.cmp(new, orig): |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
227 |
_delete_temporary_file(new) |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
228 |
return True |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
229 |
try: |
691
efcc9630d2b7
6103 ICT - may not be setting file permission correctly on some files
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
669
diff
changeset
|
230 |
shutil.copyfile(new, orig) |
efcc9630d2b7
6103 ICT - may not be setting file permission correctly on some files
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
669
diff
changeset
|
231 |
os.remove(new) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
232 |
except IOError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
233 |
prerror('IO error - cannot move file ' + new + ' to ' + orig) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
234 |
prerror(traceback.format_exc()) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
235 |
_delete_temporary_file(new) |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
236 |
return False |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
237 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
238 |
prerror('Unrecognized error - failure to move file ' + new + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
239 |
' to ' + orig) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
240 |
prerror(traceback.format_exc()) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
241 |
_delete_temporary_file(new) |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
242 |
return False |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
243 |
return True |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
244 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
245 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
246 |
def _cmd_out(cmd): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
247 |
'''execute a shell command and return output |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
248 |
cmd - command to execute |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
249 |
returns tuple: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
250 |
status = command exit status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
251 |
dfout = array of lines output to stdout, stderr by command |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
252 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
253 |
_dbg_msg('_cmd_out: executing cmd=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
254 |
status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
255 |
dfout = [] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
256 |
'''Since Python ignores SIGPIPE, according to Python issue 1652, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
257 |
UNIX scripts in subprocesses will also ignore SIGPIPE. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
258 |
Workaround is to save original signal handler, restore default handler, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
259 |
launch script, restore original signal handler |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
260 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
261 |
#save SIGPIPE signal handler |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
262 |
orig_sigpipe = signal.getsignal(signal.SIGPIPE) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
263 |
#restore default signal handler for SIGPIPE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
264 |
signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
265 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
266 |
fp = os.popen(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
267 |
if fp == None or fp == -1: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
268 |
return ICT_POPEN_FAILED, [] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
269 |
for rline in fp: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
270 |
if rline and rline.endswith('\n'): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
271 |
rline = rline[:-1] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
272 |
dfout.append(rline) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
273 |
_dbg_msg('_cmd_out: stdout/stderr line=' + rline) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
274 |
status = fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
275 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
276 |
prerror('system error in launching shell cmd (' + cmd + ')') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
277 |
status = 1 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
278 |
#restore original signal handler for SIGPIPE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
279 |
signal.signal(signal.SIGPIPE, orig_sigpipe) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
280 |
if status == None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
281 |
status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
282 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
283 |
write_log(ICTID, 'shell cmd (' + cmd + ') returned status ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
284 |
str(status) + "\n") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
285 |
if DEBUGLVL >= LS_DBGLVL_INFO: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
286 |
print ICTID + ': _cmd_out status =', status, 'stdout/stderr=', dfout |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
287 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
288 |
return status, dfout |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
289 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
290 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
291 |
def _cmd_status(cmd): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
292 |
'''execute a shell command using popen and return its exit status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
293 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
294 |
_dbg_msg('_cmd_status: executing cmd=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
295 |
exitstatus = None |
416
caa677cf235d
3914 mkmenu wastes time scanning an entire partition when the first block will do
William Schumann <william.schumann@sun.com>
parents:
412
diff
changeset
|
296 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
297 |
'''Since Python ignores SIGPIPE, according to Python issue 1652, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
298 |
UNIX scripts in subprocesses will also ignore SIGPIPE. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
299 |
Workaround is to save original signal handler, restore default handler, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
300 |
launch script, restore original signal handler |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
301 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
302 |
#save SIGPIPE signal handler |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
303 |
orig_sigpipe = signal.getsignal(signal.SIGPIPE) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
304 |
#restore default signal handler for SIGPIPE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
305 |
signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
306 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
307 |
fp = os.popen(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
308 |
if fp == None or fp == -1: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
309 |
return ICT_POPEN_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
310 |
exitstatus = fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
311 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
312 |
prerror('unknown error in launching shell cmd (' + cmd + ')') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
313 |
prerror('Traceback:') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
314 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
315 |
exitstatus = 1 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
316 |
if exitstatus == None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
317 |
exitstatus = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
318 |
# restore original signal handler for SIGPIPE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
319 |
signal.signal(signal.SIGPIPE, orig_sigpipe) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
320 |
_dbg_msg('_cmd_status: return exitstatus=' + str(exitstatus)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
321 |
return exitstatus |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
322 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
323 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
324 |
def info_msg(msg): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
325 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
326 |
send an informational message to logging service |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
327 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
328 |
write_log(ICTID, msg + '\n') |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
329 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
330 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
331 |
#send informational debugging message to logging service, according to level |
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
332 |
def _dbg_msg(msg): |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
333 |
'''send informational debugging message to logging service, |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
334 |
according to level |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
335 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
336 |
if (DEBUGLVL >= LS_DBGLVL_INFO): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
337 |
write_dbg(ICTID, LS_DBGLVL_INFO, msg + '\n') |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
338 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
339 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
340 |
def _delete_temporary_file(filename): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
341 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
342 |
delete temporary file - suppress traceback on error |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
343 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
344 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
345 |
os.unlink(filename) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
346 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
347 |
pass # ignore failure to delete temp file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
348 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
349 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
350 |
class ICT(object): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
351 |
'''main class to support ICT |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
352 |
ICT object must first be created and initialized |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
353 |
basedir - root directory (only required parameter) |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
354 |
debuglvl - debugging message level for liblogsvc |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
355 |
bootenvrc - normal location of bootenv.rc |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
356 |
autohome - normal location of autohome map |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
357 |
loc_grubmenu - normal location of GRUB menu |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
358 |
ai_sc_profile - SC profile generated by Automated Installer |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
359 |
target_sc_profile = target SC profile |
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
360 |
sudoers - normal location of sudo configuration file |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
361 |
|
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
362 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
363 |
class initializer will exit with error status if: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
364 |
- basedir is missing or empty |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
365 |
- basedir is '/', in order to protect against accidental usage. |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
366 |
For a live system this should be permitted. |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
367 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
368 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
369 |
def __init__(self, basedir, |
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
370 |
debuglvl=-1, |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
371 |
bootenvrc='/boot/solaris/bootenv.rc', |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
372 |
autohome='/etc/auto_home', |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
373 |
loc_grubmenu='/boot/grub/menu.lst', |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
374 |
ai_sc_profile='/tmp/sc_manifest.xml', |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
375 |
target_sc_profile='sc_profile.xml', |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
376 |
sudoers='/etc/sudoers'): |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
377 |
|
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
378 |
# determine whether we are doing AI install or slim install |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
379 |
self.livecd_install = False |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
380 |
self.auto_install = False |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
381 |
self.text_install = False |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
382 |
if os.access("/.livecd", os.R_OK): |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
383 |
_dbg_msg('Determined to be doing Live CD install') |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
384 |
self.livecd_install = True |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
385 |
elif os.access("/.autoinstall", os.R_OK): |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
386 |
_dbg_msg('Determined to be doing Automated Install') |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
387 |
self.auto_install = True |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
388 |
elif os.access("/.textinstall", os.R_OK): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
389 |
_dbg_msg("Determined to be doing Text Install") |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
390 |
self.text_install = True |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
391 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
392 |
if basedir == '': |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
393 |
err_str = 'Base directory must be passed' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
394 |
prerror(err_str) |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
395 |
raise ValueError(err_str) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
396 |
if basedir == '/': |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
397 |
''' |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
398 |
The code can be run on a live system but if we're not |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
399 |
on a live system we should not support / for BASEDIR. |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
400 |
''' |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
401 |
if self.livecd_install or self.auto_install or self.text_install: |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
402 |
err_str = 'Base directory cannot be root ' + \ |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
403 |
'("/") during install' |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
404 |
prerror(err_str) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
405 |
raise ValueError(err_str) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
406 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
407 |
self.basedir = basedir |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
408 |
''' |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
409 |
If we're running outside of an install we should not use |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
410 |
the basedir here since that could be the mountpoint of a |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
411 |
pool that we're creating the menu.lst file on. |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
412 |
''' |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
413 |
if self.livecd_install or self.auto_install or self.text_install: |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
414 |
self.prependdir = basedir |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
415 |
else: |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
416 |
self.prependdir = "" |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
417 |
|
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
418 |
self.bootenvrc = self.prependdir + bootenvrc |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
419 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
420 |
#Is the current platform a SPARC system? |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
421 |
self.is_sparc = (platform.platform().find('sparc') >= 0) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
422 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
423 |
global DEBUGLVL |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
424 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
425 |
DEBUGLVL = int(os.getenv('LS_DBG_LVL', -1)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
426 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
427 |
prerror('Could not parse enviroment variable LS_DBG_LVL to ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
428 |
'integer') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
429 |
DEBUGLVL = -1 |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
430 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
431 |
if DEBUGLVL == -1: |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
432 |
DEBUGLVL = debuglvl |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
433 |
if DEBUGLVL == -1: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
434 |
DEBUGLVL = LS_DBGLVL_ERR #default logging |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
435 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
436 |
if DEBUGLVL != LS_DBGLVL_ERR and \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
437 |
init_log(DEBUGLVL) != 1: #set in logging service |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
438 |
prerror('Setting logging service debug level to ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
439 |
str(DEBUGLVL) + ' failed.') |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
440 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
441 |
self.kbd_device = '/dev/kbd' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
442 |
self.kbd_layout_file = '/usr/share/lib/keytables/type_6/kbd_layouts' |
852
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
443 |
self.keyboard_layout = '' |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
444 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
445 |
# determine whether we are installing to an iSCSI boot target |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
446 |
self.iscsi_boot_install = False |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
447 |
if os.access("/.iscsi_boot", os.R_OK): |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
448 |
_dbg_msg('Determined to be doing iSCSI boot install') |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
449 |
self.iscsi_boot_install = True |
658
831357e2155d
6590 Need support for iSCSI boot installations in Caiman
William Schumann <william.schumann@sun.com>
parents:
649
diff
changeset
|
450 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
451 |
#take root poolname from mnttab |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
452 |
# Note there are TABs in the blow expression. |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
453 |
# cmd = 'grep "^[^<TAB>]*<TAB>' + basedir +<TAB>' " /etc/mnttab | ' + \ |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
454 |
cmd = 'grep "^[^ ]* ' + basedir + ' " /etc/mnttab | ' + \ |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
455 |
' nawk \'{print $1}\' | sed \'s,/.*,,\'' |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
456 |
sts, rpa = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
457 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
458 |
if len(rpa) == 0: |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
459 |
prerror('Cannot determine root pool name. exit status=' + |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
460 |
str(sts) + ' command=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
461 |
sys.exit(ICT_GET_ROOTDEV_LIST_FAILED) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
462 |
self.rootpool = rpa[0] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
463 |
_dbg_msg('Root pool name discovered: ' + self.rootpool) |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
514
diff
changeset
|
464 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
465 |
if self.livecd_install or self.auto_install or self.text_install: |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
466 |
#With the root pool pre-pended to /boot/grub/menu.lst |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
467 |
self.grubmenu = '/' + self.rootpool + loc_grubmenu |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
468 |
self.bootmenu_path_sparc = '/' + self.rootpool + '/boot' |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
469 |
else: |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
470 |
#With the basedir pre-pended to /boot/grub/menu.lst |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
471 |
self.grubmenu = basedir + loc_grubmenu |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
472 |
#With the basedir pre-pended for the SPARC boot menu |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
473 |
self.bootmenu_path_sparc = basedir + '/boot' |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
474 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
475 |
#/boot/menu.lst |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
476 |
self.bootmenu_sparc = self.bootmenu_path_sparc + '/menu.lst' |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
477 |
|
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
478 |
self.autohome = basedir + autohome |
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
479 |
self.sudoers = basedir + sudoers |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
480 |
|
852
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
481 |
# System Configuration template used to assemble System Configuration |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
482 |
# profile |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
483 |
self.sc_template = '/usr/share/install/sc_template.xml' |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
484 |
# path to System Configuration profile generated by Automated Installer |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
485 |
self.ai_sc_profile = ai_sc_profile |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
486 |
# name of target System Configuration profile |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
487 |
self.sc_profile = target_sc_profile |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
488 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
489 |
#support methods |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
490 |
def _get_bootprop(self, property_id): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
491 |
'''support method - get property from bootenv.rc |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
492 |
Parameter: property_id - bootenv.rc property ID |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
493 |
The format of a line in bootenvrc is: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
494 |
# followed by a comment |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
495 |
or |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
496 |
setprop <prop name> <prop value> |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
497 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
498 |
returns property value or '' if not found |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
499 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
500 |
fp = open(self.bootenvrc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
501 |
for rline in fp: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
502 |
# Ignore comment lines |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
503 |
if rline.startswith('#'): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
504 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
505 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
506 |
# Store the property name in field |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
507 |
# and the property value in value. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
508 |
(field, value) = rline.split()[1:3] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
509 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
510 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
511 |
if field == property_id: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
512 |
fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
513 |
return value |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
514 |
fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
515 |
return '' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
516 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
517 |
def _delete_bootprop(self, property_id): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
518 |
'''support method - from bootenv.rc, delete property |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
519 |
Parameter: property_id - bootenv.rc property ID |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
520 |
return 0 for success, otherwise ICT failure status code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
521 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
522 |
new_rc = self.bootenvrc + '.new' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
523 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
524 |
fp = open(self.bootenvrc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
525 |
op = open(new_rc, 'w') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
526 |
for rline in op: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
527 |
if rline.startswith('#'): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
528 |
op.write(rline) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
529 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
530 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
531 |
# Assign to field the token between seperator 1 and 2, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
532 |
# this being the second token. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
533 |
field = rline.split()[1:2] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
534 |
except ValueError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
535 |
op.write(rline) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
536 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
537 |
if field == property_id: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
538 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
539 |
op.write(rline) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
540 |
fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
541 |
op.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
542 |
os.rename(new_rc, self.bootenvrc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
543 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
544 |
prerror('Error in deleting property in ' + self.bootenvrc + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
545 |
': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
546 |
prerror('Failure. Returning: ICT_DELETE_BOOT_PROPERTY_FAILURE') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
547 |
return ICT_DELETE_BOOT_PROPERTY_FAILURE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
548 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
549 |
prerror('Unexpected error when deleting property in ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
550 |
self.bootenvrc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
551 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
552 |
prerror('Failure. Returning: ICT_DELETE_BOOT_PROPERTY_FAILURE') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
553 |
return ICT_DELETE_BOOT_PROPERTY_FAILURE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
554 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
555 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
556 |
def _update_bootprop(self, property_id, newvalue): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
557 |
'''support method - set bootenv.rc property_id to value |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
558 |
Parameters: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
559 |
property_id - bootenv.rc property ID |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
560 |
newvalue - value to assign to property_id |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
561 |
return 0 for success or ICT status code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
562 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
563 |
new_rc = self.bootenvrc + '.new' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
564 |
return_status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
565 |
fp = op = None |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
566 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
567 |
fp = open(self.bootenvrc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
568 |
op = open(new_rc, 'w') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
569 |
#copy all lines that do not contain the property_id |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
570 |
for rline in fp: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
571 |
if rline.startswith('#'): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
572 |
op.write(rline) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
573 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
574 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
575 |
# Assign to field the token between seperator 1 and 2, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
576 |
# this being the second token. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
577 |
field = rline.split()[1:2] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
578 |
except ValueError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
579 |
op.write(rline) #just copy |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
580 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
581 |
if field != property_id: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
582 |
op.write(rline) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
583 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
584 |
#add the line with the updated property_id |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
585 |
op.write('setprop ' + property_id + ' ' + newvalue + '\n') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
586 |
os.rename(new_rc, self.bootenvrc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
587 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
588 |
prerror('Update boot property failed. ' + strerror + ' file=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
589 |
self.bootenvrc + ' property=' + property_id + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
590 |
' value=' + newvalue) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
591 |
prerror('Failure. Returning: ICT_UPDATE_BOOTPROP_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
592 |
return_status = ICT_UPDATE_BOOTPROP_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
593 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
594 |
prerror('Unexpected error when updating boot property. file=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
595 |
self.bootenvrc + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
596 |
' property=' + property_id + ' value=' + newvalue) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
597 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
598 |
prerror('Failure. Returning: ICT_UPDATE_BOOTPROP_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
599 |
return_status = ICT_UPDATE_BOOTPROP_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
600 |
if fp != None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
601 |
fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
602 |
if op != None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
603 |
op.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
604 |
return return_status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
605 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
606 |
@staticmethod |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
607 |
def set_boot_active(raw_slice): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
608 |
'''support method - set boot device as active in fdisk disk formatter |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
609 |
Parameter: raw_slice is a /dev path |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
610 |
launches fdisk -F <format file> /dev/rdsk/cXtXdXpX |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
611 |
on partitions if changes required |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
612 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
613 |
return 0 upon success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
614 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
615 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
616 |
mtch = re.findall('p(\d+):boot$', raw_slice) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
617 |
if mtch and mtch[0]: |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
618 |
p0 = raw_slice.replace('p' + mtch[0] + ':boot', 'p0') |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
619 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
620 |
mtch = re.findall('s(\d+)$', raw_slice) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
621 |
if mtch and mtch[0]: |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
622 |
p0 = raw_slice.replace('s' + mtch[0], 'p0') |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
623 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
624 |
p0 = raw_slice |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
625 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
626 |
# Note there are TABs in the blow expression. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
627 |
# cmd = 'fdisk -W - %s | grep -v \* | grep -v \'^[<TAB> ]*$\'' % (p0) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
628 |
cmd = 'fdisk -W - %s | grep -v \* | grep -v \'^[ ]*$\'' % (p0) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
629 |
status, fdisk = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
630 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
631 |
prerror('fdisk command fails to set ' + raw_slice + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
632 |
' active. exit status=' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
633 |
prerror('command was ' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
634 |
prerror('Failure. Returning: ICT_FDISK_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
635 |
return ICT_FDISK_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
636 |
# make sure there is a Solaris partition before doing anything |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
637 |
has_solaris_systid = has_solaris_2_systid = False |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
638 |
for ln in fdisk: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
639 |
if ln[0] == '*': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
640 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
641 |
cols = ln.split() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
642 |
if len(cols) < 2: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
643 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
644 |
if not has_solaris_systid: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
645 |
has_solaris_systid = (cols[0] == '130') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
646 |
if not has_solaris_2_systid: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
647 |
has_solaris_2_systid = (cols[0] == '191') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
648 |
if not has_solaris_systid and not has_solaris_2_systid: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
649 |
return 0 # no changes |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
650 |
fdiskout = [] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
651 |
made_fdisk_changes = False |
667
808a042e4938
1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents:
658
diff
changeset
|
652 |
dont_change_active = False |
808a042e4938
1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents:
658
diff
changeset
|
653 |
partition_number = 1 |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
654 |
for ln in fdisk: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
655 |
if ln[0] == '*': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
656 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
657 |
cols = ln.split() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
658 |
if len(cols) < 2: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
659 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
660 |
if has_solaris_2_systid: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
661 |
if cols[0] == '191': |
667
808a042e4938
1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents:
658
diff
changeset
|
662 |
#don't change active partiton if installing to logical |
808a042e4938
1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents:
658
diff
changeset
|
663 |
if partition_number > 4: |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
664 |
dont_change_active = True |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
665 |
if cols[1] != '128': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
666 |
cols[1] = '128' #active partition |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
667 |
made_fdisk_changes = True |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
668 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
669 |
if cols[1] != '0': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
670 |
cols[1] = '0' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
671 |
made_fdisk_changes = True |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
672 |
else: #systid Linux swap |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
673 |
if cols[0] == '130': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
674 |
if cols[1] != '128': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
675 |
cols[1] = '128' #active partition |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
676 |
made_fdisk_changes = True |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
677 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
678 |
if cols[1] != '0': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
679 |
cols[1] = '0' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
680 |
made_fdisk_changes = True |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
681 |
lnout = ' ' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
682 |
for lno in cols: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
683 |
lnout += lno.ljust(6) + ' ' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
684 |
lnout += '\n' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
685 |
fdiskout.append(lnout) |
667
808a042e4938
1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents:
658
diff
changeset
|
686 |
partition_number = partition_number + 1 |
808a042e4938
1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents:
658
diff
changeset
|
687 |
if dont_change_active: |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
688 |
_dbg_msg('Install partition is logical partition.' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
689 |
' Active partition not changed.') |
667
808a042e4938
1777 Installer doesn't recognize logical volumes defined within extended partition
William Schumann <william.schumann@sun.com>
parents:
658
diff
changeset
|
690 |
return 0 |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
691 |
if not made_fdisk_changes: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
692 |
_dbg_msg('No disk format changes - fdisk not run') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
693 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
694 |
_dbg_msg('Disk format changes needed - fdisk will be run.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
695 |
#write fdisk format to temporary file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
696 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
697 |
(fop, fdisk_tempfile) = tempfile.mkstemp('.txt', 'fdisk', '/tmp') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
698 |
for ln in fdiskout: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
699 |
os.write(fop, ln) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
700 |
os.close(fop) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
701 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
702 |
prerror('Error in writing to temporary file. ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
703 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
704 |
'ICT_SET_BOOT_ACTIVE_TEMP_FILE_FAILURE') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
705 |
return ICT_SET_BOOT_ACTIVE_TEMP_FILE_FAILURE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
706 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
707 |
prerror('Unexpected error in writing to temporary file. ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
708 |
strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
709 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
710 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
711 |
'ICT_SET_BOOT_ACTIVE_TEMP_FILE_FAILURE') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
712 |
return ICT_SET_BOOT_ACTIVE_TEMP_FILE_FAILURE |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
713 |
cmd = 'fdisk -F %s %s 2>&1' % (fdisk_tempfile, p0) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
714 |
status = _cmd_status(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
715 |
#delete temporary file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
716 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
717 |
os.unlink(fdisk_tempfile) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
718 |
except OSError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
719 |
pass # ignore failure to delete temporary file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
720 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
721 |
prerror('Error executing ' + cmd + '. exit status=' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
722 |
prerror('Failure. Returning: ICT_FDISK_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
723 |
return ICT_FDISK_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
724 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
725 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
726 |
def _get_osconsole(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
727 |
'''support method - determine console device |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
728 |
returns console device found in bootenv.rc, from prtconf command, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
729 |
or default 'text' |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
730 |
|
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
731 |
If osconsole is not set (initial/flash install), we set it here based |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
732 |
on what the current console device is. |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
733 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
734 |
osconsole = self._get_bootprop('output-device') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
735 |
if osconsole != '': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
736 |
return osconsole |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
737 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
738 |
# get console setting from prtconf command - console |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
739 |
cmd = 'prtconf -v /devices | ' + \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
740 |
'sed -n \'/console/{n;p;}\' | cut -f 2 -d \\\'' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
741 |
sts, co = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
742 |
if sts != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
743 |
prerror('Error from command to get console. exit status=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
744 |
str(sts)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
745 |
prerror('Command in error=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
746 |
if len(co) > 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
747 |
osconsole = co[0] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
748 |
if osconsole == '': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
749 |
# get console setting from prtconf command - output-device |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
750 |
cmd = 'prtconf -v /devices | ' + \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
751 |
'sed -n \'/output-device/{n;p;}\' | cut -f 2 -d \\\'' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
752 |
sts, co = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
753 |
if sts != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
754 |
prerror('Error from command to get console. exit status=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
755 |
str(sts)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
756 |
prerror('Command in error=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
757 |
if len(co) > 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
758 |
osconsole = co[0] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
759 |
if osconsole == 'screen': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
760 |
osconsole = 'text' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
761 |
# default console to text |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
762 |
if osconsole == '': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
763 |
osconsole = 'text' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
764 |
return osconsole |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
765 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
766 |
def get_rootdev_list(self, dev_path): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
767 |
'''ICT and support method - get list of disks with zpools |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
768 |
associated with root pool launch zpool iostat -v + rootpool |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
769 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
770 |
dev_path is a Solaris /dev disk directory path |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
771 |
(e.g. /dev/dsk or /dev/rdsk) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
772 |
return tuple: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
773 |
status - 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
774 |
device list - list of device names: <dev_path>/cXtXdXsX, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
775 |
empty list if failure |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
776 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
777 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
778 |
cmd = 'zpool iostat -v ' + self.rootpool |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
779 |
sts, zpool_iostat = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
780 |
if sts != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
781 |
prerror('Error from command to get rootdev list. exit status=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
782 |
str(sts)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
783 |
prerror('Command in error=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
784 |
prerror('Failure. Returning: ICT_GET_ROOTDEV_LIST_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
785 |
return ICT_GET_ROOTDEV_LIST_FAILED, [] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
786 |
i = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
787 |
rootdevlist = [] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
788 |
while i < len(zpool_iostat): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
789 |
p1 = zpool_iostat[i].split() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
790 |
if len(p1) > 1 and p1[0] == self.rootpool: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
791 |
i += 1 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
792 |
while i < len(zpool_iostat): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
793 |
if len(zpool_iostat[i]) > 1 and zpool_iostat[i][0] == ' ': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
794 |
la = zpool_iostat[i].split() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
795 |
if len(la) > 1 and la[0] != 'mirror' and \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
796 |
la[0][0] != '-': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
797 |
rootdevlist.append(dev_path + la[0]) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
798 |
i += 1 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
799 |
i += 1 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
800 |
return 0, rootdevlist |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
801 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
802 |
def _get_kbd_layout_name(self, layout_number): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
803 |
'''support method - given a keyboard layout number return the |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
804 |
layout string. |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
805 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
806 |
parameter layout_number - keyboard layout number from: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
807 |
/usr/share/lib/keytables/type_6/kbd_layouts |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
808 |
We should not be doing this here, but unfortunately there |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
809 |
is no interface in the keyboard API to perform |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
810 |
this mapping for us - RFE.''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
811 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
812 |
fh = open(self.kbd_layout_file, "r") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
813 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
814 |
prerror('keyboard layout file open failure: filename=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
815 |
self.kbd_layout_file) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
816 |
return '' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
817 |
kbd_layout_name = '' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
818 |
for line in fh: #read file until number matches |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
819 |
if line.startswith('#'): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
820 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
821 |
if '=' not in line: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
822 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
823 |
(kbd_layout_name, num) = line.split('=') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
824 |
if int(num) == layout_number: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
825 |
fh.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
826 |
return kbd_layout_name |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
827 |
fh.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
828 |
return '' |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
829 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
830 |
def bootadm_update_menu(self, rdsk): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
831 |
'''ICT and support method - add failsafe menu entry for disk |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
832 |
parameter rdsk - raw disk device name in ctds format: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
833 |
/dev/rdsk/cXtXdXsX |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
834 |
Does bootadm update-menu -R basedir -Z -o <raw disk> |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
835 |
returns 0 if command succeeded, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
836 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
837 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
838 |
cmd = 'bootadm update-menu -R %s -Z -o %s 2>&1' % (self.basedir, rdsk) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
839 |
info_msg('update GRUB boot menu on device ' + rdsk) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
840 |
_dbg_msg('editing GRUB menu: ' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
841 |
status, cmdout = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
842 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
843 |
prerror('Adding failsafe menu with command: %s failed. ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
844 |
' exit status=%d' % (cmd, status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
845 |
for ln in cmdout: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
846 |
prerror('bootadm_update_menu output: ' + ln) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
847 |
prerror('Failure. Returning: ICT_ADD_FAILSAFE_MENU_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
848 |
return ICT_ADD_FAILSAFE_MENU_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
849 |
for ln in cmdout: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
850 |
info_msg('bootadm_update_menu output: ' + ln) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
851 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
852 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
853 |
@staticmethod |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
854 |
def _get_root_dataset(): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
855 |
'''support routine - using beadm list, get the root dataset of |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
856 |
the root pool |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
857 |
return root dataset active on reboot or '' if not found |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
858 |
log error if not found |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
859 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
860 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
861 |
cmd = 'beadm list -aH' |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
862 |
status, belist = _cmd_out(cmd) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
863 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
864 |
prerror('BE list command %s failed. Exit status=%d' % |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
865 |
(cmd, status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
866 |
for msg in belist: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
867 |
prerror(msg) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
868 |
return '' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
869 |
for ln in belist: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
870 |
arg = ln.split(';') #parse datasets |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
871 |
if not arg[2]: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
872 |
continue |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
873 |
if arg[2].find('R') != -1: #check if active on reboot |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
874 |
_dbg_msg('found root dataset %s ' % arg[1]) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
875 |
return arg[1] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
876 |
return '' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
877 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
878 |
#end support routines |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
879 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
880 |
#Install Completion Tasks start here |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
881 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
882 |
def remove_bootpath(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
883 |
'''ICT - no bootpath needed for zfs boot - remove property |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
884 |
from bootenv.rc |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
885 |
blatant hack: _setup_bootblock should be fixed |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
886 |
in the spmisvc library to not put bootpath in bootenv.rc |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
887 |
in the first place for zfs boot |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
888 |
returns 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
889 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
890 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
891 |
#This ICT is not supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
892 |
#If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
893 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
894 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
895 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
896 |
return ICT_INVALID_PLATFORM |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
897 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
898 |
newbootenvrc = self.bootenvrc + '.tmp' |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
899 |
bootpath = self._get_bootprop('bootpath') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
900 |
if bootpath != '': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
901 |
# Note there are TABs in the blow expression. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
902 |
#...'sed \'/^setprop[ <TAB>][ <TAB>]*' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
903 |
#... 'bootpath[ <TAB>]/d\' ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
904 |
status = _cmd_status('sed \'/^setprop[ ][ ]*' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
905 |
'bootpath[ ]/d\' ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
906 |
self.bootenvrc + ' > ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
907 |
self.bootenvrc + '.tmp') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
908 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
909 |
prerror('bootpath not removed from bootenv.rc - ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
910 |
' exit status=' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
911 |
prerror('Failure. Returning: ICT_REMOVE_BOOTPATH_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
912 |
return ICT_REMOVE_BOOTPATH_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
913 |
if not _move_in_updated_config_file(newbootenvrc, self.bootenvrc): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
914 |
prerror('bootpath not removed from bootenv.rc') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
915 |
prerror('Failure. Returning: ICT_REMOVE_BOOTPATH_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
916 |
return ICT_REMOVE_BOOTPATH_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
917 |
_dbg_msg('bootpath property removed from ' + self.bootenvrc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
918 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
919 |
|
852
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
920 |
def get_keyboard_layout(self): |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
921 |
'''Get keyboard layout using ioctl KIOCLAYOUT on /dev/kbd |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
922 |
return 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
923 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
924 |
#ioctl codes taken from /usr/include/sys/kbio.h |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
925 |
kioc = ord('k') << 8 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
926 |
kioclayout = kioc | 20 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
927 |
_dbg_msg("Opening keyboard device: " + self.kbd_device) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
928 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
929 |
kbd = open(self.kbd_device, "r+") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
930 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
931 |
prerror('Failure to open keyboard device ' + self.kbd_device) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
932 |
prerror('Failure. Returning: ICT_OPEN_KEYBOARD_DEVICE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
933 |
return ICT_OPEN_KEYBOARD_DEVICE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
934 |
if kbd == None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
935 |
prerror('Failure to open keyboard device ' + self.kbd_device) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
936 |
prerror('Failure. Returning: ICT_OPEN_KEYBOARD_DEVICE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
937 |
return ICT_OPEN_KEYBOARD_DEVICE_FAILED |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
938 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
939 |
k = array.array('i', [0]) |
728
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
940 |
|
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
941 |
try: |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
942 |
status = fcntl.ioctl(kbd, kioclayout, k, 1) |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
943 |
except IOError as err: |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
944 |
status = err.errno |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
945 |
if status == errno.EINVAL: |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
946 |
kbd.close() |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
947 |
info_msg("Failed to read keyboard device ioctl; Ignoring") |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
948 |
return 0 |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
949 |
except StandardError: |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
950 |
status = 1 |
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
951 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
952 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
953 |
kbd.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
954 |
prerror('fcntl ioctl KIOCLAYOUT_FAILED: status=' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
955 |
prerror('Failure. Returning: ICT_KIOCLAYOUT_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
956 |
return ICT_KIOCLAYOUT_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
957 |
kbd_layout = k.tolist()[0] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
958 |
kbd.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
959 |
|
852
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
960 |
self.keyboard_layout = self._get_kbd_layout_name(kbd_layout) |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
961 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
962 |
return 0 |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
963 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
964 |
def generate_sc_profile(self): |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
965 |
''' ICT - Assemble System Configuration (SC) profile |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
966 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
967 |
Configured parameters: |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
968 |
* keyboard layout - profile will configure keymap/layout SMF property |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
969 |
of svc:/system/keymap:default SMF service. |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
970 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
971 |
Following approach is taken: |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
972 |
* Take template profile |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
973 |
* Set value of keymap/layout SMF property to desired value (it is |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
974 |
configured as 'US-English' in template |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
975 |
* Store SMF profile into profile directory |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
976 |
(/etc/svc/profile/) |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
977 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
978 |
return 0 for success, ICT_GENERATE_SC_PROFILE_FAILED in case of failure |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
979 |
''' |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
980 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
981 |
_register_task(inspect.currentframe()) |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
982 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
983 |
sc_profile_src = self.basedir + self.sc_template |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
984 |
sc_profile_dst = self.basedir + '/etc/svc/profile/' + \ |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
985 |
self.sc_profile |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
986 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
987 |
# Obtain desired keyboard layout. |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
988 |
if self.get_keyboard_layout() != 0: |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
989 |
prerror('get_keyboard_layout() failed, Returning: ' |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
990 |
'ICT_GENERATE_SC_PROFILE_FAILED') |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
991 |
return ICT_GENERATE_SC_PROFILE_FAILED |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
992 |
|
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
993 |
# |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
994 |
# If keyboard layout has not been identified, |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
995 |
# go with default setting (US-English) |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
996 |
# |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
997 |
if self.keyboard_layout == '': |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
998 |
info_msg('Keyboard layout has not been identified') |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
999 |
info_msg('It will be configured to US-English.') |
728
4b1344a9349c
9698 keyboard_layout() ICT fails on some Sparc machines due to the failure of KIOCLAYOUT ioctl(2)
Keith Mitchell <keith.mitchell@sun.com>
parents:
711
diff
changeset
|
1000 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1001 |
|
852
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1002 |
info_msg('Detected ' + self.keyboard_layout + ' keyboard layout') |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1003 |
status = _cmd_status('/usr/bin/sed s/US-English/' + \ |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1004 |
self.keyboard_layout + '/ ' + \ |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1005 |
sc_profile_src + ' > ' + sc_profile_dst) |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1006 |
if status != 0: |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1007 |
try: |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1008 |
os.unlink(sc_profile_dst) |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1009 |
except OSError: |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1010 |
pass |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1011 |
prerror('Failure. Returning: ICT_GENERATE_SC_PROFILE_FAILED') |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1012 |
return ICT_GENERATE_SC_PROFILE_FAILED |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1013 |
|
852
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1014 |
info_msg('Created System Configuration profile ' + sc_profile_dst) |
d4a0239a3745
15678 /etc/default/kbd is to be obsoleted by 6944480, installers need to be accommodated
Jan Damborsky <jan.damborsky@sun.com>
parents:
848
diff
changeset
|
1015 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1016 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1017 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1018 |
def delete_misc_trees(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1019 |
'''ICT - delete miscellanous directory trees used as work areas |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1020 |
during installation |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1021 |
always return success |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1022 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1023 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1024 |
_cmd_status('rm -rf ' + self.basedir + '/var/tmp/*') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1025 |
_cmd_status('rm -rf ' + self.basedir + '/mnt/*') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1026 |
return 0 |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
1027 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1028 |
def create_smf_repository(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1029 |
'''ICT - copies /lib/svc/seed/global.db to /etc/svc/repository.db |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1030 |
returns 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1031 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1032 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1033 |
src = self.basedir + '/lib/svc/seed/global.db' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1034 |
dst = self.basedir + '/etc/svc/repository.db' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1035 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1036 |
shutil.copyfile(src, dst) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1037 |
os.chmod(dst, S_IRUSR | S_IWUSR) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1038 |
os.chown(dst, 0, 3) # chown root:sys |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1039 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1040 |
prerror('Cannot create smf repository due to error in copying ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1041 |
src + ' to ' + dst + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1042 |
prerror('Failure. Returning: ICT_CREATE_SMF_REPO_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1043 |
return ICT_CREATE_SMF_REPO_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1044 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1045 |
prerror('Unrecognized error - cannot create smf repository. ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1046 |
'source=' + src + ' destination=' + dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1047 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1048 |
prerror('Failure. Returning: ICT_CREATE_SMF_REPO_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1049 |
return ICT_CREATE_SMF_REPO_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1050 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1051 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1052 |
def create_mnttab(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1053 |
'''ICT - create /etc/mnttab if it doesn't already exist and chmod |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1054 |
returns 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1055 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1056 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1057 |
mnttab = self.basedir + '/etc/mnttab' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1058 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1059 |
open(mnttab, 'w').close() # equivalent to touch(1) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1060 |
os.chmod(mnttab, S_IREAD | S_IRGRP | S_IROTH) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1061 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1062 |
prerror('Cannot create ' + mnttab + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1063 |
prerror('Failure. Returning: ICT_CREATE_MNTTAB_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1064 |
return ICT_CREATE_MNTTAB_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1065 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1066 |
prerror('Unrecognized error - Cannot create ' + mnttab) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1067 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1068 |
prerror('Failure. Returning: ICT_CREATE_MNTTAB_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1069 |
return ICT_CREATE_MNTTAB_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1070 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1071 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1072 |
def add_splash_image_to_grub_menu(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1073 |
'''ICT - append splashimage and timeout commands to GRUB menu |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1074 |
If console is redirected to serial line, don't enable GRUB |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1075 |
splash screen. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1076 |
return 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1077 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1078 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1079 |
#This ICT is not supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1080 |
#If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1081 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1082 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1083 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1084 |
return ICT_INVALID_PLATFORM |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
1085 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1086 |
grubmenu = self.grubmenu |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1087 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1088 |
fp = open(self.grubmenu, 'a+') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1089 |
if ((self._get_osconsole() == 'text') or |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1090 |
(self._get_osconsole() == 'graphics')): |
576
b23f4240e2b0
5721 Serial console setting should be carried through to installed system
Jan Damborsky <jan.damborsky@sun.com>
parents:
554
diff
changeset
|
1091 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1092 |
fp.write('splashimage /boot/grub/splash.xpm.gz\n') |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1093 |
fp.write('foreground 343434\n') |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1094 |
fp.write('background F7FbFF\n') |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
1095 |
fp.write('default 0\n') |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1096 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1097 |
info_msg('Console on serial line, GRUB splash image will ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1098 |
'be disabled') |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1099 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1100 |
fp.write('timeout 30\n') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1101 |
fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1102 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1103 |
prerror('Error in appending splash image grub commands to ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1104 |
grubmenu + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1105 |
prerror('Failure. Returning: ICT_ADD_SPLASH_IMAGE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1106 |
return ICT_ADD_SPLASH_IMAGE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1107 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1108 |
prerror('Unrecognized error in appending splash image grub ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1109 |
'commands to ' + grubmenu) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1110 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1111 |
prerror('Failure. Returning: ICT_ADD_SPLASH_IMAGE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1112 |
return ICT_ADD_SPLASH_IMAGE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1113 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1114 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1115 |
def update_dumpadm_nodename(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1116 |
'''ICT - Update nodename in dumpadm.conf |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1117 |
Note: This is just temporary solution, as dumpadm(1M) -r option\ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1118 |
does not work. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1119 |
This issue is tracked by Bugster CR 6835106. Once this bug is fixed, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1120 |
dumpadm(1M) -r should be used for manipulating /etc/dumpadm.conf |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1121 |
instead. |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1122 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1123 |
returns 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1124 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1125 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1126 |
nodename = self.basedir + '/etc/nodename' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1127 |
dumpadmfile = '/etc/dumpadm.conf' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1128 |
dumpadmfile_dest = self.basedir + dumpadmfile |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1129 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1130 |
fnode = open(nodename, 'r') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1131 |
na = fnode.readlines() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1132 |
fnode.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1133 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1134 |
prerror('Error in accessing ' + nodename + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1135 |
prerror('Failure. Returning: ICT_UPDATE_DUMPADM_NODENAME_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1136 |
return ICT_UPDATE_DUMPADM_NODENAME_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1137 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1138 |
prerror('Unrecognized error in accessing ' + nodename) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1139 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1140 |
prerror('Failure. Returning: ICT_UPDATE_DUMPADM_NODENAME_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1141 |
return ICT_UPDATE_DUMPADM_NODENAME_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1142 |
nodename = na[0][:-1] |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1143 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1144 |
status = _cmd_status('cat ' + dumpadmfile + ' | ' + |
1403
4c3409611c91
imported patch oi-branding-lib-libict-pymod
Alasdair Lumsden <al@everycity.co.uk>
parents:
897
diff
changeset
|
1145 |
'sed s/openindiana/' + nodename + '/ > ' + dumpadmfile_dest) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1146 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1147 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1148 |
os.unlink(dumpadmfile_dest) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1149 |
except OSError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1150 |
pass |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1151 |
prerror('Failure. Returning: ICT_UPDATE_DUMPADM_NODENAME_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1152 |
return ICT_UPDATE_DUMPADM_NODENAME_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1153 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1154 |
return 0 |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
1155 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1156 |
def explicit_bootfs(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1157 |
'''ICT - For libbe to be able to support the initial boot environment, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1158 |
we need an explicit bootfs value in our menu entry. Add it |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1159 |
to the entry before the ZFS-BOOTFS line. This, along with the |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1160 |
rest of the grub menu entry manipulation code in this file, will |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1161 |
eventually need to get ripped out when we have support in libbe |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1162 |
to create and activate the grub entry for the initial boot |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1163 |
environment. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1164 |
returns 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1165 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1166 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1167 |
#This ICT is not supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1168 |
#If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1169 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1170 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1171 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1172 |
return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1173 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1174 |
rootdataset = self._get_root_dataset() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1175 |
if rootdataset == '': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1176 |
prerror('Could not determine root dataset') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1177 |
prerror('Failure. Returning: ICT_EXPLICIT_BOOTFS_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1178 |
return ICT_EXPLICIT_BOOTFS_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1179 |
newgrubmenu = self.grubmenu + '.new' |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1180 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1181 |
# Note there are TABs in the blow expression. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1182 |
# sedcmd = 'sed \'/\-B[ <TAB>]*\\$ZFS-BOOTFS/ i\\\nbootfs ' +\ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1183 |
sedcmd = 'sed \'/\-B[ ]*\\$ZFS-BOOTFS/ i\\\nbootfs ' +\ |
1433
8c642698bcb5
1496 oi_151a text installer messes up grub menu.lst
Alasdair Lumsden <al@everycity.co.uk>
parents:
1403
diff
changeset
|
1184 |
rootdataset + '\\\n\' ' + self.grubmenu + ' > ' + newgrubmenu |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1185 |
status = _cmd_status(sedcmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1186 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1187 |
prerror('Adding bootfs command to grub menu fails. ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1188 |
'exit status=' + int(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1189 |
prerror('Failure. Returning: ICT_EXPLICIT_BOOTFS_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1190 |
return ICT_EXPLICIT_BOOTFS_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1191 |
try: |
691
efcc9630d2b7
6103 ICT - may not be setting file permission correctly on some files
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
669
diff
changeset
|
1192 |
shutil.copyfile(newgrubmenu, self.grubmenu) |
efcc9630d2b7
6103 ICT - may not be setting file permission correctly on some files
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
669
diff
changeset
|
1193 |
os.remove(newgrubmenu) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1194 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1195 |
prerror('Moving GRUB menu ' + newgrubmenu + ' to ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1196 |
self.grubmenu + ' failed. ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1197 |
prerror('Failure. Returning: ICT_EXPLICIT_BOOTFS_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1198 |
return ICT_EXPLICIT_BOOTFS_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1199 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1200 |
prerror('Unrecognized error - cannot move GRUB menu ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1201 |
newgrubmenu + ' to ' + self.grubmenu) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1202 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1203 |
prerror('Failure. Returning: ICT_EXPLICIT_BOOTFS_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1204 |
return ICT_EXPLICIT_BOOTFS_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1205 |
return 0 |
350
cbcc5f485007
4673 Grub text only mode is required
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
338
diff
changeset
|
1206 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1207 |
def enable_happy_face_boot(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1208 |
'''ICT - Enable happy face boot |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1209 |
Enable graphical Happy Face boot for the entries in the menu.lst file. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1210 |
If console is redirected to serial line, don't enable happy face boot. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1211 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1212 |
To enable Happy Face boot: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1213 |
above the ZFS-BOOTFS line add: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1214 |
splashimage /boot/solaris.xpm |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1215 |
foreground FF0000 |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1216 |
background A8A8A8 |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1217 |
and to the end of the kernel line add: console=graphics |
324
1c6e18788b0e
3731 initial menu.lst needs update to enable happy face boot
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
321
diff
changeset
|
1218 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1219 |
returns 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1220 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1221 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1222 |
#This ICT is not supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1223 |
#If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1224 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1225 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1226 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1227 |
return ICT_INVALID_PLATFORM |
350
cbcc5f485007
4673 Grub text only mode is required
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
338
diff
changeset
|
1228 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1229 |
if self._get_osconsole() != 'text': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1230 |
info_msg('Console on serial line, happy face boot will' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1231 |
' be disabled') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1232 |
return 0 |
350
cbcc5f485007
4673 Grub text only mode is required
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
338
diff
changeset
|
1233 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1234 |
happy_face_splash = 'splashimage /boot/solaris.xpm' |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1235 |
happy_face_foreground = 'foreground FF0000' |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1236 |
happy_face_background = 'background A8A8A8' |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1237 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1238 |
newgrubmenu = self.grubmenu + '.new' |
324
1c6e18788b0e
3731 initial menu.lst needs update to enable happy face boot
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
321
diff
changeset
|
1239 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1240 |
sedcmd = 'sed -e \'/^kernel.*\\$ZFS-BOOTFS/ i\\\n' +\ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1241 |
happy_face_splash + '\\\n' +\ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1242 |
happy_face_foreground + '\\\n' + happy_face_background +\ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1243 |
'\' -e \'s/\\$ZFS-BOOTFS/\\$ZFS-BOOTFS,console=graphics/\' ' +\ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1244 |
self.grubmenu + ' > ' + newgrubmenu |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1245 |
status = _cmd_status(sedcmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1246 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1247 |
prerror('Adding happy face support to grub menu fails. ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1248 |
'exit status=' + int(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1249 |
prerror('Failure. Returning: ICT_ENABLE_HAPPY_FACE_BOOT_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1250 |
return ICT_ENABLE_HAPPY_FACE_BOOT_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1251 |
try: |
691
efcc9630d2b7
6103 ICT - may not be setting file permission correctly on some files
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
669
diff
changeset
|
1252 |
shutil.copyfile(newgrubmenu, self.grubmenu) |
efcc9630d2b7
6103 ICT - may not be setting file permission correctly on some files
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
669
diff
changeset
|
1253 |
os.remove(newgrubmenu) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1254 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1255 |
prerror('Moving GRUB menu ' + newgrubmenu + ' to ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1256 |
self.grubmenu + ' failed. ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1257 |
prerror('Failure. Returning: ICT_ENABLE_HAPPY_FACE_BOOT_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1258 |
return ICT_ENABLE_HAPPY_FACE_BOOT_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1259 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1260 |
prerror('Unrecognized error - cannot move GRUB menu ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1261 |
newgrubmenu + ' to ' + self.grubmenu) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1262 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1263 |
prerror('Failure. Returning: ICT_ENABLE_HAPPY_FACE_BOOT_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1264 |
return ICT_ENABLE_HAPPY_FACE_BOOT_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1265 |
return 0 |
324
1c6e18788b0e
3731 initial menu.lst needs update to enable happy face boot
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
321
diff
changeset
|
1266 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1267 |
def setup_dev_namespace(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1268 |
'''ICT - Setup the dev namespace on the target using devfsadm(1M) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1269 |
if installing from IPS. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1270 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1271 |
Test if installing from IPS. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1272 |
launch devfsadm -R basedir |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1273 |
return 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1274 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1275 |
_register_task(inspect.currentframe()) |
272
6ffbbcf6242a
3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
247
diff
changeset
|
1276 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1277 |
# launch devfsadm -R basedir |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1278 |
cmd = '/usr/sbin/devfsadm -R ' + self.basedir + ' 2>&1' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1279 |
status, cmdout = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1280 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1281 |
prerror('Setting up dev namespace fails. exit status=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1282 |
str(status) + ' command=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1283 |
prerror('Failure. Returning: ICT_SETUP_DEV_NAMESPACE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1284 |
return ICT_SETUP_DEV_NAMESPACE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1285 |
for ln in cmdout: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1286 |
info_msg('devfsadm command output: ' + ln) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1287 |
return 0 |
272
6ffbbcf6242a
3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
247
diff
changeset
|
1288 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1289 |
def update_boot_archive(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1290 |
'''ICT - update archive using bootadm(1M) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1291 |
launch bootadm update-archive -R basedir |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1292 |
return 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1293 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1294 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1295 |
cmd = 'bootadm update-archive -R ' + self.basedir + ' 2>&1' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1296 |
status, cmdout = _cmd_out(cmd) |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1297 |
info_msg('bootadm update-archive output: %s' % cmdout) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1298 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1299 |
prerror('Updating boot archive fails. exit status=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1300 |
str(status) + ' command=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1301 |
prerror('Failure. Returning: ICT_UPDATE_ARCHIVE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1302 |
return ICT_UPDATE_ARCHIVE_FAILED |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1303 |
else: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1304 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1305 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1306 |
def copy_splash_xpm(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1307 |
'''ICT - copy splash file to grub directory in new root pool |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1308 |
returns 0 for success or ICT status code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1309 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1310 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1311 |
#This ICT is not supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1312 |
#If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1313 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1314 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1315 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1316 |
return ICT_INVALID_PLATFORM |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
1317 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1318 |
src = self.basedir + '/boot/grub/splash.xpm.gz' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1319 |
dst = '/' + self.rootpool + '/boot/grub/splash.xpm.gz' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1320 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1321 |
shutil.copy(src, dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1322 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1323 |
prerror('Copy splash file ' + src + ' to ' + dst + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1324 |
' failed. ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1325 |
prerror('Failure. Returning: ICT_COPY_SPLASH_XPM_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1326 |
return ICT_COPY_SPLASH_XPM_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1327 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1328 |
prerror('Unrecognized error - Could not copy splash file ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1329 |
src + ' to ' + dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1330 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1331 |
prerror('Failure. Returning: ICT_COPY_SPLASH_XPM_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1332 |
return ICT_COPY_SPLASH_XPM_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1333 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1334 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1335 |
def smf_correct_sys_profile(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1336 |
'''ICT - Point SMF at correct system profile |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1337 |
return 0 if all files deleted and symlinks created, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1338 |
error status otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1339 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1340 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1341 |
return_status = 0 #assume success until proven otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1342 |
#delete and recreate links |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1343 |
for src, dst in ( |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1344 |
('generic_limited_net.xml', |
793
9a0c085d34e9
15372 the installer needs to be made aware of Early Manifest Import changes
Jan Damborsky <jan.damborsky@sun.com>
parents:
773
diff
changeset
|
1345 |
self.basedir + '/etc/svc/profile/generic.xml'), |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1346 |
('ns_dns.xml', |
793
9a0c085d34e9
15372 the installer needs to be made aware of Early Manifest Import changes
Jan Damborsky <jan.damborsky@sun.com>
parents:
773
diff
changeset
|
1347 |
self.basedir + '/etc/svc/profile/name_service.xml'), |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1348 |
('inetd_generic.xml', |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
1349 |
self.basedir + '/etc/svc/profile/inetd_services.xml'), |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
1350 |
(self.sc_profile, |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
1351 |
self.basedir + '/etc/svc/profile/site.xml')): |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
1352 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1353 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1354 |
os.unlink(dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1355 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1356 |
if errno != 2: #file not found |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1357 |
prerror('Error deleting file ' + dst + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1358 |
' for smf profile. ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1359 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1360 |
'ICT_SMF_CORRECT_SYS_PROFILE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1361 |
return_status = ICT_SMF_CORRECT_SYS_PROFILE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1362 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1363 |
prerror('Unrecognized error - could not delete file ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1364 |
dst + ' for smf profile. ') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1365 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1366 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1367 |
'ICT_SMF_CORRECT_SYS_PROFILE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1368 |
return_status = ICT_SMF_CORRECT_SYS_PROFILE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1369 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1370 |
os.symlink(src, dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1371 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1372 |
prerror('Error making symlinks for system profile. ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1373 |
strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1374 |
prerror('source=' + src + ' destination=' + dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1375 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1376 |
'ICT_SMF_CORRECT_SYS_PROFILE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1377 |
return_status = ICT_SMF_CORRECT_SYS_PROFILE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1378 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1379 |
prerror('Unrecognized error making symlinks for ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1380 |
'system profile.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1381 |
prerror('source=' + src + ' destination=' + dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1382 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1383 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1384 |
'ICT_SMF_CORRECT_SYS_PROFILE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1385 |
return_status = ICT_SMF_CORRECT_SYS_PROFILE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1386 |
return return_status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1387 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1388 |
def add_sysidtool_sys_unconfig(self, more_entries=None): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1389 |
'''ICT - Add entries for sysidtool and sys-unconfig to run all |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1390 |
known external apps. |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1391 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1392 |
creates /etc/.sysidconfig.apps |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1393 |
touches /etc/.UNCONFIGURED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1394 |
copy .sysIDtool.state to the target |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1395 |
Parameter: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1396 |
more_entries - list of additional entries for .sysidconfig.apps |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1397 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1398 |
return 0 if everything worked, error code if anything failed |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1399 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1400 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1401 |
sys_unconfig_entries = [ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1402 |
'/usr/sbin/sysidpm', |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1403 |
] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1404 |
return_status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1405 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1406 |
sysidconfigapps = self.basedir + '/etc/.sysidconfig.apps' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1407 |
fp = open(sysidconfigapps, 'w') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1408 |
if more_entries: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1409 |
sys_unconfig_entries.extend(more_entries) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1410 |
for sys_unconfig_entry in sys_unconfig_entries: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1411 |
fp.write(sys_unconfig_entry + '\n') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1412 |
fp.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1413 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1414 |
if errno != 2: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1415 |
prerror('Error creating ' + sysidconfigapps + ' - ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1416 |
prerror('Failure. Returning: ICT_SYSIDTOOL_ENTRIES_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1417 |
return_status = ICT_SYSIDTOOL_ENTRIES_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1418 |
except IOError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1419 |
if errno != 2: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1420 |
prerror('Error creating ' + sysidconfigapps + ' - ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1421 |
prerror('Failure. Returning: ICT_SYSIDTOOL_ENTRIES_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1422 |
return_status = ICT_SYSIDTOOL_ENTRIES_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1423 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1424 |
prerror('Unrecognized error creating ' + sysidconfigapps) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1425 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1426 |
prerror('Failure. Returning: ICT_SYSIDTOOL_ENTRIES_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1427 |
return_status = ICT_SYSIDTOOL_ENTRIES_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1428 |
#touch /etc/.UNCONFIGURED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1429 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1430 |
unconfigured = self.basedir + '/etc/.UNCONFIGURED' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1431 |
open(unconfigured, 'w').close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1432 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1433 |
prerror('Error touching ' + unconfigured + ' - ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1434 |
prerror('Failure. Returning: ICT_SYSIDTOOL_ENTRIES_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1435 |
return_status = ICT_SYSIDTOOL_ENTRIES_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1436 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1437 |
prerror('Unrecognized error touching ' + unconfigured) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1438 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1439 |
prerror('Failure. Returning: ICT_SYSIDTOOL_ENTRIES_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1440 |
return_status = ICT_SYSIDTOOL_ENTRIES_FAILED |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1441 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1442 |
#copy .sysIDtool.state to the target |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1443 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1444 |
src = '/etc/.sysIDtool.state' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1445 |
dst = self.basedir + '/etc/.sysIDtool.state' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1446 |
shutil.copy(src, dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1447 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1448 |
prerror('Failed to copy the contents of file src to file dst' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1449 |
strerror + ' src=' + src + '\n dst=' + dst + '\n') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1450 |
prerror('Failure. Returning: ICT_SYSIDTOOL_CP_STATE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1451 |
return_status = ICT_SYSIDTOOL_CP_STATE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1452 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1453 |
prerror('Unexpected error during copy of src to dst' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1454 |
' src=' + src + '\n dst=' + dst + '\n') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1455 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1456 |
prerror('Failure. Returning: ICT_SYSIDTOOL_CP_STATE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1457 |
return_status = ICT_SYSIDTOOL_CP_STATE_FAILED |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
1458 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1459 |
return return_status |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
1460 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1461 |
def configure_nwam(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1462 |
'''ICT - configure nwam by creating /etc/nwam/llp with |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1463 |
the preferred interface followed by dhcp in it. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1464 |
The perferred interface should be the interface |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1465 |
used for the network installation. |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
1466 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1467 |
return 0, otherwise error status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1468 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1469 |
_register_task(inspect.currentframe()) |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
1470 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1471 |
cmd = "/usr/sbin/ifconfig -au | /usr/bin/grep '[0-9]:' " \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1472 |
"| /usr/bin/grep -v 'LOOPBACK'" |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
1473 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1474 |
(status, output) = commands.getstatusoutput(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1475 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1476 |
prerror('ifconfig command to determine preferred network ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1477 |
'interface failed. command=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1478 |
prerror('Failure. Returning: ICT_CONFIGURE_NWAM_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1479 |
return ICT_CONFIGURE_NWAM_FAILED |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
1480 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1481 |
interface = output.split(':')[0] |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
1482 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1483 |
llp_dir = self.basedir + '/etc/nwam' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1484 |
llp_file = llp_dir + '/llp' |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
1485 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1486 |
if not os.access(llp_dir, os.F_OK): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1487 |
os.makedirs(llp_dir) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1488 |
# chown root:root |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1489 |
os.chown(llp_dir, 0, 0) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1490 |
# chmod 755 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1491 |
os.chmod(llp_dir, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1492 |
S_IREAD | S_IWRITE | S_IEXEC | |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1493 |
S_IRGRP | S_IXGRP | |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1494 |
S_IROTH | S_IXOTH) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1495 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1496 |
config_file = open(llp_file, 'w') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1497 |
# add the line with <interface> dhcp to it. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1498 |
config_file.write(interface + "\tdhcp\n") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1499 |
config_file.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1500 |
# chown root:root |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1501 |
os.chown(llp_file, 0, 0) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1502 |
# chmod 644 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1503 |
os.chmod(llp_file, S_IREAD | S_IWRITE | S_IRGRP | S_IROTH) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1504 |
except IOError, errno: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1505 |
# Unable to open the file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1506 |
prerror('Unexpected error writing to <target>/etc/nwam/llp' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1507 |
' to configure nwam. ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1508 |
' file=' + llp_file + ' failed to add the lines:\n' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1509 |
interface + '\tdhcp' + ' due to ' + str(errno)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1510 |
prerror(traceback.format_exc()) #traceback to stdout and log |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1511 |
prerror('Failure. Returning: ICT_CONFIGURE_NWAM_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1512 |
return ICT_CONFIGURE_NWAM_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1513 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1514 |
return 0 |
533
7f7a76e912e7
7377 No working network after reboot after installing OpenSolaris on Glendale
Jean McCormack <Jean.McCormack@Sun.COM>
parents:
531
diff
changeset
|
1515 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1516 |
def enable_nwam(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1517 |
'''ICT - Enable nwam service |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1518 |
SVCCFG_DTD=basedir + '/usr/share/lib/xml/dtd/service_bundle.dtd.1' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1519 |
SVCCFG_REPOSITORY=basedir + '/etc/svc/repository.db' |
793
9a0c085d34e9
15372 the installer needs to be made aware of Early Manifest Import changes
Jan Damborsky <jan.damborsky@sun.com>
parents:
773
diff
changeset
|
1520 |
svccfg apply basedir + '/etc/svc/profile/network_nwam.xml' |
272
6ffbbcf6242a
3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
247
diff
changeset
|
1521 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1522 |
return 0, otherwise error status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1523 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1524 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1525 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1526 |
return_status = 0 |
272
6ffbbcf6242a
3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
247
diff
changeset
|
1527 |
|
793
9a0c085d34e9
15372 the installer needs to be made aware of Early Manifest Import changes
Jan Damborsky <jan.damborsky@sun.com>
parents:
773
diff
changeset
|
1528 |
nwam_profile = self.basedir + '/etc/svc/profile/network_nwam.xml' |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1529 |
os.putenv('SVCCFG_DTD', self.basedir + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1530 |
'/usr/share/lib/xml/dtd/service_bundle.dtd.1') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1531 |
os.putenv('SVCCFG_REPOSITORY', self.basedir + '/etc/svc/repository.db') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1532 |
cmd = '/usr/sbin/svccfg apply ' + nwam_profile + ' 2>&1' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1533 |
status, oa = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1534 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1535 |
prerror('Command to enable nwam failed. exit status=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1536 |
str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1537 |
prerror('Command to enable nwam was: ' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1538 |
for ln in oa: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1539 |
prerror(ln) |
272
6ffbbcf6242a
3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
247
diff
changeset
|
1540 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1541 |
prerror('Failure. Returning: ICT_ENABLE_NWAM_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1542 |
return_status = ICT_ENABLE_NWAM_FAILED |
272
6ffbbcf6242a
3611 liborchestrator needs to be enhanced to support IPS based installs
Alok Aggarwal <Alok.Aggarwal@Sun.COM>
parents:
247
diff
changeset
|
1543 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1544 |
return return_status |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1545 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1546 |
def do_not_configure_network(self): |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1547 |
'''ICT - Do not configure any network. NWAM will be disabled. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1548 |
Net physical default will be enabled. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1549 |
SVCCFG_DTD=basedir + '/usr/share/lib/xml/dtd/service_bundle.dtd.1' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1550 |
SVCCFG_REPOSITORY=basedir + '/etc/svc/repository.db' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1551 |
svccfg -s network/physical:default setprop general/enabled = true |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1552 |
svccfg -s network/physical:nwam setprop general/enabled = false |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1553 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1554 |
return 0, otherwise error status |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1555 |
''' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1556 |
_register_task(inspect.currentframe()) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1557 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1558 |
return_status = 0 |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1559 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1560 |
os.putenv('SVCCFG_DTD', self.basedir + |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1561 |
'/usr/share/lib/xml/dtd/service_bundle.dtd.1') |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1562 |
os.putenv('SVCCFG_REPOSITORY', self.basedir + '/etc/svc/repository.db') |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1563 |
cmd = '/usr/sbin/svccfg -s network/physical:default setprop ' + \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1564 |
'general/enabled = true 2>&1' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1565 |
status, oa = _cmd_out(cmd) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1566 |
if status != 0: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1567 |
prerror('Command to disable network/physical:default failed. ' + \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1568 |
'exit status=' + str(status)) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1569 |
prerror('Command to disable network/physical:default was: ' + cmd) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1570 |
for ln in oa: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1571 |
prerror(ln) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1572 |
prerror('Failure. Returning: ICT_SVCCFG_FAILURE') |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1573 |
return(ICT_SVCCFG_FAILURE) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1574 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1575 |
cmd = '/usr/sbin/svccfg -s network/physical:nwam setprop ' + \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1576 |
'general/enabled = false 2>&1' |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1577 |
status, oa = _cmd_out(cmd) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1578 |
if status != 0: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1579 |
prerror('Command to disable nwam failed. exit status=' + \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1580 |
str(status)) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1581 |
prerror('Command to disable nwam was: ' + cmd) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1582 |
for ln in oa: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1583 |
prerror(ln) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1584 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1585 |
prerror('Failure. Returning: ICT_SVCCFG_FAILURE') |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1586 |
return (ICT_SVCCFG_FAILURE) |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1587 |
|
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1588 |
return return_status |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1589 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1590 |
def remove_livecd_environment(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1591 |
'''ICT - Copy saved configuration files to remove vestiges of |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1592 |
live CD environment |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1593 |
return 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1594 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1595 |
savedir = self.basedir + '/save' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1596 |
if not os.path.exists(savedir): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1597 |
info_msg('saved configuration files directory is missing') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1598 |
return 0 # empty - assume no config files to back up |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1599 |
cmd = '(cd %s && find . -type f -print | \ |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1600 |
/bin/cpio -pmu %s > /dev/null 2>& 1) && rm -rf %s' \ |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1601 |
% (savedir, self.basedir, savedir) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1602 |
status = _cmd_status(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1603 |
if status == 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1604 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1605 |
prerror('remove liveCD environment failed: exit status ' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1606 |
prerror('command was ' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1607 |
prerror('Failure. Returning: ICT_REMOVE_LIVECD_ENVIRONMENT_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1608 |
return ICT_REMOVE_LIVECD_ENVIRONMENT_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1609 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1610 |
def remove_specific_packages(self, pkg_list): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1611 |
'''ICT - Remove install-specific packages |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1612 |
launch pkg -R basedir uninstall PACKAGE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1613 |
Parameter: pkg_list - list of pkg names |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1614 |
return 0 for success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1615 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1616 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1617 |
return_status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1618 |
for pkg in pkg_list: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1619 |
cmd = 'pkg -R %s uninstall -q --no-index %s 2>&1' % \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1620 |
(self.basedir, pkg) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1621 |
status, cmdout = _cmd_out(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1622 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1623 |
prerror('Removal of package %s failed. pkg exit status =%d' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1624 |
% (pkg, status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1625 |
prerror('Failed package removal command=' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1626 |
for ln in cmdout: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1627 |
prerror(ln) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1628 |
prerror('Failure. Returning: ICT_PACKAGE_REMOVAL_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1629 |
return_status = ICT_PACKAGE_REMOVAL_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1630 |
return return_status |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1631 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1632 |
def set_flush_content_cache_false(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1633 |
'''ICT - The LiveCD can be configured to purge the IPS download cache. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1634 |
Restore the original IPS default to not purge the IPS download cache. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1635 |
Use the command line interface to IPS : pkg set-property |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1636 |
return 0 upon success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1637 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1638 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1639 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1640 |
cmd = 'pkg -R ' + self.basedir + \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1641 |
' set-property flush-content-cache-on-success False' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1642 |
status = _cmd_status(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1643 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1644 |
prerror('Set property flush-content-cache-on-success ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1645 |
'exit status = ' + str(status) + ', command was ' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1646 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1647 |
'ICT_SET_FLUSH_CONTENT_CACHE_ON_SUCCESS_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1648 |
return ICT_SET_FLUSH_CONTENT_CACHE_ON_SUCCESS_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1649 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1650 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1651 |
def set_boot_device_property(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1652 |
'''ICT - update bootenv.rc 'console' property determines console |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1653 |
boot device from bootenv.rc properties 'output-device' and 'console' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1654 |
updates 'console' bootenv.rc property |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1655 |
return status = 0 if success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1656 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1657 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1658 |
#This ICT is not supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1659 |
#If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1660 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1661 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1662 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1663 |
return ICT_INVALID_PLATFORM |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1664 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1665 |
# put it in bootenv.rc |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1666 |
curosconsole = self._get_bootprop('output-device') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1667 |
osconsole = self._get_osconsole() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1668 |
if curosconsole != osconsole and osconsole != '': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1669 |
info_msg('Setting console boot device property to ' + osconsole) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1670 |
status = self._update_bootprop('console', osconsole) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1671 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1672 |
return status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1673 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1674 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1675 |
def remove_livecd_coreadm_conf(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1676 |
'''ICT - Remove LiveCD-specific /etc/coreadm.conf config file. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1677 |
Coreadm will create its initial configuration on first boot |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1678 |
see also coreadm(1m) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1679 |
returns 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1680 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1681 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1682 |
filename = self.basedir + '/etc/coreadm.conf' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1683 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1684 |
os.unlink(filename) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1685 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1686 |
if errno != 2: #file does not exist |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1687 |
prerror('I/O error - cannot delete file ' + filename + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1688 |
': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1689 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1690 |
' ICT_REMOVE_LIVECD_COREADM_CONF_FAILURE') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1691 |
return ICT_REMOVE_LIVECD_COREADM_CONF_FAILURE |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1692 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1693 |
_dbg_msg('coreadm config file already removed ' + filename) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1694 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1695 |
prerror('Unrecognized error - cannot delete file ' + filename) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1696 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1697 |
prerror('Failure. Returning: ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1698 |
'ICT_REMOVE_LIVECD_COREADM_CONF_FAILURE') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1699 |
return ICT_REMOVE_LIVECD_COREADM_CONF_FAILURE |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1700 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1701 |
return 0 |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1702 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1703 |
def set_partition_active_sparc(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1704 |
'''support routine - set the Solaris partition active using eeprom |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1705 |
return 0 if no errors for any drive, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1706 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1707 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1708 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1709 |
# Just in case this supporting routine was called directly. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1710 |
if not self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1711 |
prerror('This supporting routine is not supported on this' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1712 |
' hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1713 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1714 |
return ICT_INVALID_PLATFORM |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1715 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1716 |
prom_device = '/dev/openprom' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1717 |
#ioctl codes and OPROMMAXPARAM taken from /usr/include/sys/openpromio.h |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1718 |
oioc = ord('O') << 8 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1719 |
opromdev2promname = oioc | 15 # Convert devfs path to prom path |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1720 |
oprommaxparam = 32768 |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1721 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1722 |
# since the root device might be a metadevice, all the components |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1723 |
# need to be located so each can be operated upon individually |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1724 |
status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1725 |
status, rdlist = self.get_rootdev_list('/dev/dsk/') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1726 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1727 |
prerror('get_rootdev_list() status=' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1728 |
prerror('Failure. Returning: ICT_SET_PART_ACTIVE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1729 |
return ICT_SET_PART_ACTIVE_FAILED |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1730 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1731 |
for rootdev in rdlist: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1732 |
_dbg_msg('root device: ' + rootdev) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1733 |
_dbg_msg('Opening prom device: ' + prom_device) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1734 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1735 |
prom = open(prom_device, "r") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1736 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1737 |
prom = None |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1738 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1739 |
if prom == None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1740 |
prerror('Failure to open prom device ' + prom_device) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1741 |
prerror('Failure. Returning: ICT_OPEN_PROM_DEVICE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1742 |
return ICT_OPEN_PROM_DEVICE_FAILED |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1743 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1744 |
# Set up a mutable array for ioctl to read from and write to. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1745 |
# Standard Python objects are not usable here. fcntl.ioctl |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1746 |
# requires a mutable buffer pre-packed with the correct values |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1747 |
# (as determined by the device-driver). In this case, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1748 |
# openprom(7D) describes the following C stucture as defined in |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1749 |
# <sys.openpromio.h> |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1750 |
# struct openpromio { |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1751 |
# uint_t oprom_size; /* real size of following data */ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1752 |
# union { |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1753 |
# char b[1]; /* NB: Adjacent, Null terminated */ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1754 |
# int i; |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1755 |
# } opio_u; |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1756 |
# }; |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1757 |
dev = (rootdev + "\0").ljust(oprommaxparam) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1758 |
buf = array.array('c', struct.pack('I%ds' % oprommaxparam, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1759 |
oprommaxparam, dev)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1760 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1761 |
# use ioctl to query the prom device. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1762 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1763 |
status = fcntl.ioctl(prom, opromdev2promname, buf, True) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1764 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1765 |
status = 1 # Force bad status for check below |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1766 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1767 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1768 |
prom.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1769 |
prerror('ioctl OPROMDEV2PROMNAME ' + rootdev + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1770 |
' failed: status=' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1771 |
prerror('Failure. Returning: ICT_IOCTL_PROM_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1772 |
return ICT_IOCTL_PROM_FAILED |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1773 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1774 |
prom.close() |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1775 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1776 |
# Unpack the mutable array, buf, which ioctl just wrote into. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1777 |
new_oprom_size, new_dev = struct.unpack('I%ds' % oprommaxparam, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1778 |
buf) |
840
15dccd30b336
6936371 install fails if OBP lists multiple paths for boot device
David Miner <dminer@opensolaris.org>
parents:
817
diff
changeset
|
1779 |
|
15dccd30b336
6936371 install fails if OBP lists multiple paths for boot device
David Miner <dminer@opensolaris.org>
parents:
817
diff
changeset
|
1780 |
# Device names are a list of null-terminated tokens, with a |
15dccd30b336
6936371 install fails if OBP lists multiple paths for boot device
David Miner <dminer@opensolaris.org>
parents:
817
diff
changeset
|
1781 |
# double null on the final token. We use only the first token. |
15dccd30b336
6936371 install fails if OBP lists multiple paths for boot device
David Miner <dminer@opensolaris.org>
parents:
817
diff
changeset
|
1782 |
prom_name = new_dev.split('\0')[0] |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1783 |
_dbg_msg('prom name:: ' + prom_name) |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1784 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1785 |
# Set the boot device using eeprom |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1786 |
status = _cmd_status('/usr/sbin/eeprom boot-device=' + prom_name) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1787 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1788 |
prerror('fcntl ioctl OPROMDEV2PROMNAME failed: status=' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1789 |
str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1790 |
prerror('Failure. Returning: ICT_IOCTL_PROM_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1791 |
return ICT_IOCTL_PROM_FAILED |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1792 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1793 |
#if no errors encountered. Return 0 for success |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1794 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1795 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1796 |
def set_partition_active_x86(self): |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1797 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1798 |
'''support routine - set the Solaris partition on the just |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1799 |
installed drive to active rewrites disk format tables |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1800 |
see set_boot_active() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1801 |
return 0 if no errors for any drive, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1802 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1803 |
_register_task(inspect.currentframe()) |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1804 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1805 |
# Just in case this supporting routine was called directly. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1806 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1807 |
prerror('This supporting routine is not supported on this ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1808 |
'hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1809 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1810 |
return ICT_INVALID_PLATFORM |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
1811 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1812 |
# since the root device might be a metadevice, all the components |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1813 |
# need to be located so each can be operated upon individually |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1814 |
return_status, rdlist = self.get_rootdev_list('/dev/rdsk/') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1815 |
if return_status == 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1816 |
for rootdev in rdlist: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1817 |
_dbg_msg('root device: ' + rootdev) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1818 |
status = self.set_boot_active(rootdev) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1819 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1820 |
return_status = status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1821 |
status = self.bootadm_update_menu(rootdev) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1822 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1823 |
return_status = status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1824 |
#if any operation fails, return error status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1825 |
return return_status |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1826 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1827 |
def set_partition_active(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1828 |
'''ICT - set the Solaris partition active |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1829 |
This ICT is implemented differently on SPARC and x86. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1830 |
Invoke the correct supporting routine based on platform. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1831 |
Bubble up status from supporting routine. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1832 |
return 0 if no errors for any drive, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1833 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1834 |
_register_task(inspect.currentframe()) |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1835 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1836 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1837 |
return_status = self.set_partition_active_sparc() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1838 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1839 |
return_status = self.set_partition_active_x86() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1840 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1841 |
return return_status |
421
faf781efca86
6080 ICT set_Solaris_partition_active needs to handle OBP device names
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
416
diff
changeset
|
1842 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1843 |
def get_special_grub_entry(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1844 |
'''Support function for the fix_grub_entry() function. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1845 |
Determines whether a special string is needed for the grub |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1846 |
entry. The special string, if specified, should be |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1847 |
in the .image_info file. |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
514
diff
changeset
|
1848 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1849 |
- return the special grub entry if one is found in .image_info. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1850 |
- return None if none is found |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1851 |
''' |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
514
diff
changeset
|
1852 |
|
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1853 |
if (not self.livecd_install and not self.auto_install and |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1854 |
not self.text_install): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1855 |
# Not going to have .image_info file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1856 |
return None |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
514
diff
changeset
|
1857 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1858 |
# |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1859 |
# Check whether a specific title should be used for the |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1860 |
# grub menu instead of the default one. If a specific |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1861 |
# title should be used, the Distribution Constructor |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1862 |
# will put the special title in the /.cdrom/.image_info file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1863 |
# |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1864 |
grub_title = None |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1865 |
img_info_fd = None |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
1866 |
if (self.livecd_install or self.text_install): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1867 |
img_info_file = "/.cdrom/.image_info" |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1868 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1869 |
img_info_file = "/tmp/.image_info" |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
514
diff
changeset
|
1870 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1871 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1872 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1873 |
img_info_fd = open(img_info_file, "r") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1874 |
for line in img_info_fd: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1875 |
if line.startswith("GRUB_TITLE="): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1876 |
grub_title_line = line.rstrip('\n') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1877 |
title_string = grub_title_line.split("=") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1878 |
grub_title = title_string[1] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1879 |
break |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1880 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1881 |
# Should not get into this situation, but |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1882 |
# it is harmless to continue, so, just |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1883 |
# log it. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1884 |
_dbg_msg("No image file found. Use default grub title") |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1885 |
finally: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1886 |
if (img_info_fd != None): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1887 |
img_info_fd.close() |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1888 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1889 |
return grub_title |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1890 |
|
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1891 |
def match_boot_entry(self, title): |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1892 |
'''Returns True if the given line is the 'title' line that needs |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1893 |
to be updated with the "special grub entry." |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1894 |
|
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1895 |
For now, assume that boot_entry is the right entry, as there |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1896 |
should be only one entry in the menu.lst file at this point |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1897 |
in the install |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1898 |
|
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1899 |
''' |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1900 |
return title.startswith("title") |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1901 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1902 |
def fix_grub_entry(self): |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1903 |
'''ICT - Fix up the grub entry. If a special grub title entry |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1904 |
is defined when the image is built by the Distribution |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1905 |
Constructor, that special title will be used. |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1906 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1907 |
return 0 on success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1908 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1909 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1910 |
#This ICT is not supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1911 |
#If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1912 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1913 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1914 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1915 |
return ICT_INVALID_PLATFORM |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1916 |
|
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1917 |
new_title = self.get_special_grub_entry() |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1918 |
if new_title is None: |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1919 |
# No need to update the grub entry |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1920 |
return 0 |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1921 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1922 |
newgrubmenu = self.grubmenu + '.new' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1923 |
try: |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1924 |
with open(self.grubmenu, "r") as old_grub_fd: |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1925 |
old_lines = old_grub_fd.readlines() |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1926 |
|
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1927 |
with open(newgrubmenu, "w") as new_grub_fd: |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1928 |
for line in old_lines: |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1929 |
if self.match_boot_entry(line): |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1930 |
# replace part of existing title |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1931 |
# with the specified new title |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1932 |
new_grub_fd.write("title %s\n" % new_title) |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1933 |
else: |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1934 |
new_grub_fd.write(line) |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1935 |
except (OSError, IOError) as err: |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1936 |
prerror('Error updating grub menu: ' + str(err)) |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1937 |
prerror('Failure. Returning: ICT_FIX_GRUB_ENTRY_FAILED') |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1938 |
return ICT_FIX_GRUB_ENTRY_FAILED |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1939 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1940 |
if not _move_in_updated_config_file(newgrubmenu, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1941 |
self.grubmenu): |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1942 |
prerror('Failure. Returning: ICT_FIX_GRUB_ENTRY_FAILED') |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1943 |
return ICT_FIX_GRUB_ENTRY_FAILED |
517
90634384a309
7751 AI image shows warning about /etc/system during boot
Karen Tung <Karen.Tung@Sun.COM>
parents:
514
diff
changeset
|
1944 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1945 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
1946 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1947 |
def create_sparc_boot_menu(self, title=None): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1948 |
'''ICT - Create a boot menu.lst file on a SPARC system. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1949 |
return 0 on success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1950 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1951 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1952 |
#This ICT is only supported on SPARC platforms. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1953 |
#If invoked on a non SPARC platform return ICT_INVALID_PLATFORM |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1954 |
if not self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1955 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1956 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1957 |
return ICT_INVALID_PLATFORM |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
1958 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1959 |
# Attempt to create the path to where the menu.lst file will reside |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1960 |
# Catch OSError and pass if the directory already exists. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1961 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1962 |
os.makedirs(self.bootmenu_path_sparc) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1963 |
except OSError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1964 |
pass |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
1965 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1966 |
# Write to the menu.lst file |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1967 |
rootdataset = self._get_root_dataset() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1968 |
if rootdataset == '': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1969 |
prerror('Could not determine root dataset') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1970 |
prerror('Failure. Returning: ICT_CREATE_SPARC_BOOT_MENU_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1971 |
return ICT_CREATE_SPARC_BOOT_MENU_FAILED |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1972 |
|
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1973 |
if title is None: |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1974 |
title = MENU_LST_DEFAULT_TITLE |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1975 |
sparc_title_line = 'title %s\n' % title |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1976 |
bootfs_line = 'bootfs ' + rootdataset + '\n' |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
1977 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1978 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1979 |
op = open(self.bootmenu_sparc, 'w') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1980 |
op.write(sparc_title_line) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1981 |
op.write(bootfs_line) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1982 |
op.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1983 |
os.chmod(self.bootmenu_sparc, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1984 |
S_IREAD | S_IWRITE | S_IRGRP | S_IROTH) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1985 |
os.chown(self.bootmenu_sparc, 0, 3) # chown root:sys |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1986 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1987 |
prerror('Error when creating sparc boot menu.lst file ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1988 |
self.bootmenu_sparc + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1989 |
prerror('Failure. Returning: ICT_CREATE_SPARC_BOOT_MENU_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1990 |
return ICT_CREATE_SPARC_BOOT_MENU_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1991 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1992 |
prerror('Unexpected error when creating sparc boot ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1993 |
' menu.lst file ' + self.bootmenu_sparc) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
1994 |
prerror(traceback.format_exc()) # traceback to stdout and log |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1995 |
prerror('Failure. Returning: ICT_CREATE_SPARC_BOOT_MENU_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1996 |
return ICT_CREATE_SPARC_BOOT_MENU_FAILED |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
1997 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1998 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
1999 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2000 |
def copy_sparc_bootlst(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2001 |
'''ICT - Copy the bootlst file on a SPARC system. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2002 |
On SPARC systems a bootlst file is maintained at: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2003 |
/platform/`uname -m`/bootlst |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2004 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2005 |
It needs to be copied to: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2006 |
<rootpool>/platform/`uname -m`/bootlst |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2007 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2008 |
return 0 on success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2009 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2010 |
_register_task(inspect.currentframe()) |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2011 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2012 |
# This ICT is only supported on SPARC platforms. |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2013 |
# If invoked on a non SPARC platform return ICT_INVALID_PLATFORM |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2014 |
if not self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2015 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2016 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2017 |
return ICT_INVALID_PLATFORM |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2018 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2019 |
# Copy file bootlst from basedir to the rootpool |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2020 |
bootlst_dir = '/' + self.rootpool + '/platform/' + platform.machine() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2021 |
bootlst_dst = bootlst_dir + '/bootlst' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2022 |
bootlst_src = self.basedir + '/platform/' + platform.machine() + \ |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2023 |
'/bootlst' |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2024 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2025 |
# Create the destination directory if it does not already exist. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2026 |
# Catch OSError and pass if the directory already exists. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2027 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2028 |
os.makedirs(bootlst_dir) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2029 |
except OSError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2030 |
pass |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2031 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2032 |
# Copy the bootlst |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2033 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2034 |
shutil.copyfile(bootlst_src, bootlst_dst) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2035 |
os.chmod(bootlst_dst, S_IREAD | S_IWRITE | S_IRGRP | S_IROTH) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2036 |
os.chown(bootlst_dst, 0, 3) # chown root:sys |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2037 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2038 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2039 |
prerror('Error when copying the sparc bootlst file ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2040 |
bootlst_src + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2041 |
prerror('Failure. Returning: ICT_COPY_SPARC_BOOTLST_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2042 |
return ICT_COPY_SPARC_BOOTLST_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2043 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2044 |
prerror('Unexpected error when copying the sparc bootlst file ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2045 |
self.bootmenu_sparc) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2046 |
prerror(traceback.format_exc()) # traceback to stdout and log |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2047 |
prerror('Failure. Returning: ICT_COPY_SPARC_BOOTLST_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2048 |
return ICT_COPY_SPARC_BOOTLST_FAILED |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2049 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2050 |
return 0 |
496
51900384c4fd
6744 beadm fails for sparc AI sun4v due to missing /rpool/boot/menu.lst
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
481
diff
changeset
|
2051 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2052 |
def add_operating_system_grub_entry(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2053 |
'''ICT - add entries for other installed OS's to the grub menu |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2054 |
Launch /sbin/mkmenu <target GRUB menu> |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2055 |
return 0 on success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2056 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2057 |
_register_task(inspect.currentframe()) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2058 |
# This ICT is not supported on SPARC platforms. |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2059 |
# If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2060 |
if self.is_sparc: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2061 |
prerror('This ICT is not supported on this hardware platform.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2062 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2063 |
return ICT_INVALID_PLATFORM |
407
694e65909fa5
4163 Blocker bug for ICT work required for SPARC
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
366
diff
changeset
|
2064 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2065 |
cmd = '/sbin/mkmenu ' + self.grubmenu |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2066 |
cwd_start = os.getcwd() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2067 |
os.chdir('/') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2068 |
status = _cmd_status(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2069 |
os.chdir(cwd_start) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2070 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2071 |
prerror('Add other OS to grub menu failed. command=' + cmd + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2072 |
' exit status=' + str(status)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2073 |
prerror('Failure. Returning: ICT_MKMENU_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2074 |
return ICT_MKMENU_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2075 |
return 0 |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2076 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2077 |
def do_clobber_files(self, flist_file): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2078 |
'''ICT - Given a file containing a list of pathnames, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2079 |
search for those entries in the alternate root and |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2080 |
delete all matching pathnames from the alternate root that |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2081 |
are symbolic links. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2082 |
This process is required because of the way the LiveCD env |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2083 |
is constructed. Some of the entries in the boot_archive are |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2084 |
symbolic links to files mounted off a compressed lofi file. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2085 |
This is done to drastically reduce space usage by the boot_archive. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2086 |
side effect: current directory changed to basedir |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2087 |
returns 0 if all processing completed successfully, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2088 |
error code if any problems |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2089 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2090 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2091 |
_dbg_msg('File with list of pathnames with symbolic links' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2092 |
' to clobber: ' + flist_file) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2093 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2094 |
fh = open(flist_file, 'r') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2095 |
os.chdir(self.basedir) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2096 |
except OSError, (errno, strerror): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2097 |
prerror('I/O error - cannot access clobber list file ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2098 |
flist_file + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2099 |
prerror('Failure. Returning: ICT_CLOBBER_FILE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2100 |
return ICT_CLOBBER_FILE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2101 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2102 |
prerror('Unrecognized error processing clobber list file ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2103 |
flist_file) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2104 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2105 |
prerror('Failure. Returning: ICT_CLOBBER_FILE_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2106 |
return ICT_CLOBBER_FILE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2107 |
return_status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2108 |
for line in fh: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2109 |
line = line[:-1] |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2110 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2111 |
mst = os.lstat(line) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2112 |
if S_ISLNK(mst.st_mode): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2113 |
_dbg_msg("Unlink: " + line) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2114 |
os.unlink(line) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2115 |
except OSError, (errno, strerror): |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2116 |
if errno == 2: # file does not exist |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2117 |
_dbg_msg('Pathname ' + line + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2118 |
' not found - nothing deleted') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2119 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2120 |
prerror('I/O error - cannot delete soft link ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2121 |
line + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2122 |
prerror('Failure. Returning: ICT_CLOBBER_FILE_FAILED') |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2123 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2124 |
# one or more items fail processing |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2125 |
return_status = ICT_CLOBBER_FILE_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2126 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2127 |
prerror('Unrecognized error during file ' + line + ' clobber') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2128 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2129 |
fh.close() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2130 |
return return_status |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2131 |
|
760
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2132 |
def copy_capability_file(self): |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2133 |
'''ICT - copies grub capability file from microroot to grub |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2134 |
directory in root pool. |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2135 |
|
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2136 |
Parameters: |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2137 |
none |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2138 |
returns 0 for success, otherwise error code |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2139 |
''' |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2140 |
_register_task(inspect.currentframe()) |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2141 |
# This ICT is not supported on SPARC platforms. |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2142 |
# If invoked on a SPARC platform return ICT_INVALID_PLATFORM |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2143 |
if self.is_sparc: |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2144 |
prerror('This ICT is not supported on this hardware platform.') |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2145 |
prerror('Failure. Returning: ICT_INVALID_PLATFORM') |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2146 |
return ICT_INVALID_PLATFORM |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2147 |
try: |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2148 |
shutil.copy2("/boot/grub/capability", "/" + self.rootpool + |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2149 |
"/boot/grub/capability") |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2150 |
except (OSError, IOError) as err: |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2151 |
prerror('Error copying /boot/grub/capability to ' + '/' + |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2152 |
self.rootpool + '/boot/grub/capability:' + str(err)) |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2153 |
return ICT_COPY_CAPABILITY_FAILED |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2154 |
return 0 |
8aff0e5d3897
14962 ict.py should be copying the capability file so that installgrub is not run when not needed.
Evan Layton <Evan.Layton@Sun.COM>
parents:
738
diff
changeset
|
2155 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2156 |
def cleanup_unneeded_files_and_dirs(self, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2157 |
more_cleanup_files=None, |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2158 |
more_cleanup_dirs=None): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2159 |
'''ICT - removes list of files and directories that should |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2160 |
not have been copied If these are of appreciable size, they |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2161 |
should be withheld from cpio file list instead |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2162 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2163 |
Parameters: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2164 |
more_cleanup_files - list of additional files to delete |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2165 |
more_cleanup_dirs - list of additional directories to delete |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2166 |
returns 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2167 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2168 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2169 |
# Cleanup the files and directories that were copied into |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2170 |
# the basedir directory that are not needed by the installed OS. |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2171 |
file_cleanup_list = ["/.livecd", |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2172 |
"/.volsetid", |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2173 |
"/.textinstall", |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2174 |
"/etc/sysconfig/language", |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2175 |
"/.liveusb"] |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2176 |
dir_cleanup_list = ["/a", "/bootcd_microroot"] |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2177 |
if more_cleanup_files: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2178 |
file_cleanup_list.extend(more_cleanup_files) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2179 |
if more_cleanup_dirs: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2180 |
dir_cleanup_list.extend(more_cleanup_dirs) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2181 |
return_status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2182 |
for basefname in file_cleanup_list: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2183 |
fname = self.basedir + "/" + basefname |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2184 |
_dbg_msg('Removing file ' + fname) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2185 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2186 |
os.remove(fname) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2187 |
except OSError, (errno, strerror): |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2188 |
if errno == 2: # file not found |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2189 |
_dbg_msg('File to delete was not found: ' + fname) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2190 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2191 |
prerror('Error deleting file ' + fname + ': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2192 |
prerror('Failure. Returning: ICT_CLEANUP_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2193 |
return_status = ICT_CLEANUP_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2194 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2195 |
prerror('Unexpected error deleting directory.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2196 |
prerror(traceback.format_exc()) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2197 |
|
848
59b0d009aae9
16433 install-incorporation: Provide empty package manifests for renamed/obsolete pkgs
Keith Mitchell <keith.mitchell@oracle.com>
parents:
846
diff
changeset
|
2198 |
# Since pkg:/system/boot/grub delivers the reference grub menu file |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2199 |
# (/boot/grub/menu.lst) we'll have to copy the menu.lst |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2200 |
# file from the microroot into the installed system. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2201 |
# Since this file is for reference only if the copy |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2202 |
# fails we don't want to stop the install for this but |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2203 |
# we should log it. |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2204 |
if not self.is_sparc: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2205 |
try: |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2206 |
shutil.copy2("/boot/grub/menu.lst", self.basedir + |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2207 |
"/boot/grub/menu.lst") |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2208 |
except (OSError, IOError) as err: |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2209 |
prerror('Error copying /boot/grub/menu.lst to ' + |
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2210 |
self.basedir + '/boot/grub/menu.lst :' + str(err)) |
738
dfbddab40d09
14475 installer appears to remove /boot/grub/menu.lst
Evan Layton <Evan.Layton@Sun.COM>
parents:
728
diff
changeset
|
2211 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2212 |
# The bootcd_microroot directory should be cleaned up in the |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2213 |
# Distribution Constructor once they have finished the redesign. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2214 |
for basedname in dir_cleanup_list: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2215 |
dname = self.basedir + "/" + basedname |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2216 |
_dbg_msg('removing directory' + dname) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2217 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2218 |
os.rmdir(dname) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2219 |
except OSError, (errno, strerror): |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2220 |
if errno == 2: # file not found |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2221 |
_dbg_msg('Path to delete was not found: ' + dname) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2222 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2223 |
prerror('Error deleting directory ' + dname + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2224 |
': ' + strerror) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2225 |
prerror('Failure. Returning: ICT_CLEANUP_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2226 |
return_status = ICT_CLEANUP_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2227 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2228 |
prerror('Unexpected error deleting file.') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2229 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2230 |
return return_status |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2231 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2232 |
def reset_image_uuid(self): |
897
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2233 |
'''ICT - reset pkg(1) image UUID for preferred publisher |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2234 |
|
1447
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2235 |
Obtain name of all publishers by parsing output of the following |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2236 |
command: pkg -R basedir property -H publisher-search-order |
897
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2237 |
|
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2238 |
launch pkg -R basedir set-publisher --reset-uuid --no-refresh \ |
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2239 |
<preferred_publisher> |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2240 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2241 |
launch pkg -R basedir pkg set-property send-uuid True |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2242 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2243 |
return 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2244 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2245 |
_register_task(inspect.currentframe()) |
1447
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2246 |
cmd = '/usr/bin/pkg -R ' + self.basedir + ' property -H ' + \ |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2247 |
'publisher-search-order' |
897
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2248 |
status, co = _cmd_out(cmd) |
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2249 |
if status != 0: |
1447
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2250 |
prerror('pkg(1) failed to obtain list of publishers - ' |
897
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2251 |
'exit status = ' + str(status) + ', command was ' + cmd) |
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2252 |
prerror('Failure. Returning: ICT_PKG_RESET_UUID_FAILED') |
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2253 |
return ICT_PKG_RESET_UUID_FAILED |
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2254 |
|
1447
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2255 |
publisher_search_order = co[0].strip().split(None, 1) |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2256 |
# strip off the leading '[' and trailing ']' characters |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2257 |
for publisher in publisher_search_order[1:-1]: |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2258 |
# strip off any ' or , characters |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2259 |
publisher = publisher.strip("',") |
897
48ee5845f0d4
6991546 reset_image_uuid() assumes a publisher name of "opensolaris.org"
Jan Damborsky <dambi@opensolaris.org>
parents:
880
diff
changeset
|
2260 |
|
1447
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2261 |
cmd = 'pkg -R ' + self.basedir + \ |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2262 |
' set-publisher --reset-uuid --no-refresh ' + publisher |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2263 |
status = _cmd_status(cmd) |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2264 |
if status != 0: |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2265 |
prerror('Reset uuid failed for publisher: ' + publisher + |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2266 |
'- exit status = ' + str(status) + |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2267 |
', command was ' + cmd) |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2268 |
prerror('Failure. Returning: ICT_PKG_RESET_UUID_FAILED') |
f7571d01f887
Fix preferred publisher install errors
Jon Tibble <meths@btinternet.com>
parents:
1433
diff
changeset
|
2269 |
return ICT_PKG_RESET_UUID_FAILED |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
2270 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2271 |
cmd = 'pkg -R ' + self.basedir + ' set-property send-uuid True' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2272 |
status = _cmd_status(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2273 |
if status != 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2274 |
prerror('Set property send uuid - exit status = ' + str(status) + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2275 |
', command was ' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2276 |
prerror('Failure. Returning: ICT_PKG_SEND_UUID_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2277 |
return ICT_PKG_SEND_UUID_FAILED |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
2278 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2279 |
return 0 |
303
fca72b21f229
3887 be_unmount() fails with 4040 at the end of b99 GUI installation
Joseph J Vlcek <Joseph.Vlcek@Sun.COM>
parents:
272
diff
changeset
|
2280 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2281 |
def rebuild_pkg_index(self): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2282 |
'''ICT - rebuild pkg(1) index |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2283 |
launch pkg -R basedir rebuild-index |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2284 |
return 0 for success, otherwise error code |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2285 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2286 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2287 |
cmd = 'pkg -R ' + self.basedir + ' rebuild-index' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2288 |
status = _cmd_status(cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2289 |
if status == 0: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2290 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2291 |
prerror('Rebuild package index failed - exit status = ' + |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2292 |
str(status) + ', command was ' + cmd) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2293 |
prerror('Failure. Returning: ICT_REBUILD_PKG_INDEX_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2294 |
return ICT_REBUILD_PKG_INDEX_FAILED |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2295 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2296 |
def create_new_user(self, gcos, login, pw, gid, uid): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2297 |
'''ICT - create the new user. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2298 |
using IPS class PasswordFile from pkg.cfgfiles |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2299 |
It is possible no new user was requested. If none was |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2300 |
specified do nothing and return 0. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2301 |
return 0 on success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2302 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2303 |
_register_task(inspect.currentframe()) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2304 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2305 |
return_status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2306 |
_dbg_msg('creating new user on target: ' + self.basedir) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2307 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2308 |
if not login: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2309 |
_dbg_msg('No login specified') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2310 |
return return_status |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2311 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2312 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2313 |
pf = PasswordFile(self.basedir) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2314 |
nu = pf.getuser('nobody') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2315 |
nu['username'] = login |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2316 |
nu['gid'] = gid |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2317 |
nu['uid'] = uid |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2318 |
nu['gcos-field'] = gcos |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2319 |
nu['home-dir'] = '/home/' + login |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2320 |
nu['login-shell'] = '/bin/bash' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2321 |
nu['password'] = pw |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2322 |
pf.setvalue(nu) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2323 |
pf.writefile() |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2324 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2325 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2326 |
prerror('Failure to modify the root password') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2327 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2328 |
prerror('Failure. Returning: ICT_CREATE_NU_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2329 |
return_status = ICT_CREATE_NU_FAILED |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2330 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2331 |
return return_status |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2332 |
|
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2333 |
def set_homedir_map(self, login): |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2334 |
'''ICT - set the auto_home map entry on the specified install |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2335 |
target. |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2336 |
return 0 on success, error code otherwise |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2337 |
''' |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2338 |
_register_task(inspect.currentframe()) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2339 |
|
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2340 |
return_status = 0 |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2341 |
|
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2342 |
temp_file = '/var/run/new_auto_home' |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2343 |
|
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2344 |
if not login: |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2345 |
_dbg_msg('No login specified') |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2346 |
return return_status |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2347 |
|
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2348 |
_dbg_msg('setting home dir in auto_home map: ' + self.basedir) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2349 |
|
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2350 |
try: |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2351 |
with open(self.autohome, 'r') as fp: |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2352 |
autohome_lines = fp.readlines() |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2353 |
with open(temp_file, 'w') as fp_tmp: |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2354 |
for l in autohome_lines: |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2355 |
if l.startswith("+auto_home"): |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2356 |
fp_tmp.write(login + '\tlocalhost:/export/home/&\n') |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2357 |
fp_tmp.write(l) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2358 |
os.remove(self.autohome) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2359 |
shutil.move(temp_file, self.autohome) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2360 |
os.chmod(self.autohome, S_IREAD | S_IWRITE | S_IRGRP | S_IROTH) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2361 |
os.chown(self.autohome, 0, 2) # chown root:bin |
669
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2362 |
except IOError, (errno, strerror): |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2363 |
prerror('Failure to add line in auto_home file') |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2364 |
prerror(traceback.format_exc()) |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2365 |
prerror('Failure. Returning: ICT_SET_AUTOHOME_FAILED') |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2366 |
return_status = ICT_SET_AUTOHOME_FAILED |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2367 |
|
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2368 |
return return_status |
2a993be66d02
7880 image-update fails if boot directory doesn't already exist
Evan Layton <Evan.Layton@Sun.COM>
parents:
667
diff
changeset
|
2369 |
|
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2370 |
def set_root_password(self, newpw, expire=False): |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2371 |
'''ICT - set the root password on the specified install target. |
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2372 |
using IPS class PasswordFile from pkg.cfgfiles. Pre-expire password |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2373 |
if expire is True |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2374 |
return 0 on success, error code otherwise |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2375 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2376 |
_register_task(inspect.currentframe()) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2377 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2378 |
return_status = 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2379 |
_dbg_msg('setting root password on target: ' + self.basedir) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2380 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2381 |
try: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2382 |
pf = PasswordFile(self.basedir) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2383 |
ru = pf.getuser('root') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2384 |
ru['password'] = newpw |
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2385 |
if expire: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2386 |
ru['lastchg'] = 0 |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2387 |
pf.setvalue(ru) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2388 |
pf.writefile() |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2389 |
except StandardError: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2390 |
prerror('Failure to modify the root password') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2391 |
prerror(traceback.format_exc()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2392 |
prerror('Failure. Returning: ICT_SET_ROOT_PW_FAILED') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2393 |
return_status = ICT_SET_ROOT_PW_FAILED |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2394 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2395 |
return return_status |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2396 |
|
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2397 |
def apply_sysconfig_profile(self): |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2398 |
'''ICT - apply system configuration SMF profile to the target. |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2399 |
The SMF profile will be applied during first boot as part of |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2400 |
Early Manifest Import process. |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2401 |
|
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2402 |
Carry out only syntactic validation of SMF profile. |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2403 |
|
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2404 |
return 0 on success, error code otherwise |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2405 |
''' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2406 |
_register_task(inspect.currentframe()) |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2407 |
|
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2408 |
sc_profile_src = self.ai_sc_profile |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2409 |
sc_profile_dst = self.basedir + '/etc/svc/profile/' + \ |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2410 |
self.sc_profile |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2411 |
os.environ["SVCCFG_DTD"] = self.basedir + \ |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2412 |
'/usr/share/lib/xml/dtd/service_bundle.dtd.1' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2413 |
os.environ["SVCCFG_REPOSITORY"] = self.basedir + \ |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2414 |
'/etc/svc/repository.db' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2415 |
cmd = '/usr/sbin/svccfg apply -n ' + sc_profile_src + ' 2>&1' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2416 |
status, oa = _cmd_out(cmd) |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2417 |
|
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2418 |
if status == 0: |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2419 |
write_log(ICTID, 'Syntactic validation of System configuration ' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2420 |
'profile succeeded\n') |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2421 |
else: |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2422 |
prerror('Syntactic validation of System configuration profile ' |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2423 |
'failed. exit status=' + str(status)) |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2424 |
prerror('Command to validate configuration profile was: ' + cmd) |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2425 |
for ln in oa: |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2426 |
prerror(ln) |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2427 |
|
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2428 |
prerror('Failure. Returning: ICT_APPLY_SYSCONFIG_FAILED') |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2429 |
return ICT_APPLY_SYSCONFIG_FAILED |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2430 |
|
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2431 |
# copy SMF profile to the target and make sure it can be read only |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2432 |
# by root in order to protect encrypted password for configured |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2433 |
# root and user accounts |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2434 |
try: |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2435 |
shutil.copyfile(sc_profile_src, sc_profile_dst) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2436 |
os.chmod(sc_profile_dst, S_IRUSR) # read-only by user (root) |
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2437 |
os.chown(sc_profile_dst, 0, 3) # chown root:sys |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2438 |
|
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2439 |
except OSError, (errno, strerror): |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2440 |
prerror('Error when copying System Configuration profile ' + |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2441 |
sc_profile_src + ' to ' + sc_profile_dst + ' : ' + |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2442 |
strerror) |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2443 |
prerror('Failure. Returning: ICT_APPLY_SYSCONFIG_FAILED') |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2444 |
return ICT_APPLY_SYSCONFIG_FAILED |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2445 |
except StandardError: |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2446 |
prerror('Unexpected error when copying System Configuration ' + |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2447 |
' profile ' + sc_profile_src + ' to ' + sc_profile_dst) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2448 |
prerror(traceback.format_exc()) # traceback to stdout and log |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2449 |
prerror('Failure. Returning: ICT_APPLY_SYSCONFIG_FAILED') |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2450 |
return ICT_APPLY_SYSCONFIG_FAILED |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2451 |
|
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2452 |
return 0 |
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2453 |
|
861
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2454 |
def setup_rbac(self, login): |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2455 |
'''ICT - configure user for root role, without any extra profiles and |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2456 |
remove the jack user from user_attr |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2457 |
return 0 on success, error code otherwise |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2458 |
''' |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2459 |
_register_task(inspect.currentframe()) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2460 |
return_status = 0 |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2461 |
_dbg_msg('configuring RBAC in: ' + self.basedir) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2462 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2463 |
try: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2464 |
f = UserattrFile(self.basedir) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2465 |
# Remove jack if present |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2466 |
if f.getvalue({'username' : 'jack'}): |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2467 |
f.removevalue({'username' : 'jack'}) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2468 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2469 |
rootentry = f.getvalue({'username' : 'root'}) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2470 |
rootattrs = rootentry['attributes'] |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2471 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2472 |
# If we're creating a user, then ensure root is a role and |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2473 |
# add the user. Otherwise ensure that root is not a role. |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2474 |
if login: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2475 |
rootattrs['type'] = ['role'] |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2476 |
rootentry['attributes'] = rootattrs |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2477 |
f.setvalue(rootentry) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2478 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2479 |
# Attributes of a userattr entry are a dictionary of list values |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2480 |
userattrs = dict({'roles' : ['root']}) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2481 |
# An entry is a dictionary with username and attributes |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2482 |
userentry = dict({'username' : login, 'attributes' : userattrs}) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2483 |
f.setvalue(userentry) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2484 |
else: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2485 |
if 'type' in rootattrs: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2486 |
del rootattrs['type'] |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2487 |
rootentry['attributes'] = rootattrs |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2488 |
f.setvalue(rootentry) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2489 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2490 |
# Write the resulting file |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2491 |
f.writefile() |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2492 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2493 |
except StandardError: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2494 |
prerror('Failure to edit user_attr file') |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2495 |
prerror(traceback.format_exc()) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2496 |
prerror('Failure. Returning: ICT_SETUP_RBAC_FAILED') |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2497 |
return_status = ICT_SETUP_RBAC_FAILED |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2498 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2499 |
return return_status |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2500 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2501 |
def setup_sudo(self, login): |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2502 |
'''ICT - configure user for sudo access, removing jack user from sudoers |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2503 |
return 0 on success, error code otherwise |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2504 |
''' |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2505 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2506 |
_register_task(inspect.currentframe()) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2507 |
return_status = 0 |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2508 |
_dbg_msg('configuring RBAC in: ' + self.basedir) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2509 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2510 |
temp_file = '/var/run/sudoers' |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2511 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2512 |
try: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2513 |
with open(self.sudoers, 'r') as fp: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2514 |
sudoers_lines = fp.readlines() |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2515 |
with open(temp_file, 'w') as fp_tmp: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2516 |
for l in sudoers_lines: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2517 |
if not l.startswith("jack"): |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2518 |
fp_tmp.write(l) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2519 |
if login: |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2520 |
fp_tmp.write(login + ' ALL=(ALL) ALL\n') |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2521 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2522 |
os.remove(self.sudoers) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2523 |
shutil.move(temp_file, self.sudoers) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2524 |
os.chmod(self.sudoers, S_IREAD | S_IRGRP) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2525 |
os.chown(self.sudoers, 0, 0) # chown root:root |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2526 |
except IOError, (errno, strerror): |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2527 |
prerror('Failure to edit sudoers file') |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2528 |
prerror(traceback.format_exc()) |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2529 |
prerror('Failure. Returning: ICT_SETUP_SUDO_FAILED') |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2530 |
return_status = ICT_SETUP_SUDO_FAILED |
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2531 |
|
ccd399d2c6f7
6973927 Installation fails if Primary Administrator rights profile is removed from the system
David Miner <dminer@opensolaris.org>
parents:
860
diff
changeset
|
2532 |
return return_status |
846
70dd9e819f25
15723 - Teach AI to use new SMF based System Configuration framework for configuring user and root accounts
Jan Damborsky <jan.damborsky@sun.com>
parents:
840
diff
changeset
|
2533 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2534 |
def ict_test(self, optparm=None): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2535 |
'''ICT - ict test |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2536 |
This ict can be used to test the ICT object from the command line. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2537 |
It always returns 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2538 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2539 |
_register_task(inspect.currentframe()) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2540 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2541 |
info_msg('ict_test invoked') |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2542 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2543 |
info_msg('optparm: ' + str(optparm)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2544 |
info_msg('auto_install: ' + str(self.auto_install)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2545 |
info_msg('basedir: ' + str(self.basedir)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2546 |
info_msg('bootenvrc: ' + str(self.bootenvrc)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2547 |
info_msg('grubmenu: ' + str(self.grubmenu)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2548 |
info_msg('is_sparc: ' + str(self.is_sparc)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2549 |
info_msg('livecd_install: ' + str(self.livecd_install)) |
773
cc0753f47d02
6367 Provide a text-installer for opensolaris
Keith Mitchell <keith.mitchell@sun.com>
parents:
760
diff
changeset
|
2550 |
info_msg('text_install: ' + str(self.text_install)) |
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2551 |
info_msg('kbd_device: ' + str(self.kbd_device)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2552 |
info_msg('kbd_layout_file: ' + str(self.kbd_layout_file)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2553 |
info_msg('rootpool: ' + str(self.rootpool)) |
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2554 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2555 |
return 0 |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2556 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2557 |
#end Install Completion Tasks |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2558 |
|
872
8b098e92c2a9
6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents:
861
diff
changeset
|
2559 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2560 |
def exec_ict(ict_name, basedir, debuglvl=None, optparm=None): |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2561 |
'''run one ICT with a single command line using 'eval()' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2562 |
This will be called automatically if 2 or more command line arguments |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2563 |
are provided |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2564 |
ict_name - name of ICT in text string |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2565 |
basedir - root directory of target |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2566 |
debuglvl - logging service debugging level to override default |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2567 |
optparm - parameter passed to ict_name if required by ict_name |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2568 |
returns status of ict_name |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2569 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2570 |
info_msg('Executing ICT=' + str(ict_name) + ' basedir=' + str(basedir)) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2571 |
info_msg(' debuglvl=' + str(debuglvl) + ' optparm=' + str(optparm)) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2572 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2573 |
if debuglvl != None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2574 |
info_msg('setting debug level to' + debuglvl) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2575 |
myict = ICT(basedir, debuglvl) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2576 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2577 |
myict = ICT(basedir) |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2578 |
if optparm != None: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2579 |
status = eval('myict.' + ict_name + '(optparm)') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2580 |
else: |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2581 |
status = eval('myict.' + ict_name + '()') |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2582 |
sys.exit(status) |
229
9e8783c6042e
1040 post-installation phase should be redesigned
William Schumann <william.schumann@sun.com>
parents:
diff
changeset
|
2583 |
|
649
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2584 |
if __name__ == '__main__': |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2585 |
''' The script is launched in order to run an individual ICT. |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2586 |
|
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2587 |
Example command line: # python ict.py ict_test /a #runs test ICT |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2588 |
''' |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2589 |
# Invoke exec_ict() with the command line parameters, ignoring |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2590 |
# the first argument, which is always the script name (ict.py). |
ba353c37b287
12670 Change nested try/except in distro_const.py missed during 2.6 python porting
Clay Baenziger <ClayB@OpenSolaris.ORG>
parents:
619
diff
changeset
|
2591 |
exec_ict(*sys.argv[1:]) |