clean up subiquity internals a bit #167

Merged
merged 7 commits into from Sep 29, 2016

Conversation

Projects
None yet
2 participants
Collaborator

mwhudson commented Sep 27, 2016

The main change is moving the signal->method mapping to the controller which makes sooo much more sense to me. More cleanup to come, but it's late and I'm off tomorrow so sending this along.

mwhudson added some commits Sep 27, 2016

completely separate menu -> signal and signal -> method mappings
and put the signal -> method mapping into the controller

this breaks the subiquity part even more than before, but it's pretty broken
already.
fix subiquity bits again
back to the same level of broken
move logic from identity/login views into identity controller
This was what I wanted to do before I got distracted by the other things.
console_conf/controllers/identity.py
+ result = {
+ 'realname': email,
+ 'username': email,
+ 'passwod': '',
@warsaw

warsaw Sep 27, 2016

"password" perhaps?

console_conf/controllers/identity.py
+ result = {
+ 'realname': email,
+ 'username': data['username'],
+ 'passwod': '',
@warsaw

warsaw Sep 27, 2016

"password" perhaps?

Although now that I've read more of the old code below, I see the field used to be 'passwod' so you're not changing that. Why the deliberate mispelling? Perhaps a comment would be helpful to explain what's going on here?

@mwhudson

mwhudson Sep 28, 2016

Collaborator

Yeah, I presume this is an irrelevant typo that can be fixed but I haven't checked. All this code is nonsense anyway.

@mwhudson

mwhudson Sep 29, 2016

Collaborator

Actually it can just be deleted so I've done that.

- "Identity": None,
- "Login": None,
- }
+ controllers = [
@warsaw

warsaw Sep 27, 2016

I don't know the code, but I notice that this is changing a dict with None values to a list. If order doesn't matter, perhaps a set would work better?

@mwhudson

mwhudson Sep 28, 2016

Collaborator

The order does matter here, perhaps I should explain that :)

@@ -23,6 +23,13 @@
class CephDiskController(BaseController):
+ signals = [
@warsaw

warsaw Sep 27, 2016

I don't know how the code is used, but would a dictionary be better here... and below?

@mwhudson

mwhudson Sep 28, 2016

Collaborator

Possibly, this reflects the API of urwid.connect_signal more closely, which is what all this signal stuff backs onto. I may attempt to delete all the signal stuff in favour of calling methods on objects fairly soon...

subiquitycore/core.py
- self.set_alarm_in(0.05, self.welcome)
- for k in self.controllers.keys():
+ self.set_alarm_in(0.05, self.next_screen)
+ for k in self.common['controllers'].keys():
@warsaw

warsaw Sep 27, 2016

Of course, if self.common['controllers'] is a dictionary, you don't need .keys() since that's the default iteration strategy for dictionaries.

@mwhudson

mwhudson Sep 28, 2016

Collaborator

True!

I'm not really familiar with the code, but I added a few comments on things that stood out to me.

Collaborator

mwhudson commented Sep 28, 2016

Thanks for the comments. I think the codebase is a bit over-designed at present, I'd love your opinion on general structure too!

@mwhudson mwhudson merged commit caa1120 into master Sep 29, 2016

@mwhudson mwhudson deleted the mwhudson/tech-debt-2 branch Sep 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment