#!/usr/bin/python3

# Copyright (c) 2022, SUSE LLC, All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library.

"""
Create the region info file if it does not exist. During package update the
system is in the region to which it is registered.
"""

import os
import sys

import cloudregister.registerutils as utils

region_info_path = os.path.join(
    utils.get_state_dir(), utils.FRAMEWORK_IDENTIFIER
)

if os.path.exists(region_info_path):
    sys.exit(0)

utils.write_framework_identifier(utils.get_config())
