def main():
    args = parse_args()

    try:
        utils._ensure_environment()
        with open(args.json, 'r') as jsonfile:
            network_desc = json.load(jsonfile)
        neutron.initialize_neutron(network_desc)
    except Exception as e:
        print(str(e))
        return 1
    return 0
def main():
    args = parse_args()

    try:
        with open(args.nodes, 'r') as node_file:
            nodes_list = json.load(node_file)
        utils._ensure_environment()

        # TODO(StevenK): Filter out registered nodes.
        nodes.register_all_nodes(args.service_host, nodes_list)
    except Exception as e:
        print(str(e))
        return 1
    return 0
 def test_ensure_environment_missing_none(self):
     self.assertIs(None, utils._ensure_environment())
 def test_ensure_environment_missing_username(self):
     message = "OS_USERNAME environment variable is required to be set."
     with testtools.ExpectedException(exception.MissingEnvironment,
                                      message):
         utils._ensure_environment()
 def test_ensure_environment_missing_all(self):
     message = ("OS_AUTH_URL, OS_PASSWORD, OS_TENANT_NAME, OS_USERNAME "
                "environment variables are required to be set.")
     with testtools.ExpectedException(exception.MissingEnvironment,
                                      message):
         utils._ensure_environment()