Skip to content

Commit

Permalink
Merge branch 'master' of git.rackster.ch:ipynbsrv/ipynbsrv
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Glatthard committed Aug 9, 2015
2 parents d0971a7 + 85786f3 commit 5ce286c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 33 deletions.
16 changes: 8 additions & 8 deletions ipynbsrv/admin/templates/admin/core/container/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ <h2>Actions</h2>
<fieldset class="module aligned ">
<h2>Status Actions</h2>
<div class="form-row">
{% if original.is_suspended %}
<input type="submit" value="{% trans 'Resume' %}" name="_resume" {{ onclick_attrib }} />
{% else %}
{% if original.is_running %}
<input type="submit" value="{% trans 'Restart' %}" name="_restart" {{ onclick_attrib }} />
<input type="submit" value="{% trans 'Stop' %}" name="_stop" {{ onclick_attrib }} />
<input type="submit" value="{% trans 'Suspend' %}" name="_suspend" {{ onclick_attrib }} />
{% if original.is_running %}
<input type="submit" value="{% trans 'Restart' %}" name="_restart" {{ onclick_attrib }} />
<input type="submit" value="{% trans 'Stop' %}" name="_stop" {{ onclick_attrib }} />
{% if original.is_suspended %}
<input type="submit" value="{% trans 'Resume' %}" name="_resume" {{ onclick_attrib }} />
{% else %}
<input type="submit" value="{% trans 'Start' %}" name="_start" {{ onclick_attrib }} />
<input type="submit" value="{% trans 'Suspend' %}" name="_suspend" {{ onclick_attrib }} />
{% endif %}
{% else %}
<input type="submit" value="{% trans 'Start' %}" name="_start" {{ onclick_attrib }} />
{% endif %}
</div>
</fieldset>
Expand Down
1 change: 0 additions & 1 deletion ipynbsrv/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@ def __unicode__(self):

class Meta:
unique_together = (
('backend_pk', 'server'),
('name', 'owner')
)

Expand Down
2 changes: 1 addition & 1 deletion ipynbsrv/core/signals/backend_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def create_on_internal_ldap(sender, user, **kwargs):
user.backend_pk,
user.django_user.password,
user.primary_group.backend_id,
'/home/user'
'/home/' + user.get_username()
)
# FIXME: this is the first time we really know the ID/PK given by the backend.
# all other operations having used to old ones might not be valid anymore...
Expand Down
2 changes: 1 addition & 1 deletion ipynbsrv/core/signals/container_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def delete_on_server(sender, image, **kwargs):
try:
# FIXME: isn't deleted....
backend = server.get_container_backend()
backend.delete_container_image(image.backend_pk, force=True)
backend.delete_container_image(image.backend_pk)
except ContainerImageNotFoundError:
pass # already removed
except ContainerBackendError as ex:
Expand Down
2 changes: 1 addition & 1 deletion ipynbsrv/core/signals/container_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def delete_on_server(sender, snapshot, **kwargs):
if snapshot is not None:
backend = snapshot.container.server.get_container_backend()
try:
backend.delete_container_snapshot(snapshot.backend_pk, force=True)
backend.delete_container_snapshot(snapshot.backend_pk)
except ContainerSnapshotNotFoundError as ex:
pass # already removed?
except ContainerBackendError as ex:
Expand Down
27 changes: 6 additions & 21 deletions ipynbsrv/core/signals/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ def create_on_server(sender, container, **kwargs):
result = None
try:
result = container.server.get_container_backend().create_container(
container.get_backend_name(),
container.owner.backend_pk,
container.owner.backend_id,
container.name,
ports,
[
{ # home directory
ContainerBackend.VOLUME_KEY_SOURCE: path.join(
path.join(storage_backend.base_dir, settings.STORAGE_DIR_HOME),
container.owner.backend_pk
),
ContainerBackend.VOLUME_KEY_TARGET: path.join('/home', 'user')
ContainerBackend.VOLUME_KEY_SOURCE: path.join(storage_backend.base_dir, settings.STORAGE_DIR_HOME),
ContainerBackend.VOLUME_KEY_TARGET: '/home'
},
{ # public directory
ContainerBackend.VOLUME_KEY_SOURCE: path.join(storage_backend.base_dir, settings.STORAGE_DIR_PUBLIC),
Expand Down Expand Up @@ -101,21 +100,7 @@ def delete_on_server(sender, container, **kwargs):
"""
if container is not None:
try:
if container.is_suspended():
container.resume()
except:
pass
try:
if container.is_running():
container.stop()
except:
pass

try:
container.server.get_container_backend().delete_container(
container.backend_pk,
force=True
)
container.server.get_container_backend().delete_container(container.backend_pk)
except ContainerNotFoundError as ex:
pass # already deleted
except ContainerBackendError as ex:
Expand Down

0 comments on commit 5ce286c

Please sign in to comment.