Ejemplo n.º 1
0
    parser.add_argument(
        '--trusted-cas',
        default='',
        help="Path to the trusted CA_BUNDLE file or directory containing the "
        "certificates of trusted CAs. Note if set to a directory, the "
        "directory must have been processed using the c_rehash utility "
        "supplied with OpenSSL. If using a CA_BUNDLE file can also consider "
        "using the REQUESTS_CA_BUNDLE environment variable instead (this may "
        "cause pip to fail to validate against PyPI). This option implies and "
        "supersedes --verify")
    args = parser.parse_args()
    cli_args = vars(args).copy()

    # Config Setup
    ###########################################################################
    config_path = expand_path(args.config)
    if not os.path.exists(config_path):
        config_path = None
    config = importlib.import_module('productionsystem.config')
    config_instance = config.ConfigSystem.setup(config_path)
    if config_path is not None:
        arg_dict = vars(args)
        arg_dict.update(config_instance.get_section("userdb"))
        args = parser.parse_args(namespace=argparse.Namespace(**arg_dict))
    if args.trusted_cas:
        args.verify = args.trusted_cas

    # Logging setup
    ###########################################################################
    # setup the root logger
    logging.basicConfig(
Ejemplo n.º 2
0
        "directory must have been processed using the c_rehash utility "
        "supplied with OpenSSL. If using a CA_BUNDLE file can also consider "
        "using the REQUESTS_CA_BUNDLE environment variable instead (this may "
        "cause pip to fail to validate against PyPI). This option implies and "
        "superseeds --verify")
    args = parser.parse_args()
    if args.trusted_cas:
        args.verify = args.trusted_cas

    logging.basicConfig(level=max(logging.WARNING - 10 * (args.verbose or 0),
                                  logging.DEBUG),
                        format="%(name)15s : %(levelname)8s : %(message)s")
    logger = logging.getLogger(app_name)
    logger.debug("Script called with args: %s", args)

    real_config = expand_path(args.config)
    if not os.path.exists(real_config):
        logging.warning("Config file '%s' does not exist", real_config)
        real_config = None
    config = importlib.import_module('productionsystem.config')
    config.ConfigSystem.setup(real_config)

    # Add the python src path to the sys.path for future imports
    # sys.path.append(lzprod_root)

    registry = importlib.import_module('productionsystem.sql.registry')
    Users = importlib.import_module('productionsystem.sql.models.Users').Users
    CertClient = importlib.import_module(
        'productionsystem.suds_utils').CertClient

    # Note if clients share the same transport we get a
Ejemplo n.º 3
0
        pkg_resources.iter_entry_points('dbmodels'),
        pkg_resources.iter_entry_points('monitoring'),
        pkg_resources.iter_entry_points('webapp'),
        pkg_resources.iter_entry_points('webapp.services')))
    projects -= {'productionsystem'}
    if projects:
        extensions = start_parser.add_argument_group("Extensions")
        extensions.add_argument('--extension',
                                choices=projects,
                                help="Activate the chosen extension")
    args = parser.parse_args()
    cli_args = vars(args).copy()

    # Config Setup
    ###########################################################################
    config_path = expand_path(args.config)
    if not os.path.exists(config_path):
        config_path = None
    config = importlib.import_module('productionsystem.config')
    config_instance = config.ConfigSystem.setup(config_path)
    if config_path is not None:
        arg_dict = vars(args)
        arg_dict.update(config_instance.get_section("monitoring"))
        args = parser.parse_args(namespace=argparse.Namespace(**arg_dict))

    # Logging setup
    ###########################################################################
    # setup the handler
    fhandler = logging.StreamHandler()
    if not args.debug_mode:
        # check and create logging dir
 def test_expand_path(self):
     """test expand_path function."""
     self.assertEqual(utils.expand_path("~"), r"C:\Users\infer")
     self.assertEqual(utils.expand_path("~/$OS"),
                      r"C:\Users\infer\Windows_NT")