Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

--auto-discover option needs better documentation #1499

Closed
ghost opened this issue Jan 30, 2017 · 3 comments
Closed

--auto-discover option needs better documentation #1499

ghost opened this issue Jan 30, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 30, 2017

SNAPTELD documentation page lacks proper explanation of --auto-discover option. The option description is "Auto discover paths separated by colons", but doesn't say anything about the purpose.
There is a single example below with "snapteld --auto-discover /opt/snap/plugins/" line suggesting this option might be used to automatically load plugins, but that's all.

In the SNAPTELD_CONFIGURATION page at the end there is a comment on restarting snapteld process and it says that not only plugins in the auto_discover_path will be reloaded, but also tasks! (which wasn't mentioned anywhere else).

And there is the TASKS page which doesn't say anything about auto-discovery and auto-loading tasks at all.

I guess that auto-loading tasks feature was added later and documentation wasn't properly updated...
Anyway, I suggest adding an explanation of --auto-discover option on the SNAPTELD page with additional examples (with comments) showing clearly it migt be also used for auto-loading tasks.

Additionally, the TASKS page should also be updated with the proper information regarding auto-loading tasks.

@nanliu
Copy link
Contributor

nanliu commented Jan 31, 2017

Yeah this isn't documented very well. We should change the default config to use two directories: one for tasks, the other for plugins:

# Control sections for configuration settings for the plugin
# control module of snapteld.
control:
  # auto_discover_path sets a directory to auto load plugins and tasks on the start
  # of the snap daemon
  auto_discover_path: /opt/snap/plugins:/opt/snap/tasks

@nanliu
Copy link
Contributor

nanliu commented Feb 1, 2017

We also could use some community contributions deploying Snap with configuration management tools. I feel like this would avoid having everyone reinvent/rediscover good defaults/best practices.

For example, this could be one way take advantage of this setting to load tasks/plugins (with purging support of obsolete tasks/plugins) in Puppet:

define snap::plugins(
  $version,
) {
  $url = "https://github.com/intelsdi-x/${name}/releases/download/${version}/${name}_linux_x86_64"
  archive { "/opt/snap/plugins/${name}":
    mode   => '0755',
    source => $url,
    notify => Service['snap-telemetry'],
  }
}

define snap::task(
  $settings,
) {
  file { "/opt/snap/tasks/${name}.yml":
    content => inline_template("@settings.to_yaml"),
    notify  => Service['snap-telemetry'],
  }
}
file { ['/opt/snap/plugins', '/opt/snap/tasks']:
  ensure => directory,
  purge  => true,
}

snap::plugin { 'snap-plugin-publisher-influxdb':
  version => 20,
}

snap::plugin { 'snap-plugin-collector-psutil':
  version => 9,
}

@jcooklin
Copy link
Collaborator

jcooklin commented Feb 1, 2017

When the documentation is updated in regards to the auto load path it should mention that plugins will need to have the proper permissions (including execute bit set).

Relates to: #1501

nanliu added a commit to nanliu/snap that referenced this issue Feb 7, 2017
@nanliu nanliu closed this as completed in d037dc0 Feb 9, 2017
nanliu added a commit that referenced this issue Feb 9, 2017
Fix #1499 update explaination to auto-discovery plugin.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants