Create a new plugin. Args: name (string): The name of the plugin. The ``:latest`` tag is optional, and is the default if omitted. plugin_data_dir (string): Path to the plugin data directory. Plugin data
(self, name, plugin_data_dir, gzip=False)
| 26 | |
| 27 | @utils.minimum_version('1.25') |
| 28 | def create_plugin(self, name, plugin_data_dir, gzip=False): |
| 29 | """ |
| 30 | Create a new plugin. |
| 31 | |
| 32 | Args: |
| 33 | name (string): The name of the plugin. The ``:latest`` tag is |
| 34 | optional, and is the default if omitted. |
| 35 | plugin_data_dir (string): Path to the plugin data directory. |
| 36 | Plugin data directory must contain the ``config.json`` |
| 37 | manifest file and the ``rootfs`` directory. |
| 38 | gzip (bool): Compress the context using gzip. Default: False |
| 39 | |
| 40 | Returns: |
| 41 | ``True`` if successful |
| 42 | """ |
| 43 | url = self._url('/plugins/create') |
| 44 | |
| 45 | with utils.create_archive( |
| 46 | root=plugin_data_dir, gzip=gzip, |
| 47 | files=set(utils.build.walk(plugin_data_dir, [])) |
| 48 | ) as archv: |
| 49 | res = self._post(url, params={'name': name}, data=archv) |
| 50 | self._raise_for_status(res) |
| 51 | return True |
| 52 | |
| 53 | @utils.minimum_version('1.25') |
| 54 | def disable_plugin(self, name, force=False): |