// populateGUIArchive stores the uploaded Juju GUI archive in provider storage, // updates the GUI metadata and set the current Juju GUI version. func (c *BootstrapCommand) populateGUIArchive(st *state.State, env environs.Environ) error { agentConfig := c.CurrentConfig() dataDir := agentConfig.DataDir() guistorage, err := st.GUIStorage() if err != nil { return errors.Trace(err) } defer guistorage.Close() gui, err := agenttools.ReadGUIArchive(dataDir) if err != nil { return errors.Annotate(err, "cannot fetch GUI info") } f, err := os.Open(filepath.Join(agenttools.SharedGUIDir(dataDir), "gui.tar.bz2")) if err != nil { return errors.Annotate(err, "cannot read GUI archive") } defer f.Close() if err := guistorage.Add(f, binarystorage.Metadata{ Version: gui.Version.String(), Size: gui.Size, SHA256: gui.SHA256, }); err != nil { return errors.Annotate(err, "cannot store GUI archive") } if err = st.GUISetVersion(gui.Version); err != nil { return errors.Annotate(err, "cannot set current GUI version") } return nil }