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

make suppressed types/paths per globalconfig and set on startup if not set before #1359

Merged
merged 4 commits into from Oct 16, 2020

Conversation

Jimmy-653
Copy link
Contributor

More like this?

@coveralls
Copy link

coveralls commented Oct 14, 2020

Coverage Status

Coverage remained the same at 87.975% when pulling a7c836d on J-Jimmy:upstream/1339_suppressed_types_paths into 4b4c269 on oshi:master.

@dbwiddis
Copy link
Member

On the right track, but way too much new code. Most of the structure to do this is already there. All you should need to do is:

  • Move the strings defining the different filesystems / paths from AbstractFileSystem into the config file oshi.properties (src/main/resources). So, for example you'd have:
# Filesystem types which do not display in a "local" filesystem search
oshi.filesystem.network.types=afs,cifs,smbfs,sshfs,ncpfs,ncp,nfs,nfs4,gfs,gds2,glusterfs
  • Change the constant declarations in AbstractFileSystem to pull from the GlobalConfig. Declare a public constant in the class matching the config file, e.g., OSHI_FILESYSTEM_NETWORK_TYPES="oshi.filesystem.network.types" and use that constant in GlobalConfig.get().

The config will read in the default from the config file, optionally change it shortly after startup using GlobalConfig.set(), and the first time any user instantiates a FileSystem object it will create those string arrays from the current value in the config.

So most of the changes are just in AbstractFileSystem and oshi.properties. Possibly update the javadocs to reference the functionality.

Do similar for the pseudo FS types which is where "overlay" is being removed.

See the top of file AbstractOperatingSystem for an example of how oshi.os.unix.whoCommand is defined similarly, or WindowsOSProcess for oshi.os.windows.commandline.batch. The difference here is instead of a boolean you'll be reading in a comma-delimited string and parsing it (split()) into a String array.

@dbwiddis dbwiddis added the hacktoberfest-accepted Accepted during Hacktoberfest label Oct 14, 2020
@Jimmy-653
Copy link
Contributor Author

I've now changed it.
Sorry for taking so much of your time, but seeing how you would approach things definitely helps to learn for future tasks.

@dbwiddis
Copy link
Member

Thanks, this looks good! I'll want to run some tests but expect to merge tonight.

@Jimmy-653
Copy link
Contributor Author

I'm not sure about this build exception:
"Unresolveable build extension: Plugin org.apache.maven.wagon:wagon-ssh:3.4.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.wagon:wagon-ssh:jar:3.4.0 @"
It works locally...?

@dbwiddis
Copy link
Member

Occasionally the CI containers have network issues and don't download things. I've rerun tests and they're all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted during Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants