Redeploying a local charm after making changes to it

What is the way to redeploy a local charm after making changes to it (for fixing issues or adding new changes) irrespective of the status of the deployed unit? I cannot find this on the docs or in the internet search results.

I tried juju refresh <app name> --path dist/<app name>_ubuntu-18.04-amd64.charm but the juju debug-log --tail and the juju status output shows nothing to be happening even after several minutes. So for the time being, I just remove the application and machine and then deploy the charm again. But it is cumbersome and time-consuming.

Also when I build a charm using charmcraft pack, deploy it, make some local changes and build it again, I reliably get an error that says

Lint Errors:                                                                                                                                                                                
- metadata: Cannot read the metadata.yaml file. (

even though the metadata.yaml file is obviously there and I haven’t changed it. This gets resolved only after I run charmcraft clean and redo the build from scratch. Is this a known issue and are there any workarounds for dealing with it?

juju refresh should work. (I have the older upgrade-charm in my muscle memory, but I believe that both commands are equivalent.)

It sounds like there might be an issue w/ the metadata.yaml. I’d check file permissions, try on a different box/container, and post the file here, if you can, so that we can take a look at the formatting.

I do not think that there is an issue with metadata.yaml since it does work okay when I do a clean build. Only on a subsequent build, it always complains about being unable to read the metadata.yaml file.

Below are its contents.

name: launchpad                                                                                                                                                                              
display-name: launchpad                                                                                                                                                                      
summary: Launchpad web application                                                                                                                                                           
maintainer: Guruprasad <redacted email address>                                                                                                                                         
description: |                                                                                                                                                                               
  Launchpad is an open source suite of tools that help people and teams                                                                                                                      
  to work together on software projects.                                                                                                                                                     
  - network                                                                                                                                                                                  
  - bionic                                                                                                                                                                                   
subordinate: false                                                                                                                                                                           

@lgp171188 thank you for posting the metadata! It looks like it’s for a pre metadata v2 charm.

@facundo are there any open bugs with older metadata.yaml formats when re-running charmcraft?

Charmcraft should pack it correctly. To verify it, you could open the generated .charm file with any zip opener.


ark mycharm.charm

And check inside the metadata.yaml file…