Skip to content

Commit

Permalink
Bug fix for v1.3.0 and using Netbox instead of local database
Browse files Browse the repository at this point in the history
  • Loading branch information
matt852 committed Jan 15, 2018
1 parent a4730c0 commit 08e86be
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/scripts_bank/db_modifyDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def retrieveHostByID(x):
host = models.Host.query.filter_by(id=x).first()
elif app.config['DATALOCATION'] == 'netbox':
host = netboxAPI.getHostByID(x)
# Local credentials with Netbox is not currently supported, so we manually set it to False here.
host.local_creds = False

return host

Expand Down
10 changes: 10 additions & 0 deletions app/static/js/dcimnetbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$(document).ready(function() {
var events = $('#events');
var table = $('#tblDCIMNetbox').DataTable({
"pageLength": 10,
"lengthMenu": [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
]
});
});
1 change: 1 addition & 0 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
{% if request.path == "/db/viewhosts" or request.path == "/db/viewhosts/" %}
<script src="{{url_for('static', filename='js/viewhosts.js')}}"></script>
<script src="{{url_for('static', filename='js/localcredentials.js')}}"></script>
<script src="{{url_for('static', filename='js/dcimnetbox.js')}}"></script>
{% elif "/db/viewhosts/" in request.path %}
<script src="{{url_for('static', filename='js/hostshell.js')}}"></script>
<script src="{{url_for('static', filename='js/viewspecifichost.js')}}"></script>
Expand Down
4 changes: 1 addition & 3 deletions app/templates/dcimnetbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h2 class="text-primary">View All Devices</h2>
<h4>All devices pulled from Netbox</h4>

<div class="table-responsive">
<table id="tblViewHosts" class="table table-striped table-hover table-condensed display">
<table id="tblDCIMNetbox" class="table table-striped table-hover table-condensed display">
<thead>
<tr>
<th>Hostname</th>
Expand Down Expand Up @@ -50,6 +50,4 @@ <h4>All devices pulled from Netbox</h4>
</div>
</div>

{% include "/js/datatables_custom_js.html" %}

{% endblock %}
7 changes: 4 additions & 3 deletions app/templates/errors/500.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% extends 'base.html' %}
{% block content %}
<h1>500 ERROR PAGE</h1>
{% if session['DEBUG'] %}
<p>{{ error }}</p>
{% endif %}
<br />
<p>Try logging out and logging back in. If that still doesn't resolve the issue, contact your NetConfig administrator</p>
<br />
<p>If accessing a device using local credentials, verify you entered the login password and the privileged/enable password correctly.
<br />
If the device requires a privileged/enable level password, one MUST be entered in order to access the device.</p>
{% endblock %}
2 changes: 0 additions & 2 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,6 @@ def viewSpecificHost(x):
activeSession = retrieveSSHSession(host)
writeToLog('credentials used of currently logged in user for accessing host %s' % (host.hostname))

# activeSession = retrieveSSHSession(host)

tableHeader, interfaces = host.pull_host_interfaces(activeSession)

if interfaces:
Expand Down

0 comments on commit 08e86be

Please sign in to comment.