def network(request): """This calls the TSQuery, TSstaticip and TSproxy scripts to query/update the networking configuration. """ if request.method == "POST" and "network-mode" in request.POST: form = NetworkConfigForm(request.POST, prefix="network") if form.is_valid(): # TS* is updated by the form controller NetworkConfigForm form.save() else: logger.warning("User entered invalid network settings:\n%s" % str(form.errors)) return HttpResponseRedirect("/admin/network/") else: form = NetworkConfigForm(prefix="network") return render_to_response( "admin/network.html", RequestContext( request, { "network": { "mac": mac_address(), "form": form }, "is_TsVm": is_TsVm() }, ), )
def gethostname(): '''Returns hostname of server, or if its a TsVm (S5 virtual machine) it returns the hostname of the instrument host server''' if is_TsVm(): ipaddr = instrument_host_ip() hostname, _, _ = socket.gethostbyaddr(ipaddr) else: hostname = socket.gethostname() return hostname
def gethostname(): '''Returns hostname of server, or if its a TsVm (S5 virtual machine) it returns the hostname of the instrument host server''' if is_TsVm(): ipaddr = instrument_host_ip() try: hostname, _, _ = socket.gethostbyaddr(ipaddr) except: hostname = 'tsvm' else: hostname = socket.gethostname() return hostname
def gethostname(): """Returns hostname of server, or if its a TsVm (S5 virtual machine) it returns the hostname of the instrument host server""" if is_TsVm(): ipaddr = instrument_host_ip() try: hostname, _, _ = socket.gethostbyaddr(ipaddr) except Exception: hostname = "tsvm" else: hostname = socket.gethostname() return hostname
def gethostip(): '''Returns IP address of server, or if its a TsVm (S5 virtual machine) it returns the IP of the instrument host server''' if is_TsVm(): ipaddr = instrument_host_ip() else: # Filched from # http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: # doesn't even have to be reachable s.connect(('10.255.255.255', 0)) ipaddr = s.getsockname()[0] except: ipaddr = '127.0.0.1' finally: s.close() return ipaddr
def network(request): """This calls the TSQuery, TSstaticip and TSproxy scripts to query/update the networking configuration. """ if request.method == "POST" and "network-mode" in request.POST: form = NetworkConfigForm(request.POST, prefix="network") if form.is_valid(): # TS* is updated by the form controller NetworkConfigForm form.save() else: logger.warning("User entered invalid network settings:\n%s" % str(form.errors)) return HttpResponseRedirect("/admin/network/") else: form = NetworkConfigForm(prefix="network") return render_to_response("admin/network.html", RequestContext(request, {"network": {"mac": mac_address(), "form": form}, "is_TsVm": is_TsVm()}))
name="configure_server"), url(r'^admin/tsvm/$', 'iondb.rundb.admin.tsvm_control', name="tsvm"), url(r'^admin/tsvm/(?P<action>\w+)/$', 'iondb.rundb.admin.tsvm_control', name="tsvm"), url(r'^admin/tsvm_log/(.+)/$', 'iondb.rundb.admin.tsvm_get_log', name="tsvm_log"), # password change doesn't accept extra_context (r'^admin/password_change/done/', admin.site.password_change_done), (r'^admin/password_change/', admin.site.password_change), (r'^admin/logout/', admin.site.logout), (r'^admin/$', admin.site.index, { 'extra_context': { 'is_VM': is_TsVm() } }), (r'^admin/(?P<app_label>\w+)/$', admin.site.app_index, { 'extra_context': { 'is_VM': is_TsVm() } }), (r'^admin/', include(admin.site.urls)), (r'^(?P<urlpath>output.*)$', serve_wsgi_location), (r'^(?P<urlpath>chef_logs.*)$', serve_wsgi_location), (r'^(?P<urlpath>ot_logs.*)$', serve_wsgi_location), ) urlpatterns.extend(login_patterns) urlpatterns.extend(staticfiles_urlpatterns())
name="configure_server", ), url(r"^admin/tsvm/$", "iondb.rundb.admin.tsvm_control", name="tsvm"), url(r"^admin/tsvm/(?P<action>\w+)/$", "iondb.rundb.admin.tsvm_control", name="tsvm"), url(r"^admin/tsvm_log/(.+)/$", "iondb.rundb.admin.tsvm_get_log", name="tsvm_log"), # password change doesn't accept extra_context (r"^admin/password_change/done/", admin.site.password_change_done), (r"^admin/password_change/", admin.site.password_change), (r"^admin/logout/", admin.site.logout), (r"^admin/$", admin.site.index, { "extra_context": { "is_VM": is_TsVm() } }), ( r"^admin/(?P<app_label>\w+)/$", admin.site.app_index, { "extra_context": { "is_VM": is_TsVm() } }, ), (r"^admin/", include(admin.site.urls)), (r"^(?P<urlpath>output.*)$", serve_wsgi_location), (r"^(?P<urlpath>chef_logs.*)$", serve_wsgi_location), (r"^(?P<urlpath>ot_logs.*)$", serve_wsgi_location),
(r'^admin/updateOneTouch/ot_log$', 'iondb.rundb.admin.ot_log'), (r'^admin/update/install_log$', 'iondb.rundb.admin.install_log'), (r'^admin/update/install_lock$', 'iondb.rundb.admin.install_lock'), (r'^admin/update/version_lock/(?P<enable>[\w\.]+)', 'iondb.rundb.admin.version_lock'), (r'^admin/update/maintenance/(?P<action>[\w\.]+)', 'iondb.rundb.admin.maintenance'), (r'^admin/experiment/exp_redo_from_scratch/$', 'iondb.rundb.admin.exp_redo_from_scratch'), url(r'^admin/configure_server/$', 'iondb.rundb.admin.configure_server', name="configure_server"), url(r'^admin/tsvm/$', 'iondb.rundb.admin.tsvm_control', name="tsvm"), url(r'^admin/tsvm/(?P<action>\w+)/$', 'iondb.rundb.admin.tsvm_control', name="tsvm"), url(r'^admin/tsvm_log/(.+)/$', 'iondb.rundb.admin.tsvm_get_log', name="tsvm_log"), # password change doesn't accept extra_context (r'^admin/password_change/done/', admin.site.password_change_done), (r'^admin/password_change/', admin.site.password_change), (r'^admin/logout/', admin.site.logout), (r'^admin/$', admin.site.index, {'extra_context': {'is_VM': is_TsVm() }}), (r'^admin/(?P<app_label>\w+)/$', admin.site.app_index, {'extra_context': {'is_VM': is_TsVm() }}), (r'^admin/', include(admin.site.urls)), (r'^(?P<urlpath>output.*)$', serve_wsgi_location), (r'^(?P<urlpath>chef_logs.*)$', serve_wsgi_location), (r'^(?P<urlpath>ot_logs.*)$', serve_wsgi_location), ) urlpatterns.extend(login_patterns) urlpatterns.extend(staticfiles_urlpatterns()) if settings.TEST_INSTALL: from os import path urlpatterns.extend(patterns( '', (r'^site_media/(?P<path>.*)$',
(r'^admin/updateOneTouch/$', 'iondb.rundb.admin.updateOneTouch'), (r'^admin/updateOneTouch/ot_log$', 'iondb.rundb.admin.ot_log'), (r'^admin/update/install_log$', 'iondb.rundb.admin.install_log'), (r'^admin/update/install_lock$', 'iondb.rundb.admin.install_lock'), (r'^admin/update/version_lock/(?P<enable>[\w\.]+)', 'iondb.rundb.admin.version_lock'), (r'^admin/update/maintenance/(?P<action>[\w\.]+)', 'iondb.rundb.admin.maintenance'), (r'^admin/experiment/exp_redo_from_scratch/$', 'iondb.rundb.admin.exp_redo_from_scratch'), url(r'^admin/tsvm/$', 'iondb.rundb.admin.tsvm_control', name="tsvm"), url(r'^admin/tsvm/(?P<action>\w+)/$', 'iondb.rundb.admin.tsvm_control', name="tsvm"), url(r'^admin/tsvm_log/(.+)/$', 'iondb.rundb.admin.tsvm_get_log', name="tsvm_log"), # password change doesn't accept extra_context (r'^admin/password_change/done/', admin.site.password_change_done), (r'^admin/password_change/', admin.site.password_change), (r'^admin/logout/', admin.site.logout), (r'^admin/$', admin.site.index, {'extra_context': {'is_VM': is_TsVm() }}), (r'^admin/(?P<app_label>\w+)/$', admin.site.app_index, {'extra_context': {'is_VM': is_TsVm() }}), (r'^admin/', include(admin.site.urls)), (r'^(?P<urlpath>output.*)$', serve_wsgi_location), (r'^(?P<urlpath>chef_logs.*)$', serve_wsgi_location), (r'^(?P<urlpath>ot_logs.*)$', serve_wsgi_location), ) urlpatterns.extend(login_patterns) urlpatterns.extend(staticfiles_urlpatterns()) if settings.TEST_INSTALL: from os import path urlpatterns.extend(patterns( '', (r'^site_media/(?P<path>.*)$',