Closed jorioux closed 5 years ago
Thanks for testing it on powershell core. What happens if you install the module as F5-LTM? Will PS then automatically pick F5-LTM.psd1 as the module data file?
If I install the module as F5-LTM
(in caps):
PS /root/.local/share/powershell/Modules> Install-Module F5-LTM -Verbose
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='F5-LTM'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'F5-LTM'.
VERBOSE: Performing the operation "Install-Module" on target "Version '1.4.276' of module 'f5-ltm'".
VERBOSE: Module 'f5-ltm' was installed successfully to path '/root/.local/share/powershell/Modules/f5-ltm/1.4.276'.
So it finds the module, but installs it as f5-ltm
still. Now if I try to import it using either f5-ltm
or F5-LTM
, it fails:
Import-Module : The specified module 'F5-LTM' was not loaded because no valid module file was found in any module directory.
Import-Module : The specified module 'f5-ltm' was not loaded because no valid module file was found in any module directory.
To make it work, I must rename the f5-ltm
folder to F5-LTM
:
Rename-Item -Path /root/.local/share/powershell/Modules/f5-ltm -NewName F5-LTM
Now I can import the module. I also tested to rename the .psd1 and .psm1 files to lowercase and leave the folder as f5-ltm
(lowercase), and it also works. So you have 2 options, either rename the folder to uppercase, or rename the files to lowercase.
In the end, the folder AND the psd1/psm1 files must be in the same case. What do you think?
I think that there's something with how the module is defined in the PSGallery - it's registered as lower case there. The folder on github is already defined as uppercase. I don't see a way to change the name / case of the moduel in PSGallery though. I wonder if I'll be forced to change the case in github.
Github and PSGallery are two separate things. The issue is really the case used when the module got created on the PSGallery.
You may want to ask the PSGallery support
Or maybe unpublishing the module and republishing it with the correct case would work.
I've contacted PSGallery support. I'll see what they come back with and go from therer
PSGallery support renamed the module to F5-LTM. Please try importing it now and see if that resolves the issue. Thanks.
It works perfectly now, thanks joel!
Awesome! Glad to hear it. Thanks for the assist.
When installed with "install-module f5-ltm" on linux, this module installs correctly, but then it can't be imported and it not found when I do "get-module -listavailable".
Here is the explanation from this page: https://docs.microsoft.com/en-us/powershell/scripting/whats-new/known-issues-ps6?view=powershell-6
Powershell automatically picks the file.psd1 when loading a module, so it picks the file "f5-ltm.psd1", and since linux is case-sensitive, it can't find that file because the real file name is "F5-LTM.psd1". So these are two different files on a linux file system.
So you would need to rename the module to "F5-LTM", or rename the psd1 file to "f5-ltm.psd1".