003 File Manager
Current Path:
/usr/local/lib/python3.8/site-packages/salt/modules
usr
/
local
/
lib
/
python3.8
/
site-packages
/
salt
/
modules
/
π
..
π
__init__.py
(35 B)
π
__pycache__
π
acme.py
(12.74 KB)
π
aix_group.py
(4.11 KB)
π
aix_shadow.py
(1.93 KB)
π
aixpkg.py
(10.91 KB)
π
aliases.py
(5.07 KB)
π
alternatives.py
(5.1 KB)
π
ansiblegate.py
(11.38 KB)
π
apache.py
(12.47 KB)
π
apcups.py
(2.21 KB)
π
apf.py
(3.09 KB)
π
apkpkg.py
(16 KB)
π
aptly.py
(15.28 KB)
π
aptpkg.py
(102.35 KB)
π
archive.py
(46.97 KB)
π
arista_pyeapi.py
(22.06 KB)
π
artifactory.py
(24.78 KB)
π
at.py
(10.65 KB)
π
at_solaris.py
(8.56 KB)
π
augeas_cfg.py
(13.93 KB)
π
aws_sqs.py
(6.55 KB)
π
azurearm_compute.py
(19.55 KB)
π
azurearm_dns.py
(14.7 KB)
π
azurearm_network.py
(80.8 KB)
π
azurearm_resource.py
(34.27 KB)
π
bamboohr.py
(7.36 KB)
π
baredoc.py
(11.13 KB)
π
bcache.py
(28.97 KB)
π
beacons.py
(27.89 KB)
π
bigip.py
(69.11 KB)
π
bluez_bluetooth.py
(6.76 KB)
π
boto3_elasticache.py
(37.34 KB)
π
boto3_elasticsearch.py
(53.17 KB)
π
boto3_route53.py
(39.75 KB)
π
boto3_sns.py
(12.93 KB)
π
boto_apigateway.py
(61.86 KB)
π
boto_asg.py
(35.7 KB)
π
boto_cfn.py
(7.95 KB)
π
boto_cloudfront.py
(12.75 KB)
π
boto_cloudtrail.py
(14.45 KB)
π
boto_cloudwatch.py
(10.99 KB)
π
boto_cloudwatch_event.py
(9.48 KB)
π
boto_cognitoidentity.py
(14.63 KB)
π
boto_datapipeline.py
(6.94 KB)
π
boto_dynamodb.py
(10.54 KB)
π
boto_ec2.py
(79.29 KB)
π
boto_efs.py
(14.05 KB)
π
boto_elasticache.py
(23.69 KB)
π
boto_elasticsearch_domain.py
(15.85 KB)
π
boto_elb.py
(35.4 KB)
π
boto_elbv2.py
(10.81 KB)
π
boto_iam.py
(75.62 KB)
π
boto_iot.py
(26.2 KB)
π
boto_kinesis.py
(19.63 KB)
π
boto_kms.py
(17.29 KB)
π
boto_lambda.py
(35.05 KB)
π
boto_rds.py
(34.92 KB)
π
boto_route53.py
(32.55 KB)
π
boto_s3.py
(4.24 KB)
π
boto_s3_bucket.py
(31.8 KB)
π
boto_secgroup.py
(25.22 KB)
π
boto_sns.py
(7.22 KB)
π
boto_sqs.py
(6.43 KB)
π
boto_ssm.py
(3.65 KB)
π
boto_vpc.py
(112.81 KB)
π
bower.py
(5.89 KB)
π
bridge.py
(10.86 KB)
π
bsd_shadow.py
(6.92 KB)
π
btrfs.py
(33.64 KB)
π
cabal.py
(3.79 KB)
π
capirca_acl.py
(40.04 KB)
π
cassandra_cql.py
(39 KB)
π
cassandra_mod.py
(3.97 KB)
π
celery.py
(3.33 KB)
π
ceph.py
(15.82 KB)
π
chassis.py
(1.52 KB)
π
chef.py
(4.66 KB)
π
chocolatey.py
(39.34 KB)
π
chronos.py
(2.89 KB)
π
chroot.py
(11.51 KB)
π
cimc.py
(23.02 KB)
π
ciscoconfparse_mod.py
(14.79 KB)
π
cisconso.py
(3.83 KB)
π
cloud.py
(9.39 KB)
π
cmdmod.py
(162.16 KB)
π
composer.py
(10.31 KB)
π
config.py
(16.85 KB)
π
consul.py
(68.93 KB)
π
container_resource.py
(13.36 KB)
π
cp.py
(27.98 KB)
π
cpan.py
(5.54 KB)
π
cron.py
(26.8 KB)
π
cryptdev.py
(10.08 KB)
π
csf.py
(16.04 KB)
π
cyg.py
(8.32 KB)
π
daemontools.py
(5.41 KB)
π
data.py
(3.83 KB)
π
datadog_api.py
(7.64 KB)
π
ddns.py
(7.04 KB)
π
deb_apache.py
(7.41 KB)
π
deb_postgres.py
(4.22 KB)
π
debconfmod.py
(4.06 KB)
π
debian_ip.py
(64.78 KB)
π
debian_service.py
(6.6 KB)
π
debuild_pkgbuild.py
(34.69 KB)
π
defaults.py
(5.42 KB)
π
devinfo.py
(9.05 KB)
π
devmap.py
(627 B)
π
dig.py
(7.45 KB)
π
disk.py
(30.44 KB)
π
djangomod.py
(7.53 KB)
π
dnsmasq.py
(5.71 KB)
π
dnsutil.py
(11.51 KB)
π
dockercompose.py
(32.62 KB)
π
dockermod.py
(224.97 KB)
π
dpkg_lowpkg.py
(12.9 KB)
π
drac.py
(10.97 KB)
π
dracr.py
(38.53 KB)
π
drbd.py
(7.19 KB)
π
dummyproxy_pkg.py
(2.46 KB)
π
dummyproxy_service.py
(2.91 KB)
π
ebuildpkg.py
(38.74 KB)
π
eix.py
(1.58 KB)
π
elasticsearch.py
(51.44 KB)
π
environ.py
(8.96 KB)
π
eselect.py
(4.99 KB)
π
esxcluster.py
(502 B)
π
esxdatacenter.py
(514 B)
π
esxi.py
(1.64 KB)
π
esxvm.py
(481 B)
π
etcd_mod.py
(7.02 KB)
π
ethtool.py
(7.65 KB)
π
event.py
(8.23 KB)
π
extfs.py
(8.78 KB)
π
file.py
(224.74 KB)
π
firewalld.py
(20.51 KB)
π
freebsd_sysctl.py
(4.76 KB)
π
freebsd_update.py
(6.19 KB)
π
freebsdjail.py
(7.16 KB)
π
freebsdkmod.py
(6.17 KB)
π
freebsdpkg.py
(17.04 KB)
π
freebsdports.py
(13.13 KB)
π
freebsdservice.py
(12.53 KB)
π
freezer.py
(8.91 KB)
π
gcp_addon.py
(4.07 KB)
π
gem.py
(10.6 KB)
π
genesis.py
(21.75 KB)
π
gentoo_service.py
(9.18 KB)
π
gentoolkitmod.py
(8.33 KB)
π
git.py
(171.44 KB)
π
github.py
(53.19 KB)
π
glanceng.py
(4.69 KB)
π
glassfish.py
(19.49 KB)
π
glusterfs.py
(19.55 KB)
π
gnomedesktop.py
(6.85 KB)
π
google_chat.py
(1.52 KB)
π
gpg.py
(39.99 KB)
π
grafana4.py
(30.27 KB)
π
grains.py
(23.67 KB)
π
groupadd.py
(10.85 KB)
π
grub_legacy.py
(3.08 KB)
π
guestfs.py
(2.32 KB)
π
hadoop.py
(3.76 KB)
π
haproxyconn.py
(10.17 KB)
π
hashutil.py
(6.77 KB)
π
heat.py
(25.26 KB)
π
helm.py
(39.27 KB)
π
hg.py
(7.16 KB)
π
highstate_doc.py
(22.76 KB)
π
hosts.py
(10.47 KB)
π
http.py
(3.75 KB)
π
icinga2.py
(4.46 KB)
π
idem.py
(1.75 KB)
π
ifttt.py
(2.28 KB)
π
ilo.py
(15.98 KB)
π
incron.py
(7.68 KB)
π
influxdb08mod.py
(15.07 KB)
π
influxdbmod.py
(16.13 KB)
π
infoblox.py
(17.53 KB)
π
ini_manage.py
(14.63 KB)
π
inspectlib
π
inspector.py
(8.19 KB)
π
introspect.py
(4.02 KB)
π
iosconfig.py
(14.78 KB)
π
ipmi.py
(25.45 KB)
π
ipset.py
(17.97 KB)
π
iptables.py
(57.33 KB)
π
iwtools.py
(3.99 KB)
π
jboss7.py
(20.51 KB)
π
jboss7_cli.py
(15.23 KB)
π
jenkinsmod.py
(11.9 KB)
π
jinja.py
(2.66 KB)
π
jira_mod.py
(7.07 KB)
π
junos.py
(73.9 KB)
π
k8s.py
(24.87 KB)
π
kapacitor.py
(5.37 KB)
π
kerberos.py
(5.42 KB)
π
kernelpkg_linux_apt.py
(6.91 KB)
π
kernelpkg_linux_yum.py
(7.46 KB)
π
key.py
(1007 B)
π
keyboard.py
(2.64 KB)
π
keystone.py
(43.16 KB)
π
keystoneng.py
(21.82 KB)
π
keystore.py
(6.69 KB)
π
kmod.py
(7.29 KB)
π
kubeadm.py
(34.01 KB)
π
kubernetesmod.py
(46.66 KB)
π
launchctl_service.py
(9.73 KB)
π
layman.py
(4.22 KB)
π
ldap3.py
(18.81 KB)
π
ldapmod.py
(5.9 KB)
π
libcloud_compute.py
(23.51 KB)
π
libcloud_dns.py
(9.76 KB)
π
libcloud_loadbalancer.py
(13.17 KB)
π
libcloud_storage.py
(12.19 KB)
π
linux_acl.py
(7.7 KB)
π
linux_ip.py
(5.44 KB)
π
linux_lvm.py
(17.86 KB)
π
linux_service.py
(4.64 KB)
π
linux_shadow.py
(13.37 KB)
π
linux_sysctl.py
(7.39 KB)
π
localemod.py
(11.84 KB)
π
locate.py
(2.58 KB)
π
logadm.py
(9.57 KB)
π
logmod.py
(1.24 KB)
π
logrotate.py
(7.72 KB)
π
lvs.py
(11.54 KB)
π
lxc.py
(148.61 KB)
π
lxd.py
(90.2 KB)
π
mac_assistive.py
(6.36 KB)
π
mac_brew_pkg.py
(19.82 KB)
π
mac_desktop.py
(2.77 KB)
π
mac_group.py
(6.34 KB)
π
mac_keychain.py
(6.68 KB)
π
mac_pkgutil.py
(2.84 KB)
π
mac_portspkg.py
(11.36 KB)
π
mac_power.py
(13.29 KB)
π
mac_service.py
(19.64 KB)
π
mac_shadow.py
(14.23 KB)
π
mac_softwareupdate.py
(14.52 KB)
π
mac_sysctl.py
(5.13 KB)
π
mac_system.py
(15.2 KB)
π
mac_timezone.py
(8.34 KB)
π
mac_user.py
(16.36 KB)
π
mac_xattr.py
(6.11 KB)
π
macdefaults.py
(2.33 KB)
π
macpackage.py
(6.94 KB)
π
makeconf.py
(17.31 KB)
π
mandrill.py
(6.31 KB)
π
marathon.py
(5.36 KB)
π
match.py
(10.28 KB)
π
mattermost.py
(3.4 KB)
π
mdadm_raid.py
(9.86 KB)
π
mdata.py
(3.44 KB)
π
memcached.py
(6.13 KB)
π
mine.py
(18.79 KB)
π
minion.py
(7.68 KB)
π
mod_random.py
(6.72 KB)
π
modjk.py
(12.48 KB)
π
mongodb.py
(17.3 KB)
π
monit.py
(5.51 KB)
π
moosefs.py
(3.87 KB)
π
mount.py
(56.18 KB)
π
mssql.py
(14.64 KB)
π
msteams.py
(2 KB)
π
munin.py
(2.4 KB)
π
mysql.py
(87.86 KB)
π
nacl.py
(9.73 KB)
π
nagios.py
(6.53 KB)
π
nagios_rpc.py
(5.09 KB)
π
namecheap_domains.py
(12.84 KB)
π
namecheap_domains_dns.py
(5.93 KB)
π
namecheap_domains_ns.py
(4.51 KB)
π
namecheap_ssl.py
(25.72 KB)
π
namecheap_users.py
(2.4 KB)
π
napalm_bgp.py
(9.72 KB)
π
napalm_formula.py
(11.33 KB)
π
napalm_mod.py
(59.3 KB)
π
napalm_netacl.py
(28.59 KB)
π
napalm_network.py
(93.24 KB)
π
napalm_ntp.py
(10.22 KB)
π
napalm_probes.py
(13.25 KB)
π
napalm_route.py
(5.09 KB)
π
napalm_snmp.py
(7.05 KB)
π
napalm_users.py
(6.49 KB)
π
napalm_yang_mod.py
(20.28 KB)
π
netaddress.py
(1.6 KB)
π
netbox.py
(32.22 KB)
π
netbsd_sysctl.py
(3.97 KB)
π
netbsdservice.py
(6.49 KB)
π
netmiko_mod.py
(19.63 KB)
π
netscaler.py
(27.02 KB)
π
network.py
(62.75 KB)
π
neutron.py
(44.93 KB)
π
neutronng.py
(15.02 KB)
π
nexus.py
(22.95 KB)
π
nfs3.py
(3.9 KB)
π
nftables.py
(33.58 KB)
π
nginx.py
(3.83 KB)
π
nilrt_ip.py
(36.18 KB)
π
nix.py
(8.03 KB)
π
nova.py
(19.61 KB)
π
npm.py
(10.35 KB)
π
nspawn.py
(41.35 KB)
π
nxos.py
(24.67 KB)
π
nxos_api.py
(14.66 KB)
π
nxos_upgrade.py
(14.74 KB)
π
omapi.py
(3.6 KB)
π
openbsd_sysctl.py
(3.74 KB)
π
openbsdpkg.py
(11 KB)
π
openbsdrcctl_service.py
(6.25 KB)
π
openbsdservice.py
(8.31 KB)
π
openscap.py
(2.81 KB)
π
openstack_config.py
(3.5 KB)
π
openstack_mng.py
(2.71 KB)
π
openvswitch.py
(11.75 KB)
π
opkg.py
(49.72 KB)
π
opsgenie.py
(3.29 KB)
π
oracle.py
(5.83 KB)
π
osquery.py
(24.93 KB)
π
out.py
(2.53 KB)
π
pacmanpkg.py
(31.99 KB)
π
pagerduty.py
(4.7 KB)
π
pagerduty_util.py
(13.49 KB)
π
pam.py
(2.01 KB)
π
panos.py
(61.05 KB)
π
parallels.py
(19.85 KB)
π
parted_partition.py
(21.53 KB)
π
pcs.py
(14.11 KB)
π
pdbedit.py
(10.72 KB)
π
pecl.py
(3.79 KB)
π
peeringdb.py
(8.39 KB)
π
pf.py
(9.51 KB)
π
philips_hue.py
(1.55 KB)
π
pillar.py
(21.29 KB)
π
pip.py
(51.76 KB)
π
pkg_resource.py
(11.89 KB)
π
pkgin.py
(17.35 KB)
π
pkgng.py
(61.1 KB)
π
pkgutil.py
(9.88 KB)
π
portage_config.py
(22.77 KB)
π
postfix.py
(16.24 KB)
π
postgres.py
(88.31 KB)
π
poudriere.py
(7.85 KB)
π
powerpath.py
(2.57 KB)
π
proxy.py
(11.49 KB)
π
ps.py
(19.45 KB)
π
publish.py
(10.22 KB)
π
puppet.py
(11.69 KB)
π
purefa.py
(33.03 KB)
π
purefb.py
(13.65 KB)
π
pushbullet.py
(1.88 KB)
π
pushover_notify.py
(3.48 KB)
π
pw_group.py
(4.4 KB)
π
pw_user.py
(12.47 KB)
π
pyenv.py
(6.93 KB)
π
qemu_img.py
(1.53 KB)
π
qemu_nbd.py
(3.28 KB)
π
quota.py
(6.43 KB)
π
rabbitmq.py
(38.44 KB)
π
rallydev.py
(6.09 KB)
π
random_org.py
(23.76 KB)
π
rbac_solaris.py
(16.15 KB)
π
rbenv.py
(10.75 KB)
π
rdp.py
(6.08 KB)
π
rebootmgr.py
(7.66 KB)
π
redismod.py
(16.36 KB)
π
reg.py
(16.36 KB)
π
rest_pkg.py
(2.26 KB)
π
rest_sample_utils.py
(558 B)
π
rest_service.py
(3.63 KB)
π
restartcheck.py
(24.1 KB)
π
ret.py
(1.27 KB)
π
rh_ip.py
(38.01 KB)
π
rh_service.py
(16.61 KB)
π
riak.py
(5.19 KB)
π
rpm_lowpkg.py
(27.61 KB)
π
rpmbuild_pkgbuild.py
(24.53 KB)
π
rsync.py
(8.04 KB)
π
runit.py
(17.14 KB)
π
rvm.py
(11.1 KB)
π
s3.py
(9.93 KB)
π
s6.py
(3.62 KB)
π
salt_proxy.py
(4.48 KB)
π
salt_version.py
(4.29 KB)
π
saltcheck.py
(46.11 KB)
π
saltcloudmod.py
(954 B)
π
saltutil.py
(56.5 KB)
π
schedule.py
(43.35 KB)
π
scp_mod.py
(6.22 KB)
π
scsi.py
(2.66 KB)
π
sdb.py
(2.45 KB)
π
seed.py
(8.87 KB)
π
selinux.py
(23.83 KB)
π
sensehat.py
(7.79 KB)
π
sensors.py
(1.3 KB)
π
serverdensity_device.py
(8.1 KB)
π
servicenow.py
(4.38 KB)
π
slack_notify.py
(7.83 KB)
π
slackware_service.py
(6.89 KB)
π
slsutil.py
(19.05 KB)
π
smartos_imgadm.py
(12.09 KB)
π
smartos_nictagadm.py
(6.51 KB)
π
smartos_virt.py
(5.21 KB)
π
smartos_vmadm.py
(26.37 KB)
π
smbios.py
(10.06 KB)
π
smf_service.py
(8.52 KB)
π
smtp.py
(5.41 KB)
π
snapper.py
(27.14 KB)
π
solaris_fmadm.py
(11.27 KB)
π
solaris_group.py
(2.8 KB)
π
solaris_shadow.py
(7.98 KB)
π
solaris_system.py
(3.72 KB)
π
solaris_user.py
(11.06 KB)
π
solarisipspkg.py
(18.7 KB)
π
solarispkg.py
(15.42 KB)
π
solr.py
(45.54 KB)
π
solrcloud.py
(14.63 KB)
π
splunk.py
(8.15 KB)
π
splunk_search.py
(8.76 KB)
π
sqlite3.py
(2.54 KB)
π
ssh.py
(43.15 KB)
π
ssh_pkg.py
(1.08 KB)
π
ssh_service.py
(3.39 KB)
π
state.py
(78.55 KB)
π
status.py
(57.34 KB)
π
statuspage.py
(14.67 KB)
π
supervisord.py
(11.15 KB)
π
suse_apache.py
(2.45 KB)
π
svn.py
(10.75 KB)
π
swarm.py
(13.5 KB)
π
swift.py
(5.55 KB)
π
sysbench.py
(6.62 KB)
π
sysfs.py
(6.61 KB)
π
syslog_ng.py
(31.55 KB)
π
sysmod.py
(22.59 KB)
π
sysrc.py
(3.38 KB)
π
system.py
(19.28 KB)
π
system_profiler.py
(3.54 KB)
π
systemd_service.py
(46.19 KB)
π
telegram.py
(3.28 KB)
π
telemetry.py
(12.9 KB)
π
temp.py
(831 B)
π
test.py
(14.71 KB)
π
test_virtual.py
(194 B)
π
testinframod.py
(9.92 KB)
π
textfsm_mod.py
(16.22 KB)
π
timezone.py
(19.89 KB)
π
tls.py
(58.68 KB)
π
tomcat.py
(18.59 KB)
π
trafficserver.py
(10.44 KB)
π
transactional_update.py
(42 KB)
π
travisci.py
(2.08 KB)
π
tuned.py
(2.34 KB)
π
twilio_notify.py
(2.95 KB)
π
udev.py
(3.72 KB)
π
upstart_service.py
(16.92 KB)
π
uptime.py
(3.23 KB)
π
useradd.py
(22.3 KB)
π
uwsgi.py
(996 B)
π
vagrant.py
(20.4 KB)
π
varnish.py
(3.08 KB)
π
vault.py
(13.48 KB)
π
vbox_guest.py
(10.55 KB)
π
vboxmanage.py
(14.72 KB)
π
vcenter.py
(455 B)
π
victorops.py
(6.54 KB)
π
virt.py
(290.11 KB)
π
virtualenv_mod.py
(15.08 KB)
π
vmctl.py
(9.6 KB)
π
vsphere.py
(376.7 KB)
π
webutil.py
(3.66 KB)
π
win_auditpol.py
(4.74 KB)
π
win_autoruns.py
(2.29 KB)
π
win_certutil.py
(3.27 KB)
π
win_dacl.py
(32.27 KB)
π
win_disk.py
(1.8 KB)
π
win_dism.py
(18.26 KB)
π
win_dns_client.py
(4.19 KB)
π
win_dsc.py
(26.56 KB)
π
win_file.py
(59.46 KB)
π
win_firewall.py
(20.15 KB)
π
win_groupadd.py
(11.27 KB)
π
win_iis.py
(68.76 KB)
π
win_ip.py
(11.43 KB)
π
win_lgpo.py
(491.78 KB)
π
win_license.py
(2.72 KB)
π
win_network.py
(14.02 KB)
π
win_ntp.py
(1.8 KB)
π
win_path.py
(11.12 KB)
π
win_pkg.py
(84.64 KB)
π
win_pki.py
(15.8 KB)
π
win_powercfg.py
(9.85 KB)
π
win_psget.py
(8.97 KB)
π
win_servermanager.py
(14.33 KB)
π
win_service.py
(32.7 KB)
π
win_shadow.py
(3.03 KB)
π
win_smtp_server.py
(17.67 KB)
π
win_snmp.py
(13.38 KB)
π
win_status.py
(17.04 KB)
π
win_system.py
(40.62 KB)
π
win_task.py
(78.46 KB)
π
win_timezone.py
(13.27 KB)
π
win_useradd.py
(27.53 KB)
π
win_wua.py
(38.29 KB)
π
win_wusa.py
(5.88 KB)
π
winrepo.py
(6.3 KB)
π
wordpress.py
(4.71 KB)
π
x509.py
(62.22 KB)
π
xapi_virt.py
(24.08 KB)
π
xbpspkg.py
(15.89 KB)
π
xfs.py
(15.33 KB)
π
xml.py
(2.14 KB)
π
xmpp.py
(5.28 KB)
π
yumpkg.py
(112.71 KB)
π
zabbix.py
(94.11 KB)
π
zcbuildout.py
(28.19 KB)
π
zenoss.py
(5.64 KB)
π
zfs.py
(34.49 KB)
π
zk_concurrency.py
(11.19 KB)
π
znc.py
(2.26 KB)
π
zoneadm.py
(15.11 KB)
π
zonecfg.py
(21.91 KB)
π
zookeeper.py
(14.72 KB)
π
zpool.py
(44.02 KB)
π
zypperpkg.py
(90.34 KB)
Editing: vbox_guest.py
""" VirtualBox Guest Additions installer """ import contextlib import functools import glob import logging import os import re import tempfile log = logging.getLogger(__name__) __virtualname__ = "vbox_guest" _additions_dir_prefix = "VBoxGuestAdditions" _shared_folders_group = "vboxsf" def __virtual__(): """ Set the vbox_guest module if the OS Linux """ if __grains__.get("kernel", "") not in ("Linux",): return ( False, "The vbox_guest execution module failed to load: only available on Linux" " systems.", ) return __virtualname__ def additions_mount(): """ Mount VirtualBox Guest Additions CD to the temp directory. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_mount :return: True or OSError exception """ mount_point = tempfile.mkdtemp() ret = __salt__["mount.mount"](mount_point, "/dev/cdrom") if ret is True: return mount_point else: raise OSError(ret) def additions_umount(mount_point): """ Unmount VirtualBox Guest Additions CD from the temp directory. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_umount :param mount_point: directory VirtualBox Guest Additions is mounted to :return: True or an string with error """ ret = __salt__["mount.umount"](mount_point) if ret: os.rmdir(mount_point) return ret @contextlib.contextmanager def _additions_mounted(): mount_point = additions_mount() yield mount_point additions_umount(mount_point) def _return_mount_error(f): @functools.wraps(f) def wrapper(*args, **kwargs): try: return f(*args, **kwargs) except OSError as e: return str(e) return wrapper def _additions_install_program_path(mount_point): return os.path.join( mount_point, { "Linux": "VBoxLinuxAdditions.run", "Solaris": "VBoxSolarisAdditions.pkg", "Windows": "VBoxWindowsAdditions.exe", }[__grains__.get("kernel", "")], ) def _additions_install_opensuse(**kwargs): kernel_type = re.sub(r"^(\d|\.|-)*", "", __grains__.get("kernelrelease", "")) kernel_devel = "kernel-{}-devel".format(kernel_type) return __states__["pkg.installed"](None, pkgs=["make", "gcc", kernel_devel]) def _additions_install_ubuntu(**kwargs): return __states__["pkg.installed"](None, pkgs=["dkms"]) def _additions_install_fedora(**kwargs): return __states__["pkg.installed"](None, pkgs=["dkms", "gcc"]) def _additions_install_linux(mount_point, **kwargs): reboot = kwargs.pop("reboot", False) restart_x11 = kwargs.pop("restart_x11", False) upgrade_os = kwargs.pop("upgrade_os", False) if upgrade_os: __salt__["pkg.upgrade"]() # dangerous: do not call variable `os` as it will hide os module guest_os = __grains__.get("os", "") if guest_os == "openSUSE": _additions_install_opensuse(**kwargs) elif guest_os == "ubuntu": _additions_install_ubuntu(**kwargs) elif guest_os == "fedora": _additions_install_fedora(**kwargs) else: log.warning("%s is not fully supported yet.", guest_os) installer_path = _additions_install_program_path(mount_point) installer_ret = __salt__["cmd.run_all"](installer_path) if installer_ret["retcode"] in (0, 1): if reboot: __salt__["system.reboot"]() elif restart_x11: raise NotImplementedError("Restarting x11 is not supported yet.") else: # VirtualBox script enables module itself, need to restart OS # anyway, probably don't need that. # for service in ('vboxadd', 'vboxadd-service', 'vboxadd-x11'): # __salt__['service.start'](service) pass return additions_version() elif installer_ret["retcode"] in (127, "127"): return ( "'{}' not found on CD. Make sure that VirtualBox Guest " "Additions CD is attached to the CD IDE Controller.".format( os.path.basename(installer_path) ) ) else: return installer_ret["stderr"] @_return_mount_error def additions_install(**kwargs): """ Install VirtualBox Guest Additions. Uses the CD, connected by VirtualBox. To connect VirtualBox Guest Additions via VirtualBox graphical interface press 'Host+D' ('Host' is usually 'Right Ctrl'). See https://www.virtualbox.org/manual/ch04.html#idp52733088 for more details. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_install salt '*' vbox_guest.additions_install reboot=True salt '*' vbox_guest.additions_install upgrade_os=True :param reboot: reboot computer to complete installation :type reboot: bool :param upgrade_os: upgrade OS (to ensure the latests version of kernel and developer tools are installed) :type upgrade_os: bool :return: version of VirtualBox Guest Additions or string with error """ with _additions_mounted() as mount_point: kernel = __grains__.get("kernel", "") if kernel == "Linux": return _additions_install_linux(mount_point, **kwargs) def _additions_dir(): root = "/opt" dirs = glob.glob(os.path.join(root, _additions_dir_prefix) + "*") if dirs: return dirs[0] else: raise OSError("No VirtualBox Guest Additions dirs found!") def _additions_remove_linux_run(cmd): uninstaller_ret = __salt__["cmd.run_all"](cmd) return uninstaller_ret["retcode"] in (0,) def _additions_remove_linux(**kwargs): try: return _additions_remove_linux_run( os.path.join(_additions_dir(), "uninstall.sh") ) except OSError: return False def _additions_remove_linux_use_cd(mount_point, **kwargs): force = kwargs.pop("force", False) args = "" if force: args += "--force" return _additions_remove_linux_run( "{program} uninstall {args}".format( program=_additions_install_program_path(mount_point), args=args ) ) @_return_mount_error def _additions_remove_use_cd(**kwargs): """ Remove VirtualBox Guest Additions. It uses the CD, connected by VirtualBox. """ with _additions_mounted() as mount_point: kernel = __grains__.get("kernel", "") if kernel == "Linux": return _additions_remove_linux_use_cd(mount_point, **kwargs) def additions_remove(**kwargs): """ Remove VirtualBox Guest Additions. Firstly it tries to uninstall itself by executing '/opt/VBoxGuestAdditions-VERSION/uninstall.run uninstall'. It uses the CD, connected by VirtualBox if it failes. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_remove salt '*' vbox_guest.additions_remove force=True :param force: force VirtualBox Guest Additions removing :type force: bool :return: True if VirtualBox Guest Additions were removed successfully else False """ kernel = __grains__.get("kernel", "") if kernel == "Linux": ret = _additions_remove_linux() if not ret: ret = _additions_remove_use_cd(**kwargs) return ret def additions_version(): """ Check VirtualBox Guest Additions version. CLI Example: .. code-block:: bash salt '*' vbox_guest.additions_version :return: version of VirtualBox Guest Additions or False if they are not installed """ try: d = _additions_dir() except OSError: return False if d and len(os.listdir(d)) > 0: return re.sub(r"^{}-".format(_additions_dir_prefix), "", os.path.basename(d)) return False def grant_access_to_shared_folders_to(name, users=None): """ Grant access to auto-mounted shared folders to the users. User is specified by its name. To grant access for several users use argument `users`. Access will be denied to the users not listed in `users` argument. See https://www.virtualbox.org/manual/ch04.html#sf_mount_auto for more details. CLI Example: .. code-block:: bash salt '*' vbox_guest.grant_access_to_shared_folders_to fred salt '*' vbox_guest.grant_access_to_shared_folders_to users ['fred', 'roman'] :param name: name of the user to grant access to auto-mounted shared folders to :type name: str :param users: list of names of users to grant access to auto-mounted shared folders to (if specified, `name` will not be taken into account) :type users: list of str :return: list of users who have access to auto-mounted shared folders """ if users is None: users = [name] if __salt__["group.members"](_shared_folders_group, ",".join(users)): return users else: if not __salt__["group.info"](_shared_folders_group): if not additions_version: return ( "VirtualBox Guest Additions are not installed. Ξnstall " "them firstly. You can do it with the help of command " "vbox_guest.additions_install." ) else: return ( "VirtualBox Guest Additions seems to be installed, but " "group '{}' not found. Check your installation and fix " "it. You can uninstall VirtualBox Guest Additions with " "the help of command :py:func:`vbox_guest.additions_remove " "<salt.modules.vbox_guest.additions_remove> (it has " "`force` argument to fix complex situations; use " "it with care) and then install it again. You can do " "it with the help of :py:func:`vbox_guest.additions_install " "<salt.modules.vbox_guest.additions_install>`." "".format(_shared_folders_group) ) else: return "Cannot replace members of the '{}' group.".format( _shared_folders_group ) def list_shared_folders_users(): """ List users who have access to auto-mounted shared folders. See https://www.virtualbox.org/manual/ch04.html#sf_mount_auto for more details. CLI Example: .. code-block:: bash salt '*' vbox_guest.list_shared_folders_users :return: list of users who have access to auto-mounted shared folders """ try: return __salt__["group.info"](_shared_folders_group)["members"] except KeyError: return []
Upload File
Create Folder