oracle / oracle/oci-python-sdk

Custom Images - TypeError: Unrecognized keyword arguments: launch_options

Open
#861 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SDK
Dominant language
Python
Stars
474
Forks
321
Avg merge
23m
Merged PRs (30d)
4

Description

Im trying to create a Custom Image from an object in a specific bucket, with custom Launch Options.
Based on the link https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/CreateImageDetails we should be able to use LaunchOptions, but I cant find any way to use them. How and where should we use "LaunchOptions"?

Below there is the configuration/code.

> pip3 show oci
Name: oci
Version: 2.171.0
Summary: Oracle Cloud Infrastructure Python SDK
Home-page: https://docs.oracle.com/en-us/iaas/tools/python/latest/index.html
Author: Oracle
Author-email: joe.levy@oracle.com
License: Universal Permissive License 1.0 or Apache License 2.0
Requires: certifi, circuitbreaker, cryptography, pyOpenSSL, python-dateutil, pytz, urllib3
> python3 --version
Python 3.11.2

This is my python3 code:

import oci
import os
import json

oci_config_file="./oci_config"
the_profile_name=oci.config.DEFAULT_PROFILE or "DEFAULT"

the_namespace="MyNamespace"
bucket_name="MyBucket"
object_name="debian-13-genericcloud-amd64-20260413-2447.qcow2"

qcow2folder='./qcow2/13-trixie/20260413-2447'
metadata_json_file = os.path.join(qcow2folder, f"{os.path.splitext(object_name)[0]}_python.json")
with open(metadata_json_file, "r") as meta_file:
    metadata_json = json.load(meta_file)

config = oci.config.from_file(file_location=oci_config_file, profile_name=the_profile_name)
compute_client = oci.core.ComputeClient(config)

object_display_name=os.path.splitext(os.path.basename(object_name))[0]

# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchOptions
launch_options = oci.core.models.LaunchOptions(
    boot_volume_type="PARAVIRTUALIZED",
    firmware="UEFI_64", 
    is_consistent_volume_naming_enabled=False, 
    is_pv_encryption_in_transit_enabled=True, 
    network_type="PARAVIRTUALIZED", 
    remote_data_volume_type="PARAVIRTUALIZED" 
)

# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/ImageSourceViaObjectStorageTupleDetails
image_source_details=oci.core.models.ImageSourceViaObjectStorageTupleDetails(
    source_type="objectStorageTuple", 
    bucket_name=bucket_name,
    namespace_name=the_namespace,
    object_name=object_name,
    operating_system="Debian",
    operating_system_version="20260413-2447",
    source_image_type="QCOW2"
)

# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/CreateImageDetails
create_image_details=oci.core.models.CreateImageDetails(
    compartment_id=config['tenancy'],
    display_name=object_display_name, 
    freeform_tags=metadata_json,
    image_source_details=image_source_details, 
    launch_mode="CUSTOM", 
    launch_options=launch_options
)

But what I get is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./venv/lib/python3.11/site-packages/oci/decorators.py", line 25, in init
    raise TypeError('Unrecognized keyword arguments: {}'.format(', '.join(six.iterkeys(kwargs))))
TypeError: Unrecognized keyword arguments: launch_options

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the installed CreateImageDetails model and the constructor path shown in oci/decorators.py, then compare its accepted fields with the CreateImageDetails API documentation. Confirm whether launch_options is missing from the SDK version and whether the issue is resolved by a supported usage or a model update.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.