How to use the gitlabform.configuration.core.ConfigFileNotFoundException function in gitlabform

To help you get started, we’ve selected a few gitlabform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github egnyte / gitlabform / gitlabform / gitlabform / core.py View on Github external
def initialize_configuration_and_gitlab(self):

        try:
            gl = GitLab(self.args.config.strip())
            c = Configuration(self.args.config.strip())
            return gl, c
        except ConfigFileNotFoundException as e:
            logging.fatal('Aborting - config file not found at: %s', e)
            sys.exit(1)
        except TestRequestFailedException as e:
            logging.fatal("Aborting - GitLab test request failed, details: '%s'", e)
            sys.exit(2)
github egnyte / gitlabform / gitlabform / configuration / core.py View on Github external
# this case is only meant for using gitlabform as a library
            elif not config_path:
                config_path = os.path.join(str(Path.home()), '.gitlabform', 'config.yml')
            elif config_path in [os.path.join('.', 'config.yml'), 'config.yml']:
                config_path = os.path.join(os.getcwd(), 'config.yml')

            logging.info("Reading config from: {}".format(config_path))

            with open(config_path, 'r') as ymlfile:
                self.config_from_file = yaml.safe_load(ymlfile)

            # we need config path for accessing files for relative paths
            self.config_dir = os.path.dirname(config_path)

        except Exception as e:
            raise ConfigFileNotFoundException(config_path)