Skip to content

model.deploy give wrong revision of charm when using base arguement #1273

@jneo8

Description

@jneo8

Description

The model.deploy function will deploy charm with wrong base when not using series argument. The reason is because on the source code(commit d61ea7dde28f41766a917fd818816d53aa73e8c2):

    async def deploy(                                                                                                                                                                                                                         
        self,                                                                                                                                                                                                                                 
        entity_url,                                                                                                                                                                                                                           
        application_name=None,                                                                                                                                                                                                                
        bind=None,                                                                                                                                                                                                                            
        channel=None,                                                                                                                                                                                                                         
        config=None,                                                                                                                                                                                                                          
        constraints=None,                                                                                                                                                                                                                     
        force=False,                                                                                                                                                                                                                          
        num_units=1,                                                                                                                                                                                                                          
        overlays=[],                                                                                                                                                                                                                          
        base=None,                                                                                                                                                                                                                            
        resources=None,                                                                                                                                                                                                                       
        series=None,                                                                                                                                                                                                                          
        revision=None,                                                                                                                                                                                                                        
        storage: Mapping[str, str | StorageConstraintDict] | None = None,                                                                                                                                                                     
        to=None,                                                                                                                                                                                                                              
        devices=None,                                                                                                                                                                                                                         
        trust=False,                                                                                                                                                                                                                          
        attach_storage=[],                                                                                                                                                                                                                    
    ):
    """..."""
    ...
    res = await self.deploy_types[schema].resolve(                                                                 
        entity,                                        
        architecture,                                  
        application_name,                              
        channel,                                       
        series,                                        
        revision,                                      
        entity_url,                                    
        force,                                         
        model_conf,                                    
    )
    
    ...
    
    # revision is assigned here.
    charm_origin = res.origin
    
    # This won't change the revision of the charm.
    is base:
        charm_origin.base = utils.parse_base_arg(base)

    ...

    return await self._deploy(                                                                                 
        charm_url=identifier,       
        application=res.app_name,
        series=charm_series,                                                                                   
        config=config,
        constraints=constraints,                                                                               
        endpoint_bindings=bind,                                                                                
        resources=resources,                                                                                   
        storage=storage,                        
        channel=channel,       
        num_units=num_units,
        placement=parse_placement(to),
        devices=devices,
        charm_origin=charm_origin,      
        attach_storage=attach_storage,
        force=force,    
        server_side_deploy=server_side_deploy,
   )                                                                            

The charm_origin seems not actually use the base argument.

Urgency

Casually reporting

Python-libjuju version

3.6.1.2

Juju version

3.6

Reproduce / Test

# Wrong case. This give 387, which is base [email protected]
model.deploy("hardware-observer", base="[email protected]", channel="edge")
# Happy case. This give 383, which is base [email protected].
model.deploy("hardware-observer", base="[email protected]", channel="edge", series="jammy")

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugindicates a bug in the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions