canonical/pycloudlib

GCE cloud launch can take arbitrary kwargs, but does not use them.

Closed this issue · 0 comments

the function signature for pycloudlib:gce:cloud:GCE:launch()

    def launch(
        self,
        image_id,
        instance_type="n1-standard-1",
        user_data=None,
        *,
        username: Optional[str] = None,
        **kwargs,
    ):
        """Launch instance on GCE and print the IP address.

        Args:
            image_id: string, image ID for instance to use
            instance_type: string, instance type to launch
            user_data: string, user-data to pass to instance
            username: username to use when connecting via SSH
            kwargs: other named arguments to add to instance JSON
        Raises: ValueError on invalid image_id

but nowhere are the kwargs used. config is a MutableMapping that is hardcoded, and nothing merges kwargs. This means a lot of launch time configuration possibilities are not possible in GCE right now.

Keeping it simple, let's take the function signature and docstring and do what it says -- given kwargs, insert into config