Skip to content

Instantly share code, notes, and snippets.

View AlexanderS's full-sized avatar

Alexander Sulfrian AlexanderS

View GitHub Profile
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
# [...]
location / {
$ PYTHONPATH="src/lib/" src/sbin/bcfg2-admin -C ~/server/etc/bcfg2.conf shell
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import Bcfg2.Reporting.models
>>> Bcfg2.Reporting.models.ServiceEntry._meta.fields
[<django.db.models.fields.AutoField: id>, <django.db.models.fields.CharField: name>, <django.db.models.fields.BigIntegerField: hash_key>, <django.db.models.fields.IntegerField: state>, <django.db.models.fields.BooleanField: exists>, <django.db.models.fields.CharField: target_status>, <django.db.models.fields.CharField: current_status>]
>>>
$ PYTHONPATH="src/lib/" src/sbin/bcfg2-admin -C ~/server/etc/bcfg2.conf -dv shell
Configured logging: DEBUG to console
Finalizing Django settings: {'TEMPLATE_DIRS': '/usr/share/python-support/python-django/django/contrib/admin/templates/', 'LOGIN_URL': '/login', 'SESSION_EXPIRE_AT_BROWSER_CLOSE': True, 'TEST_RUNNER': 'django.test.simple.DjangoTestSuiteRun
ner', 'LANGUAGE_CODE': 'en-us', 'SITE_ID': 1, 'STATIC_URL': '/media/', 'DEBUG': False, 'MIDDLEWARE_CLASSES': ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middle
ware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware'), 'ROOT_URLCONF': 'Bcfg2.Reporting.urls', 'MANAGERS': (('Root', 'root'),), 'SECRET_KEY': 'eb5+y%oy-qx*2+62vv=gtnnxg1yig_odu0se5$h0hh#pc*lmo7', 'AUTHENTICATION_BACKEND
S': 'django.contrib.auth.backends.ModelBackend', 'TEMPLATE_DEBUG': Fals
--- a/sa-update.raw
+++ b/sa-update.raw
@@ -512,6 +512,7 @@ foreach my $channel (@channels) {
if ( defined $opt{'checkonly'} ) {
dbg("channel: $channel: --install and --checkonly, claiming update available");
+ $channel_successes++;
next;
}
diff --git a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py
index 045e463..97888f7 100644
--- a/src/lib/Bcfg2/Server/Plugins/NagiosGen.py
+++ b/src/lib/Bcfg2/Server/Plugins/NagiosGen.py
@@ -45,7 +45,11 @@ class NagiosGen(Plugin, Generator):
raise PluginExecutionError("Failed to find IP address for %s" %
metadata.hostname)
host_groups = [grp for grp in metadata.groups
- if os.path.isfile('%s/%s-group.cfg' % (self.data, grp))]
+ if os.path.isfile('%s/%s-group.cfg' %
diff --git a/src/lib/Bcfg2/Server/Encryption.py b/src/lib/Bcfg2/Server/Encryption.py
index b603028..b3bf261 100755
--- a/src/lib/Bcfg2/Server/Encryption.py
+++ b/src/lib/Bcfg2/Server/Encryption.py
@@ -88,7 +88,7 @@ def str_encrypt(plaintext, key, iv=IV, algorithm=None, salt=None):
if algorithm is None:
algorithm = Bcfg2.Options.setup.algorithm
cipher = Cipher(alg=algorithm, key=key, iv=iv, op=ENCRYPT, salt=salt)
- return _cipher_filter(cipher, plaintext)
+ return _cipher_filter(cipher, 'BCFG2' + plaintext)
diff --git a/src/lib/Bcfg2/Client/__init__.py b/src/lib/Bcfg2/Client/__init__.py
index 073aa76..f3af83d 100644
--- a/src/lib/Bcfg2/Client/__init__.py
+++ b/src/lib/Bcfg2/Client/__init__.py
@@ -10,6 +10,7 @@ import fnmatch
import logging
import argparse
import tempfile
+import copy
import Bcfg2.Logger
From 8d3cda3d30ea215b6e78f41f36672dd66283068b Mon Sep 17 00:00:00 2001
From: Alexander Sulfrian <[email protected]>
Date: Tue, 21 Oct 2014 23:12:34 +0200
Subject: [PATCH 1/2] TestOptions: check for <repository> magic also in default values
---
.../Testsrc/Testlib/TestOptions/TestOptions.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/testsuite/Testsrc/Testlib/TestOptions/TestOptions.py b/testsuite/Testsrc/Testlib/TestOptions/TestOptions.py