Merge lp:~joetalbott/utah/install_type into lp:utah

Proposed by Joe Talbott
Status: Merged
Approved by: Javier Collado
Approved revision: 665
Merged at revision: 668
Proposed branch: lp:~joetalbott/utah/install_type
Merge into: lp:utah
Diff against target: 175 lines (+24/-9)
6 files modified
client.py (+8/-2)
utah/client/result.py (+3/-1)
utah/client/runner.py (+3/-1)
utah/client/tests/test_runner.py (+5/-3)
utah/client/tests/test_state_agent.py (+2/-2)
utah/run.py (+3/-0)
To merge this branch: bzr merge lp:~joetalbott/utah/install_type
Reviewer Review Type Date Requested Status
Javier Collado (community) Approve
Max Brustkern (community) Approve
Joe Talbott Pending
Review via email: mp+121934@code.launchpad.net

This proposal supersedes a proposal from 2012-08-29.

Description of the change

This adds a --install-type option to the client to indicate the OS variant (i.e. desktop, server, mini, etc.)

Updated to use the machine's idea of installtype.

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote : Posted in a previous version of this proposal

Args may not include a type, but we'll still get a type when we install the machine. I'd recommend we setup the extraopts after machine.installclient() and use machine.installtype. Is there some way for me to attach a branch or a diff that reflects that?

Revision history for this message
Joe Talbott (joetalbott) wrote : Posted in a previous version of this proposal

I've updated my submission to match what I think Max was referring to.

review: Needs Resubmitting
Revision history for this message
Max Brustkern (nuclearbob) wrote :

Looks good to me.

review: Approve
Revision history for this message
Javier Collado (javier.collado) wrote :

Looks good to me too. With regard to the server, as long as `utah.iso.getinstalltype` does a good job, then the client should get the right type.

