) > 0, 'custom_check_bins_dir must be a valid directory name' if os.path.exists(custom_check_bins_dir): assert os.path.isdir( custom_check_bins_dir), '{} must be a directory'.format( custom_check_bins_dir) for entry in os.scandir(custom_check_bins_dir): assert entry.is_file( ), '{} must not contain any subdirectories'.format( custom_check_bins_dir) onprem_source = Source( entry={ 'validate': [ validate_custom_check_bins_dir, lambda custom_check_bins_provided: validate_true_false( custom_check_bins_provided), ], 'default': { 'platform': 'onprem', 'resolvers': '["8.8.8.8", "8.8.4.4"]', 'ip_detect_filename': 'genconf/ip-detect', 'ip6_detect_filename': '', 'bootstrap_id': lambda: calculate_environment_variable('BOOTSTRAP_ID'), 'enable_docker_gc': 'false' }, 'must': { 'provider': 'onprem', 'package_ids': calculate_package_ids, 'custom_check_bins_dir': 'genconf/check_bins/', 'custom_check_bins_package_name': 'custom-check-bins',
package_ids.append(custom_check_bins_package_id) return json.dumps(package_ids) def validate_custom_check_bins_dir(custom_check_bins_dir): assert len(custom_check_bins_dir) > 0, 'custom_check_bins_dir must be a valid directory name' if os.path.exists(custom_check_bins_dir): assert os.path.isdir(custom_check_bins_dir), '{} must be a directory'.format(custom_check_bins_dir) for entry in os.scandir(custom_check_bins_dir): assert entry.is_file(), '{} must not contain any subdirectories'.format(custom_check_bins_dir) onprem_source = Source(entry={ 'validate': [ validate_custom_check_bins_dir, lambda custom_check_bins_provided: validate_true_false(custom_check_bins_provided), ], 'default': { 'platform': 'onprem', 'resolvers': '["8.8.8.8", "8.8.4.4"]', 'ip_detect_filename': 'genconf/ip-detect', 'ip6_detect_filename': '', 'bootstrap_id': lambda: calculate_environment_variable('BOOTSTRAP_ID'), 'enable_docker_gc': 'false' }, 'must': { 'provider': 'onprem', 'package_ids': calculate_package_ids, 'custom_check_bins_dir': 'genconf/check_bins/', 'custom_check_bins_package_name': 'custom-check-bins', 'custom_check_bins_provided': calculate_custom_check_bins_provided,