Added logging to freezer-web-ui

Change-Id: Ifae0268dec14135bc1c2bfcdbb1b3d59c5f17eea
changes/78/236878/3
memo 2015-10-19 10:58:02 +01:00
parent 2eae6f6990
commit 84d27a6e41
12 changed files with 56 additions and 6 deletions

View File

@ -14,10 +14,9 @@
# from horizon.
import warnings
import logging
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from horizon.utils import functions as utils
from horizon.utils.memoized import memoized # noqa
@ -35,15 +34,18 @@ from freezer_ui.utils import create_dummy_id
from freezer_ui.utils import assign_value_from_source
LOG = logging.getLogger(__name__)
@memoized
def get_hardcoded_url():
"""Get FREEZER_API_URL from local_settings.py"""
try:
warnings.warn(_('Using hardcoded FREEZER_API_URL at {0}')
.format(settings.FREEZER_API_URL))
LOG.warn('Using hardcoded FREEZER_API_URL at {0}'
.format(settings.FREEZER_API_URL))
return getattr(settings, 'FREEZER_API_URL', None)
except (AttributeError, TypeError):
warnings.warn(_('No FREEZER_API_URL was found in local_settings.py'))
LOG.warn('No FREEZER_API_URL was found in local_settings.py')
raise

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from django.core.urlresolvers import reverse
from django.utils import safestring
@ -19,6 +20,9 @@ from horizon import tables
from freezer_ui.utils import timestamp_to_string
LOG = logging.getLogger(__name__)
class Restore(tables.LinkAction):
name = "restore"
verbose_name = _("Restore")

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import datetime
import pprint
@ -27,6 +28,9 @@ from freezer_ui.backups.workflows import restore as restore_workflow
import freezer_ui.api.api as freezer_api
LOG = logging.getLogger(__name__)
class IndexView(tables.DataTableView):
name = _("Backups")
slug = "backups"
@ -42,7 +46,6 @@ class DetailView(generic.TemplateView):
template_name = 'freezer_ui/backups/detail.html'
def get_context_data(self, **kwargs):
backup = freezer_api.backup_get(self.request, kwargs['backup_id'])
return {'data': pprint.pformat(backup.data_dict)}

View File

@ -11,6 +11,8 @@
# under the License.
import logging
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
@ -21,6 +23,9 @@ from horizon import workflows
import freezer_ui.api.api as freezer_api
LOG = logging.getLogger(__name__)
class DestinationAction(workflows.MembershipAction):
path = forms.CharField(label=_("Destination Path"),
help_text=_("The path in which the backup should be"

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import datetime
from django import shortcuts
from django.utils import safestring
@ -24,6 +25,9 @@ import freezer_ui.api.api as freezer_api
from freezer_ui.utils import timestamp_to_string
LOG = logging.getLogger(__name__)
def format_last_backup(last_backup):
last_backup_ts = datetime.datetime.fromtimestamp(last_backup)
ten_days_later = last_backup_ts + datetime.timedelta(days=10)

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse_lazy
@ -26,6 +28,9 @@ import workflows.configure as configure_workflow
import workflows.action as action_workflow
LOG = logging.getLogger(__name__)
class JobWorkflowView(workflows.WorkflowView):
workflow_class = configure_workflow.ConfigureJob

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from django.utils.translation import ugettext_lazy as _
from horizon import workflows
from horizon import exceptions
@ -17,6 +19,9 @@ from horizon import forms
import freezer_ui.api.api as freezer_api
LOG = logging.getLogger(__name__)
class ActionConfigurationAction(workflows.Action):
action = forms.ChoiceField(
help_text=_("Set the action to be taken"),

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from collections import namedtuple
import datetime
@ -24,6 +26,9 @@ import freezer_ui.api.api as freezer_api
from freezer_ui.utils import actions_in_job
LOG = logging.getLogger(__name__)
class ActionsConfigurationAction(workflows.Action):
pass

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
@ -20,6 +21,9 @@ from horizon.utils.urlresolvers import reverse
import freezer_ui.api.api as freezer_api
LOG = logging.getLogger(__name__)
def get_link(session):
return reverse('horizon:freezer_ui:sessions:index',
kwargs={'session_id': session.session_id})

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
@ -25,6 +26,9 @@ import freezer_ui.api.api as freezer_api
from freezer_ui.utils import SessionJob
LOG = logging.getLogger(__name__)
class AttachToSessionWorkflow(workflows.WorkflowView):
workflow_class = attach.AttachJobToSession

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
@ -19,6 +21,9 @@ from horizon import workflows
import freezer_ui.api.api as freezer_api
LOG = logging.getLogger(__name__)
class SessionConfigurationAction(workflows.Action):
session_id = forms.ChoiceField(
help_text=_("Set a session to attach this job"),

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import datetime
from django.utils.translation import ugettext_lazy as _
@ -21,6 +22,9 @@ from horizon import workflows
import freezer_ui.api.api as freezer_api
LOG = logging.getLogger(__name__)
class SessionConfigurationAction(workflows.Action):
description = forms.CharField(
label=_("Session Name"),