In addition to this, I ran a test with a quantal desktop iso and I saw the expected output with the right type in the console log:
INFO: Running command through SSH: utah --install-type desktop -r /tmp/default.run

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client.py'
2--- client.py 2012-08-28 11:22:41 +0000
3+++ client.py 2012-08-29 19:35:34 +0000
4@@ -33,6 +33,10 @@
5 default='yaml', help='Output format (default "yaml")')
6 parser.add_argument('-t', '--testdir',
7 default='/var/lib/utah', help='Main test directory')
8+ parser.add_argument('-i', '--install-type',
9+ choices=['desktop', 'server', 'mini', 'alternate'],
10+ default='desktop',
11+ help='Installation Variant (i.e. server, desktop, etc.)')
12 parser.add_argument('-r', '--runlist', type=url_argument,
13 # Having a default here means that if a resume happens
14 # post-reboot without a runlist specified, it will
15@@ -97,6 +101,7 @@
16 testdir = args.testdir
17 runlist = args.runlist
18 output = args.output
19+ install_type = args.install_type
20
21 if args.append:
22 open_flags = 'a'
23@@ -119,8 +124,9 @@
24
25 try:
26 state_agent = StateAgentYAML(state_file=state_file)
27- runner = Runner(state_agent=state_agent, result_class=result_class,
28- runlist=runlist, resume=resume, testdir=testdir)
29+ runner = Runner(install_type=install_type, state_agent=state_agent,
30+ result_class=result_class, runlist=runlist,
31+ resume=resume, testdir=testdir)
32 if resume:
33 runner.load_state()
34
35
36=== modified file 'utah/client/result.py'
37--- utah/client/result.py 2012-08-28 04:08:53 +0000
38+++ utah/client/result.py 2012-08-29 19:35:34 +0000
39@@ -40,7 +40,7 @@
40 Result collection class.
41 """
42 def __init__(self, name=None, testsuite=None, testcase=None,
43- runlist=None, publish_type=None):
44+ runlist=None, publish_type=None, install_type=None):
45 self.results = []
46 self.status = 'PASS'
47 self.name = name
48@@ -49,6 +49,7 @@
49 self.runlist = runlist
50 self.publish_type = publish_type
51 self.publish = None
52+ self.install_type = install_type
53
54 self.errors = 0
55 self.fetch_errors = 0
56@@ -166,6 +167,7 @@
57 'passes': self.passes,
58 'uname': list(host_info['uname']),
59 'media-info': host_info['media-info'],
60+ 'install_type': self.install_type,
61 }
62
63 if self.publish is not None:
64
65=== modified file 'utah/client/runner.py'
66--- utah/client/runner.py 2012-08-28 11:22:41 +0000
67+++ utah/client/runner.py 2012-08-29 19:35:34 +0000
68@@ -110,7 +110,7 @@
69 'required': True,
70 }
71
72- def __init__(self, runlist=None, result_class=Result,
73+ def __init__(self, install_type, runlist=None, result_class=Result,
74 testdir=UTAH_DIR, state_agent=None, resume=False):
75
76 # Runlist URL passed through the command line
77@@ -138,6 +138,7 @@
78 self.state_file = DEFAULT_STATE_FILE
79 self.fetched_suites = {}
80 self.timeout = None
81+ self.install_type = install_type
82
83 self.errors = 0
84 self.passes = 0
85@@ -164,6 +165,7 @@
86
87 self.process_master_runlist(resume=resume)
88 self.result.runlist = self.master_runlist
89+ self.result.install_type = self.install_type
90
91 def backup_rc_local(self):
92 """
93
94=== modified file 'utah/client/tests/test_runner.py'
95--- utah/client/tests/test_runner.py 2012-08-08 16:17:12 +0000
96+++ utah/client/tests/test_runner.py 2012-08-29 19:35:34 +0000
97@@ -20,7 +20,7 @@
98 self.result_class = ResultYAML
99 self.state_file = '/tmp/state.yaml'
100 self.state_agent = StateAgentYAML(state_file=self.state_file)
101- self.runner = Runner(result_class=self.result_class,
102+ self.runner = Runner(install_type='desktop', result_class=self.result_class,
103 state_agent=self.state_agent)
104 self.bad_dir = "/tmp/does_not_exist"
105
106@@ -53,7 +53,7 @@
107 fp.write(bad_runlist_content)
108 fp.close()
109
110- runner = Runner(result_class=self.result_class,
111+ runner = Runner(install_type='desktop', result_class=self.result_class,
112 state_agent=self.state_agent, runlist=runlist)
113
114 # remove the runlist as early as possible to avoid leaving it
115@@ -88,6 +88,7 @@
116 """
117 self.assertRaises(exceptions.BadDir,
118 Runner,
119+ install_type="desktop",
120 result_class=self.result_class,
121 testdir=self.bad_dir)
122
123@@ -107,6 +108,7 @@
124
125 self.assertRaises(exceptions.MissingFile,
126 Runner,
127+ install_type="desktop",
128 result_class=self.result_class,
129 runlist=tmp_master_runlist,
130 testdir=self.bad_dir)
131@@ -121,7 +123,7 @@
132 fp.write(master_runlist_content)
133 fp.close()
134
135- runner = Runner(result_class=self.result_class, runlist=runlist)
136+ runner = Runner(install_type='desktop', result_class=self.result_class, runlist=runlist)
137 runner.save_state()
138
139 print("tests: {}".format(runner.count_tests()))
140
141=== modified file 'utah/client/tests/test_state_agent.py'
142--- utah/client/tests/test_state_agent.py 2012-08-08 16:17:12 +0000
143+++ utah/client/tests/test_state_agent.py 2012-08-29 19:35:34 +0000
144@@ -80,7 +80,7 @@
145 "state file (%s) already exists" % self.state_file)
146
147 self.state_agent = StateAgentYAML(state_file=self.state_file)
148- self.runner = Runner(result_class=ResultYAML,
149+ self.runner = Runner(install_type="desktop", result_class=ResultYAML,
150 state_agent=self.state_agent)
151 self.partial_state_file_content = partial_state_file_content
152
153@@ -158,7 +158,7 @@
154 shutil.copytree(test_src, test_dir)
155
156 state_agent = StateAgentYAML(state_file=self.state_file)
157- runner = Runner(state_agent=state_agent, resume=True)
158+ runner = Runner(install_type="desktop", state_agent=state_agent, resume=True)
159 runner.load_state()
160
161 self.assertEqual(runner.status, 'RUN')
162
163=== modified file 'utah/run.py'
164--- utah/run.py 2012-08-28 15:35:55 +0000
165+++ utah/run.py 2012-08-29 19:35:34 +0000
166@@ -30,6 +30,9 @@
167 exitstatus = 0
168
169 machine.installclient()
170+
171+ extraopts += " --install-type " + machine.installtype
172+
173 for runlist in args.runlists:
174 locallist = urllib.urlretrieve(runlist)[0]
175 machine.uploadfiles([locallist], os.path.normpath('/tmp'))

Subscribers

People subscribed via source and target branches