Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vyos-1x-vmware: T3681: don't bytecompile ether-resume.py #920

Merged
merged 1 commit into from
Jul 14, 2021
Merged

vyos-1x-vmware: T3681: don't bytecompile ether-resume.py #920

merged 1 commit into from
Jul 14, 2021

Conversation

yunzheng
Copy link
Contributor

@yunzheng yunzheng commented Jul 14, 2021

Exclude /vmware-tools/scripts/ from bytecompilation to avoid the __pycache__ directory being created.

Change Summary

This change avoids the bytecompilation of ether-resume.py by excluding the /vmware-tools/scripts/ path (regex).
This effectively avoids creating the /etc/vmware-tools/scripts/resume-vm-default.d/__pycache__ directory which causes errors/warnings when resuming a suspended VyOS in VMware.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

vyos-1x-vmware

Proposed changes

This change avoids the byte compilation of the python scripts matching the path /vmware-tools/scripts/. This in turn prevents the __pycache__ directory creation. This directory conflicts with the open-vm-tools resume script as it does not handle directories.

How to test

On VyOS-1.3.0-rc5, check the vyos-1x-vmware package (note the __pycache__ directory):

$ dpkg -L vyos-1x-vmware
/.
/etc
/etc/vmware-tools
/etc/vmware-tools/scripts
/etc/vmware-tools/scripts/resume-vm-default.d
/etc/vmware-tools/scripts/resume-vm-default.d/__pycache__
/etc/vmware-tools/scripts/resume-vm-default.d/__pycache__/ether-resume.cpython-37.pyc
/etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py
/usr
/usr/share
/usr/share/doc/vyos-1x-vmware
/usr/share/doc/vyos-1x-vmware/changelog.Debian.gz
/usr/share/doc/vyos-1x-vmware/copyright

Then performed a build with the new Makefile to ensure the vyos-1x-vmware package doesn't have __pycache__:

# dpkg --contents /vyos-1x-vmware_1.4dev0-1096-g5c352043+dirty_amd64.deb
drwxr-xr-x root/root         0 2021-01-11 18:02 ./
drwxr-xr-x root/root         0 2021-01-11 18:02 ./etc/
drwxr-xr-x root/root         0 2021-01-11 18:02 ./etc/vmware-tools/
drwxr-xr-x root/root         0 2021-01-11 18:02 ./etc/vmware-tools/scripts/
drwxr-xr-x root/root         0 2021-01-11 18:02 ./etc/vmware-tools/scripts/resume-vm-default.d/
-rwxr-xr-x root/root      2145 2021-01-11 18:02 ./etc/vmware-tools/scripts/resume-vm-default.d/ether-resume.py
-rw-r--r-- root/root        33 2021-01-11 18:02 ./etc/vmware-tools/tools.conf
drwxr-xr-x root/root         0 2021-01-11 18:02 ./usr/
drwxr-xr-x root/root         0 2021-01-11 18:02 ./usr/share/
drwxr-xr-x root/root         0 2021-01-11 18:02 ./usr/share/doc/
drwxr-xr-x root/root         0 2021-01-11 18:02 ./usr/share/doc/vyos-1x-vmware/
-rw-r--r-- root/root       324 2021-01-11 18:02 ./usr/share/doc/vyos-1x-vmware/changelog.gz
-rw-r--r-- root/root      1261 2021-01-11 18:02 ./usr/share/doc/vyos-1x-vmware/copyright

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Exclude /vmware-tools/scripts/ from bytecompilation to avoid the
`__pycache__` directory being created.
@c-po c-po merged commit c70027d into vyos:current Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants