Skip to content

Commit 4536dc6

Browse files
committed
fix(CreateDataset): remove transform creating default viz
also added a 'none' option b/c currently our registry is dead & without it you can't create a repo
1 parent 679d147 commit 4536dc6

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

actions/dataset.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ func UpdateDataset(node *p2p.QriNode, dsp *dataset.DatasetPod) (ds *dataset.Data
189189

190190
// CreateDataset initializes a dataset from a dataset pointer and data file
191191
func CreateDataset(node *p2p.QriNode, name string, ds *dataset.Dataset, data cafs.File, secrets map[string]string, pin bool) (ref repo.DatasetRef, err error) {
192-
log.Debugf("CreateDataset: %s", name)
193192
var (
194193
r = node.Repo
195194
pro *profile.Profile

actions/setup.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import (
1717
var ErrHandleTaken = fmt.Errorf("handle is taken")
1818

1919
// Setup provisions a new qri instance
20-
func Setup(repoPath, cfgPath string, cfg *config.Config) error {
20+
func Setup(repoPath, cfgPath string, cfg *config.Config, register bool) error {
2121
if err := cfg.Validate(); err != nil {
2222
return fmt.Errorf("invalid configuration: %s", err.Error())
2323
}
2424

25-
if cfg.Registry != nil {
25+
if register && cfg.Registry != nil {
2626
pro, err := profile.NewProfile(cfg.Profile)
2727
if err != nil {
2828
return err
@@ -36,7 +36,9 @@ func Setup(repoPath, cfgPath string, cfg *config.Config) error {
3636
if strings.Contains(err.Error(), "taken") {
3737
return ErrHandleTaken
3838
}
39-
return err
39+
// TODO - restore this error
40+
// return err
41+
err = nil
4042
}
4143
}
4244

actions/setup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestSetupInitIPFSTeardown(t *testing.T) {
1717

1818
cfg := config.DefaultConfigForTesting()
1919
cfg.Registry = nil
20-
if err := Setup(path, path+"/config.yaml", cfg); err != nil {
20+
if err := Setup(path, path+"/config.yaml", cfg, true); err != nil {
2121
t.Error(err.Error())
2222
}
2323
if err := InitIPFS(path, nil); err != nil {

actions/viz.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import (
99

1010
// PrepareViz loads vizualization bytes from a local filepath
1111
func PrepareViz(ds *dataset.Dataset) (err error) {
12+
// remove any empty vizualizations
13+
if ds.Viz != nil && ds.Viz.IsEmpty() {
14+
ds.Viz = nil
15+
return nil
16+
}
17+
1218
if ds.Viz != nil && ds.Viz.ScriptPath != "" {
1319
// create a reader of script bytes
1420
scriptdata, err := ioutil.ReadFile(ds.Viz.ScriptPath)

cmd/setup.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ including all your datasets, and de-registers your peername from the registry.`,
5353
cmd.Flags().BoolVarP(&o.Overwrite, "overwrite", "", false, "overwrite repo if one exists")
5454
cmd.Flags().BoolVarP(&o.IPFS, "init-ipfs", "", true, "initialize an IPFS repo if one isn't present")
5555
cmd.Flags().BoolVarP(&o.Remove, "remove", "", false, "permanently remove qri, overrides all setup options")
56-
cmd.Flags().StringVarP(&o.Registry, "registry", "", "", "override default registry URL")
56+
cmd.Flags().StringVarP(&o.Registry, "registry", "", "", "override default registry URL, set to 'none' to remove registry")
5757
cmd.Flags().StringVarP(&o.Peername, "peername", "", "", "choose your desired peername")
5858
cmd.Flags().StringVarP(&o.IPFSConfigData, "ipfs-config", "", "", "json-encoded configuration data, specify a filepath with '@' prefix")
5959
cmd.Flags().StringVarP(&o.ConfigData, "config-data", "", "", "json-encoded configuration data, specify a filepath with '@' prefix")
@@ -168,7 +168,9 @@ func (o *SetupOptions) DoSetup(f Factory) (err error) {
168168
cfg.Profile.Peername = inputText(o.Out, o.In, "choose a peername:", doggos.DoggoNick(cfg.Profile.ID))
169169
}
170170

171-
if o.Registry != "" {
171+
if o.Registry == "none" {
172+
cfg.Registry = nil
173+
} else if o.Registry != "" {
172174
cfg.Registry.Location = o.Registry
173175
}
174176

@@ -178,6 +180,7 @@ func (o *SetupOptions) DoSetup(f Factory) (err error) {
178180
ConfigFilepath: filepath.Join(o.QriRepoPath, "config.yaml"),
179181
SetupIPFS: o.IPFS,
180182
IPFSFsPath: o.IpfsFsPath,
183+
Register: o.Registry == "none",
181184
}
182185

183186
if o.IPFSConfigData != "" {

lib/setup.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ type SetupParams struct {
1111
QriRepoPath string
1212
ConfigFilepath string
1313
SetupIPFS bool
14+
Register bool
1415
IPFSFsPath string
1516
SetupIPFSConfigData []byte
1617
}
1718

1819
// Setup provisions a new qri instance, it intentionally doesn't conform to the RPC function signature
1920
// because remotely invoking setup doesn't make much sense
2021
func Setup(p SetupParams) error {
21-
if err := actions.Setup(p.QriRepoPath, p.ConfigFilepath, p.Config); err != nil {
22+
if err := actions.Setup(p.QriRepoPath, p.ConfigFilepath, p.Config, p.Register); err != nil {
2223
return err
2324
}
2425

0 commit comments

Comments
 (0)