Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to multiple School Server easily #679

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Connect to multiple School Server easily #679

wants to merge 3 commits into from

Conversation

mpdmanash
Copy link
Contributor

@mpdmanash mpdmanash commented Apr 16, 2016

Issue: As mentioned in the bug [1].
It is difficult to connect a Sugar device to multiple school servers because
the user is required to perform few manual steps to clear a previous
registration. Also, new registration is performed even when a laptop
tries to connect to an school server, where it has already registered
previously. This caused the original backup-url and back-up path to
change on the server causing inefficiency.

Solution: The solution involves a few automated checks and tasks that
are performed to overwrite new registration details, store previous
registration details and restore the details is an old server is connected.

UI: Just the 'Register' and 'Register again' button are replaced with
a single 'Connect to server' button on the FavouriteView desktop. It was
done to provide a non confusing simple and constant button to the user, as
his/her final motive is to get Sugar settings configured with the server
regardless of the fact that it is registering, registering again or
simply restoring settings of previous registration. Also it will mark
the change in the background functionality.

Server: I tried it on XSCE School Server release-6.0 on a CentOS7 machine.
No server side modification was done to achive it apart from enabling
'Services for XO Laptops such as Registration, Backup, and Activity Server'
in 'Configure' section of schoolserver admin. (http://schoolserver/admin/)
I used webpage available at schoolserver:5000 prvided by xs-authserver,
where the list of registered laptops are present.

Here is a related feature page for details of this enhancement [2].

A link to the starting of a discussion thread about this feature. [3].

[1] https://bugs.sugarlabs.org/ticket/362
[2] https://wiki.sugarlabs.org/go/Features/Multi_XS-server_registration
[3] https://wiki.sugarlabs.org/go/Features/Multiple_schoolserver_registration

@mpdmanash
Copy link
Contributor Author

mpdmanash commented Apr 16, 2016

The feature at present:
sugar-server-present

This patch follows the following flow :)
sugar-server-modified

The main advantages of the above flow according to me are:

  • Manual clear of registration is not required.
  • Each laptop will have same backup url and backup path (in XSCE:/library/users) for a particular XSCE as it was created on first registration with the server. As registration will be done only once. The "Register" button would rather say "Connect to Server". When user connects to an XSCE where it has registered previously (identified by the presence of pubkey), it would simply set its serial number, uuid and backup-url with the pre-registration data. This would enable better and advanced management of backups. (Currently only supported on XSCE due to the presence of xs-authserver)
  • No extra input is required from the user. The user just has to connect to the school server network, specify the jabber-server address and click on "Connect to server" as before.

@mpdmanash
Copy link
Contributor Author

Better known_host handling has been added. Please check 9307267

@mpdmanash mpdmanash changed the title Connect to multiple XS server easily, fixes #362 Connect to multiple School Server easily, fixes #362 Apr 17, 2016
@mpdmanash mpdmanash changed the title Connect to multiple School Server easily, fixes #362 Connect to multiple School Server easily Apr 17, 2016
@mpdmanash
Copy link
Contributor Author

Multiple commits squashed into one.
Please review and comment.

def _get_history_for_serial(serial_number):
identifier_path = os.path.join(env.get_profile_path(), 'identifiers')
if not os.path.exists(identifier_path):
os.mkdir(identifier_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three lines are duplicate of code in _store_identifiers, please refactor.

@quozl
Copy link
Contributor

quozl commented Apr 21, 2016

Several typos in commit message, please spell check.

Issue: As mentioned in the bug [1].
It is difficult to connect a Sugar device to multiple XS servers because
the user is required to perform few manual steps to clear a previous
registration. Also, new registration is performed even  when a laptop
tries to connect to an XS server, where it has already registered
previously. This caused the original backup-url and back-up path to
change on the server causing inefficiency.

Solution: The solution involves a few automated checks and tasks that
are performed to overwrite new registration details, store previous
registration details and restore the details is an old server is connected.
All GConf variables used by ds-backup are also updated with the server and
registration details. The identity of the server is added to known_hosts
file on successful registration to avoid ssh verification errors.

Server: I tried it on XSCE School Server release-6.0 on a CentOS7 machine.
No server side modification was done to archive it apart from enabling
'Services for XO Laptops such as Registration, Backup, and Activity Server'
in 'Configure' section of schoolserver admin. (http://schoolserver/admin/)
I used webpage available at schoolserver:5000 provided by xs-authserver,
where the list of registered laptops are present.

Here is a related feature page for details of this enhancement [2].

A link to the starting of a discussion thread about this feature. [3].

[1] https://bugs.sugarlabs.org/ticket/362
[2] https://wiki.sugarlabs.org/go/Features/Multi_XS-server_registration
[3] http://lists.sugarlabs.org/archive/sugar-devel/2016-April/051800.html
@mpdmanash
Copy link
Contributor Author

@quozl Thanks for the in depth review and guidance. I have refactored the code and removed typos in commit message.

@quozl
Copy link
Contributor

quozl commented Apr 21, 2016

No worries, glad to be of help. I've not reviewed your latest. Best of luck.

@mpdmanash
Copy link
Contributor Author

Please review

raise RegisterError(_('The server could not complete the request.'))

settings.set_string('jabber-server', data['jabberserver'])
response = urllib2.urlopen(db_url)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use libsoup for opening urls. Libsoup properly intergrates with the gobject mainloop; so that the ui is still responsive while we wait on the network.

Lib soup has documentation, but you can probs just copy some code from my reddit client; https://github.com/samdroid-apps/something-for-reddit/blob/master/src/api.py#L182

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samdroid-apps Please review

@mpdmanash
Copy link
Contributor Author

Replaced urllib2 by libsoup. Shall I squash the commits to one?

@rhl-bthr
Copy link

I don't have means to test this. Can someone review it again? (@samdroid-apps @quozl)

@quozl
Copy link
Contributor

quozl commented Jan 11, 2019

I don't either. I'm also not sure if the school server has the capacity to interact with Sugar. Perhaps @iiab has some way to test. They do have the pre-requisites listed, found in code search;

Next step on this pull request is to resolve the conflicts by rebasing the patch.

@tony37
Copy link

tony37 commented Jan 11, 2019 via email

@quozl
Copy link
Contributor

quozl commented Jan 11, 2019

Thanks Tony. Was the change to Sugar by OLE Nepal distributed generally to end users? If so, please point us at the source code?

@tony37
Copy link

tony37 commented Jan 11, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants