This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/subnets/edit/<int:subnetid>', methods=['GET', 'POST']) | |
def subnets_edit(subnetid): | |
target = Subnet.query.get(subnetid) | |
form = subnet.SubnetForm(obj=target) | |
if form.validate_on_submit(): | |
try: | |
ipaddress.IPv4Network(form.subnet.data.decode()) | |
except ipaddress.AddressValueError as e: | |
flash(u"Error in address: {}".format(e.message), category='danger') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block title %}VS VLAN DB - Reports{% endblock %} | |
{% block css %} | |
<link href="{{url_for('static', filename='assests/css/nv.d3.min.css')}}" rel="stylesheet"> | |
<style type="text/css"> | |
/*#chart .pie { | |
width: 300px; | |
height: 300px; | |
}*/ | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ env/bin/behave -kt organisation -t save | |
Feature: Portal Showback Database Models # features/portaldatabase.feature:1 | |
@organisation @save | |
Scenario Outline: I want to save a new organisation # features/portaldatabase.feature:45 | |
Given i have a new organisation, "Crilly Ltd" # features/steps/portaldatabase.py:9 0.000s | |
When i create a new organisation object # features/steps/portaldatabase.py:14 0.001s | |
And i have an organisation model back called "<Organisation: Crilly Ltd>" # features/steps/portaldatabase.py:73 0.000s | |
And i save the organisation object to the database # features/steps/portaldatabase.py:132 0.008s | |
And i query the database for the organisation "Crilly Ltd" # features/steps/portaldatabase.py:61 0.002s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Portal Showback Database Models | |
# Creating models | |
@organisation @create | |
Scenario Outline: I want to create a new organisation | |
Given i have a new organisation, <Org Name> | |
When i create a new organisation object | |
Then i will have an organisation model back called <Org Object Name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread Thread-20: | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner | |
self.run() | |
File "/home/movedx/Documents/Git/project-showback/showback/endpoints.py", line 42, in run | |
self.compute_stats(device) | |
File "/home/movedx/Documents/Git/project-showback/showback/endpoints.py", line 58, in compute_stats | |
if not self.db.query(CPUStatistic).filter(CPUStatistic.epoch==epoch).filter(CPUStatistic.device==device).first(): | |
File "/home/movedx/Documents/Git/project-showback/env/local/lib/python2.7/site-packages/sqlalchemy/sql/operators.py", line 296, in __eq__ | |
return self.operate(eq, other) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db_engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI']) | |
dbo = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=db_engine)) | |
class ThreadedCollector(threading.Thread): | |
def __init__(self, collector, queue): | |
self.collector = collector | |
self.queue = queue | |
threading.Thread.__init__(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def worker_callback(self, ch, method, properties, body): | |
if self.debugging: logging.debug("Worker received work: {0}".format(body)) | |
work = json.loads(body) | |
device = Device.query.filter_by(name=work['description']).first() | |
if not device: | |
if self.debugging: | |
logging.error("Failed to find device in database: {0}. Message will be acknowledged.".format(work['description'])) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: puppetmasters | |
remote_user: user | |
sudo: true | |
vars: | |
development_path: "/home/movedx/Documents/Git" | |
remote_path: "/etc/puppet/modules" | |
tasks: | |
- name: Push the module to the remove Puppet Master(s) | |
synchronize: src={{development_path}}/{{module_name}}/. dest={{remote_path}}/{{module_name}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./deploy_module core ssh | |
PLAY [puppetmasters] ********************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [a.b.c.d] | |
TASK: [Push the module to the remote Puppet Master(s)] ************************ | |
changed: [a.b.c.d] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### File managed with puppet ### | |
## Module: 'puppet' | |
## Template source: 'MODULES/puppet/templates/puppet.conf.erb' | |
[main] | |
# The Puppet log directory. | |
# The default value is '$vardir/log'. | |
logdir = /var/log/puppet | |
# Where Puppet PID files are kept. |
OlderNewer