f.close() def upload(host, port, data): return splice_server_client.upload_splice_server_metadata(host, port, "/splice/api/v1/spliceserver/", data) if __name__ == "__main__": # Parse arguments parser = OptionParser(description="Seeds a RCS with Splice Server metadata") parser.add_option("--host", action="store", help="Hostname for RCS", default="127.0.0.1") parser.add_option("--port", action="store", help="Port for RCS", default="443") parser.add_option("--input", action="store", help="JSON file containing splice server metadata to upload to server", default="") parser.add_option("--config", action="store", help="RCS server config file, defaults to /etc/splice/conf.d/server.conf", default="/etc/splice/conf.d/server.conf") (opts, args) = parser.parse_args() config.init(opts.config) if not opts.input: print "Please re-run with --input specified for a JSON file to upload to server" sys.exit(1) # Read in config file data = read_file(opts.input) try: data = json.loads(data) except Exception, e: print "Input data from %s does not appear to be valid JSON." % (opts.input) print "Input data: \n%s" % (data) print "Caught Exception: %s" % (e) sys.exit(1)
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should # have received a copy of GPLv2 along with this software; if not, see # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. """ Django common settings for splice project. """ import logging from splice.common import config # Initialize Splice Config & Logging SPLICE_CONFIG_FILE = '/etc/splice/splice.conf' config.init(SPLICE_CONFIG_FILE) LOG = logging.getLogger(__name__) DEBUG = True TEMPLATE_DEBUG = DEBUG TASTYPIE_FULL_DEBUG = DEBUG AUTHENTICATION_BACKENDS = ( 'mongoengine.django.auth.MongoEngineBackend', ) SESSION_ENGINE = 'mongoengine.django.sessions' ADMINS = ( # ('Your Name', '*****@*****.**'),
for prov_prod in item["providedProducts"]: entry = dict() entry["id"] = prov_prod["productId"] entry["name"] = prov_prod["productName"] provided_products.append(entry) p.provided_products = provided_products pools.append(p) return pools if __name__ == "__main__": import datetime import pytz from django.conf import settings from splice.common import config config.init(settings.SPLICE_CONFIG_FILE) cfg = config.get_entitlement_config_info() start_date = datetime.datetime.now(tz=pytz.utc) end_date = (start_date + datetime.timedelta(minutes=15)) print "Start Date: %s" % (start_date.isoformat()) print "End Date: %s" % (end_date.isoformat()) certs = get_entitlement(host=cfg["host"], port=cfg["port"], url=cfg["url"], requested_products=["69","83"], identity="1234", username=cfg["username"], password=cfg["password"], start_date=start_date.isoformat(), end_date=end_date.isoformat()) print "---\n\n" print "certs = \n%s" % (certs)
# Development settings import os from splice.common import config curr_dir = os.path.dirname(__file__) source_dir = os.path.join(curr_dir, '..') cert_dir = os.path.join(curr_dir, '../../..') os.chdir(source_dir) srl_path = os.path.join(cert_dir, 'etc/pki/rhic-serve/rhic-serve-ca.srl') # Reset configuration object just in case config_file = os.path.join(curr_dir, 'splice.conf') config.init(config_file, reinit=True) from rhic_serve.settings import * if not os.path.exists(srl_path): open(srl_path, 'w').write('01\n') DUMP_DIR = os.path.join(curr_dir, 'db_dump')
# This software is licensed to you under the GNU General Public # License as published by the Free Software Foundation; either version # 2 of the License (GPLv2) or (at your option) any later version. # There is NO WARRANTY for this software, express or implied, # including the implied warranties of MERCHANTABILITY, # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should # have received a copy of GPLv2 along with this software; if not, see # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. import os from splice.common import config curr_dir = os.path.dirname(__file__) source_dir = os.path.join(curr_dir, '..') os.chdir(source_dir) config_file = os.path.join(curr_dir, 'splice.conf') # Reset configuration object just in case config.CONFIG = None config.init(config_file) from splice.checkin_service.settings import * TASTYPIE_FULL_DEBUG = True set_celerybeat_schedule()