On 10/01/17 13:57, Tiago Delboni wrote:
Hi Henrik, thanks for helping.

I didn't have a "metadata.json" so I created one with "puppet module
generate". Unfortunately, it is still not working - puppet apply is
showing the same error: "Expected parameter 'windowspath_param' of
'Class[Mymodule::Mymanifest]' to have type Stdlib::Windowspath, got String".

{
  "name": "almg-mymodule",
  "version": "0.1.0",
  "author": "almg",
  "summary": "Test module.",
  "license": "Apache-2.0",
  "source": "",
  "project_page": null,
  "issues_url": null,
  "dependencies": [
    {"name":"puppetlabs-stdlib","version_requirement":">= 4.14.0"}
  ]
}


Maybe there is something wrong with that type.
What does this give you:

   notice('C:\a\valid\path' =~ Stdlib::Windowspath)

If that fails, please report the issue against stdlib.
(Or I am blind and there is something not right about the path).

Best,
- henrik

Em segunda-feira, 9 de janeiro de 2017 11:16:09 UTC-2, Henrik Lindberg
escreveu:

    On 09/01/17 13:02, Tiago Delboni wrote:
    > Hi!
    >
    > I'm having trouble using type Stdlib::Windowspath, from module
    > puppetlabs/stdlib, as a parameter type in a manifest. Is this "custom
    > type" really available? In
    >
    
https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/types/windowspath.pp
    
<https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/types/windowspath.pp>

    > it is defined using the "type" word, which, according to the
    latest doc
    >
    (https://docs.puppet.com/puppet/latest/lang_reserved.html#reserved-words
    <https://docs.puppet.com/puppet/latest/lang_reserved.html#reserved-words>),

    > is "reserved for future use".
    >

    The documentation is behind. The `type` keyword has been operational in
    3.x when used with future parser since some time as well as in
    puppet 4.x.


    > *1. Puppet version (Windows 7):*
    >
    > C:\>puppet --version
    > 4.2.1
    >
    > *2. puppetlabs/stdlib version*
    >
    > C:\>puppet module list --modulepath=c:\git\winpuppet\test\modules
    > c:/git/winpuppet/test/modules
    > +-- mymodule (???)
    > +-- puppetlabs-stdlib (v4.14.0)
    >
    > *3. Manifest (%MODULEPATH%\mymodule\manifests\mymanifest.pp):*
    >
    > |
    > classmymodule::mymanifest (
    >   String$string_param ='a string',
    >   Stdlib::Windowspath$windowspath_param ='C:\a\valid\path'){
    >
    >   notice($string_param)
    >   notice($windowspath_param)
    >
    > }
    > |
    >
    > *4. Execution/error message:*
    >
    > C:\>puppet apply --modulepath=c:\git\winpuppet\test\modules -e
    "include
    > mymodule::mymanifest"
    > Error: Evaluation Error: Error while evaluating a Function Call,
    > Expected parameter 'windowspath_param' of
    'Class[Mymodule::Mymanifest]'
    > to have type Stdlib::Windowspath, got String  at line 1:1 on node
    > xxx.yyy.zzz
    >
    > If, instead, I use a nonexistent type in the manifest, such as
    > "My_nonexistent_type", I got the same error message:
    >
    > C:\>puppet apply --modulepath=c:\git\winpuppet\test\modules -e
    "include
    > mymodule::mymanifest"
    > Error: Evaluation Error: Error while evaluating a Function Call,
    > Expected parameter 'windowspath_param' of
    'Class[Mymodule::Mymanifest]'
    > to have type My_nonexistent_type, got String  at line 1:1 on node
    > xxx.yyy.zzz
    >

    A non-existent type will in some versions of puppet be taken as being a
    resource type.

    One thing you can check is that your module (where you are using
    Stdlib::XXX types have declared a dependency on Stdlib in its metadata.
    If it does not have this it will not find types in Stdlib.

    Regards
    - henrik

    --

    Visit my Blog "Puppet on the Edge"
    http://puppet-on-the-edge.blogspot.se/
    <http://puppet-on-the-edge.blogspot.se/>

--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-users+unsubscr...@googlegroups.com
<mailto:puppet-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/a5e005fc-728b-4948-84af-4d18435ea277%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/a5e005fc-728b-4948-84af-4d18435ea277%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7055963a-95b3-7c04-4b34-78f70ac3ad9c%40puppet.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to