Giter Club home page Giter Club logo

Comments (7)

jsegaert avatar jsegaert commented on August 27, 2024 2

Nice job on this, the community will really like this!
I didn't realize earlier the JIRA issue was a "suggestion", I just voted for it! 😄

from iocage-plugin-index.

jsegaert avatar jsegaert commented on August 27, 2024

There's a devfs_ruleset option that was implemented many moons ago for this purpose.
The idea is to specify the custom ruleset in the plugin's manifest file, e.g. something like:

  "devfs_ruleset": {
      "paths": {
          "zfs": "unhide",
          "bpf*": "unhide",
          "cua*": "unhide"
       },
      "includes": [
          "1",
          "2",
          "3"  ]
      },

I haven't come across any plugin that is actually using it, nor have I played with it myself, but this feature was requested by @kmoore134 himself.

Source: https://redmine.ixsystems.com/issues/42593

from iocage-plugin-index.

tprelog avatar tprelog commented on August 27, 2024

Thanks for pointing this out @jsegaert -- However I'm not having any success getting it to work. Following your links, I think I have tracked this function in current source code

I'm having a hard time understanding how to set this up reading the source code.

As soon as I add the "devfs_ruleset": { } option, I am getting the following error. It does not matter what is between the brackets. This error is always the same. Maybe this is a bug ?

troy@zodiac~/plugins $ sudo iocage fetch -P ./homeassistant.json --name haf
Password:
Plugin: homeassistant
  Official Plugin: false
  Using RELEASE: 11.3-RELEASE
  Using Branch: 11.3-RELEASE
  Post-install Artifact: https://github.com/tprelog/iocage-homeassistant.git
  These pkgs will be installed:
    - autoconf
    - bash
    - ca_root_nss
    - curl
    - gcc
    - gmake
    - libxml2
    - libxslt
    - openssl
    - pkgconf
    - python37
    - py37-sqlite3
    - sudo
    - wget
    - zip
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_plugin.py", line 299, in fetch_plugin
    plugin_devfs = devfs[f'plugin_{self.jail}']
KeyError: 'plugin_haf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/iocage", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/iocage_cli/fetch.py", line 181, in cli
    ioc.IOCage().fetch(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/iocage.py", line 1042, in fetch
    plugin_obj.fetch_plugin(props, 0, accept)
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_plugin.py", line 330, in fetch_plugin
    iocage_lib.ioc_destroy.IOCDestroy().destroy_jail(location)
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_destroy.py", line 272, in destroy_jail
    iocage_lib.ioc_stop.IOCStop(uuid, path, silent=True)
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_stop.py", line 62, in __init__
    raise e
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_stop.py", line 55, in __init__
    path, suppress_log=True).json_get_value('all')
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_json.py", line 1717, in json_get_value
    return self.get_full_config()
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_json.py", line 1366, in get_full_config
    conf, write = self.json_load()
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_json.py", line 1498, in json_load
    f'{jail_type.rstrip("s").capitalize()}:'
iocage_lib.ioc_exceptions.JailMissingConfiguration: Jail: haf has a missing configuration, please check that the dataset is mounted.

I've also tried different ways of setting the path. For example, based on this source code, I thought something like this would help -- I've tried some other variations as well -- It does not help, the error shown above is still always the same

        "paths": {
            "zfs": "mode None",
            "bpf*": "mode None",
            "cua*": "mode None"
         },

I have tried multiple times both with and without these additional properties set -- The error shown above is still always the same

        "allow_mount": "1",
        "allow_mount_devfs": "1",
        "enforce_statfs": "1"

Am I not including the "devfs_ruleset": { } option correctly ?? Here is the full plugin manifest, including the addition properties.

{
    "name": "homeassistant",
    "release": "11.3-RELEASE",
    "artifact": "https://github.com/tprelog/iocage-homeassistant.git",
    "official": "false",
    "properties": {
        "allow_raw_sockets": "1",
        "dhcp": "1",
        "allow_mount": "1",
        "allow_mount_devfs": "1",
        "enforce_statfs": "1"
    },
    "pkgs": [
        "autoconf",
        "bash",
        "ca_root_nss",
        "curl",
        "gcc",
        "gmake",
        "libxml2",
        "libxslt",
        "openssl",
        "pkgconf",
        "python37",
        "py37-sqlite3",
        "sudo",
        "wget",
        "zip"
    ],
    "packagesite": "http://pkg.FreeBSD.org/${ABI}/latest",
    "fingerprints": {
        "plugin-default": [
            {
                "function": "sha256",
                "fingerprint": "b0170035af3acc5f3f3ae1859dc717101b4e6c1d0a794ad554928ca0cbb2f438"
            }
        ]
    },
    "devfs_ruleset": {
        "paths": {
            "zfs": "unhide",
            "bpf*": "unhide",
            "cua*": "unhide"
         },
        "includes": [
            "1",
            "2",
            "3"  
        ]
    },
    "plugin_schema": "2",
    "revision": "0"
}

I would be grateful if any further advise could be provided. To have "out of the box" USB pass-through working for Z-Wave and Zigbee radios in this plugin would be a giant step forward. Thanks again

from iocage-plugin-index.

jsegaert avatar jsegaert commented on August 27, 2024

I was reverse engineering the format from the iocage code when I generated the example yesterday.

I just noted there was a recent commit to update the documentation for this parameter and now there's a mention and an example in https://iocage.readthedocs.io/en/master/plugins.html

I just tested this in iocage master on my vanilla FreeBSD machine, and I don't get that Traceback there. This functionality must not yet available in FreeNAS-11.3-U3.2. ☚ī¸

from iocage-plugin-index.

jsegaert avatar jsegaert commented on August 27, 2024

Some good news: It does seem to work in the nightlies; I tested with TrueNAS CORE (TrueNAS-12.0-MASTER-202006220424) so you could create a 12.1-RELEASE branch for your repo and work with FreeNAS/TRUENAS - BETA1 when it comes out in a week or so.

from iocage-plugin-index.

tprelog avatar tprelog commented on August 27, 2024

Thanks again @jsegaert -- Tested and confirmed to be working using the HUSBZB-1 on TrueNAS Core nightly.

  "devfs_ruleset": {
    "paths": {
      "zfs": null,
      "bpf*": null,
      "cua*": null
    },
    "includes": [
      "1",
      "2",
      "3"
    ]
  },

So it looks like the trackback is a bug, at least in FreeNAS-11.3-U3.2

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_plugin.py", line 299, in fetch_plugin
    plugin_devfs = devfs[f'plugin_{self.jail}']
KeyError: 'plugin_haf'
...

from iocage-plugin-index.

tprelog avatar tprelog commented on August 27, 2024

Closing this...

Beginning with TrueNAS Core 12 -- This plugin will now create the devfs_ruleset, allowing USB Z-Wave and Zigbee devices to pass through to Home Assistant Core

There is also a request to back-port the required iocage changes to FreeNAS 11.3
https://jira.ixsystems.com/browse/NAS-106614

from iocage-plugin-index.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.