8000 jget listing in conjunction with custom facts · Issue #790 · cbsd/cbsd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
jget listing in conjunction with custom facts #790
Open
@almmos

Description

@almmos

Mandatory info for bug reports:

FreeBSD version ( uname -a ):
FreeBSD myserver 14.2-RELEASE FreeBSD 14.2-RELEASE releng/14.2-n269506-c8918d6c7412 GENERIC amd64
CBSD version ( cbsd version ):
14.2.1

I have setup "my_custom_facts" for jail1 to echo a specific word (nginx, apache, none). I wand to know if this jail use one of the http servers or none. Following is the "facts.d" folder listing:

root@myserver:/home/testuser # ls -la ~cbsd/jails-system/jail1/facts.d/
total 14
drwxr-xr-x   2 cbsd cbsd   3 Apr 15  2022 .
drwxrwxr-x  17 root cbsd  32 Jan  6 17:23 ..
-rw-r--r--   1 cbsd cbsd 134 Apr  1  2022 placeholder
-rwxrw-r--   1 root cbsd  18 Oct 30 01:29 my_custom_facts

I have another jail named jail2, for which I did not set the custom facts. In the following folder listing we can see the only file there is "placeholder"

root@myserver:/home/testuser # ls -la ~cbsd/jails-system/jail2/facts.d/
total 14
drwxr-xr-x   2 cbsd cbsd   3 Apr 15  2022 .
drwxrwxr-x  17 root cbsd  32 Jan  6 17:23 ..
-rw-r--r--   1 cbsd cbsd 134 Apr  1  2022 placeholder

My problem is with "cbsd jget" implementation - following appear to be correct:

root@myserver:/home/testuser # cbsd jget jname=jail1 arch
arch: amd64
root@myserver:/home/testuser # cbsd jget jname=jail2 arch
arch: amd64
root@myserver:/home/testuser # cbsd jget jname=jail1 arch my_custom_facts
arch: amd64
my_custom_facts: apache
root@myserver:/home/testuser # cbsd jget jname=jail2 arch my_custom_facts
arch: amd64

But when I try the following - I ask "cbsd jget" only for "my_custom_facts":

root@myserver:/home/testuser # cbsd jget jname=jail1 my_custom_facts
allow_devfs: 1
allow_dying: 1
allow_fusefs: 0
allow_linprocfs: 0
allow_linsysfs: 0
allow_kmem: 0
allow_mount: 1
allow_nullfs: 1
allow_fdescfs: 1
allow_procfs: 1
allow_raw_sockets: 0
allow_read_msgbuf: 0
allow_reserved_ports: 1
allow_sysvipc: 0
allow_tmpfs: 1
allow_unprivileged_proc_debug: 1
allow_vmm: 0
allow_zfs: 0
applytpl: 1
arch: amd64
astart: 0
b_order: 10
basename:
baserw: 0
childrenmax: 0
cpuset: 0
data: /m1data/jails/jails-data/jail1-data
devfs_ruleset: 4
emulator: jail
emulator_flags: 0
enforce_statfs: 1
exec_consolelog: 0
exec_fib: 0
exec_master_poststart: 0
exec_master_poststop: 0
exec_master_prestart: 0
exec_master_prestop: 0
exec_poststart:
exec_poststop:
exec_prestart:
exec_prestop:
exec_start: /bin/sh /etc/rc
exec_stop: /bin/sh /etc/rc.shutdown
exec_timeout: 180
floatresolv: 1
hidden: 0
host_hostname: jail1.mydomain.org
interface: oce0
ip4_addr: xxx.xxx.xxx.xxx/xx
jdomain: 0
jnameserver: 0
masterhost:
mdsize: 0
mkhostsfile: 1
mnt_start: 0
mnt_stop: 0
mount_devfs: 1
mount_fdescfs: 1
mount_procfs: 0
mount_linprocfs: 0
mount_linsysfs: 0
mount_fstab: /m1data/jails/jails-fstab/jail1/fstab
mount_kernel: 0
mount_obj: 0
mount_ports: 0
mount_src: 0
nic_hwaddr:
path: /m1data/jails/jails/jail1
persist: 1
protected: 0
rcconf: /m1data/jails/jails-rcconf/rc.conf_jail1
slavenode:
stop_timeout: 900
sysvsem: new
sysvshm: new
sysvmsg: new
ver: 14.2
vnet: 1
ci_gw4: xxx.xxx.xxx.xxx
allow_mlock: 0
allow_nfsd: 0
gid: 0
tags: 0
zfs_encryption: 0
boot_delay: 0
nic_address: 0
my_custom_facts: apache

The "jget" command print values for all properties and the final line is related to "my_custom_facts" and the value set for it.
I have tried the same for the other jail named jail2, for which the "my_custom_facts" is not set, I have received again the full list of properties and values, without the last line about "my_custom_facts".

I need for this "jget" call to return the "my_custom_facts" if they are set, or nothing if not.

I have searched the code and I came with this line 146 in jget file:
[ -z "${ARGS}" ] && ARGS="${ALL_ARGS}"
Here is tested if there is a request for one or more "standard" jail properties and if not, the "all" list is processed and printed to console.
There is no test if we use only custom facts and for this reason the listing is set for "all".

I changed it to:
[ -z "${ARGS}" ] && [ -z "${UNKNOWN_ARGS}" ] && ARGS="${ALL_ARGS}"
and now all is working properly.

I kindly ask you to check this and maybe if it is ok to make it to the next version.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0