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

Ability to supply ModuleName #23

Open
wernerb opened this issue Jun 2, 2017 · 2 comments
Open

Ability to supply ModuleName #23

wernerb opened this issue Jun 2, 2017 · 2 comments

Comments

@wernerb
Copy link

wernerb commented Jun 2, 2017

Repost of ansible/ansible#24872 (comment)

I am seeing an error with a basic Dsc Resource "File":

- name: blabla
  win_dsc5:
    resource_name: File
    ensure: Present
    destinationpath: |-
      C:\example.txt
    Contents: |
      My content

Output:

Friday 02 June 2017  14:12:45 +0200 (0:00:03.155)       0:00:03.224 ***********
Using module file /Users/werner/projects/nn/aws-platform/ansible/main/playbooks/library/win_dsc5.ps1
<127.0.0.1> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 127.0.0.1
EXEC (via pipeline wrapper)
fatal: [default]: FAILED! => {
    "Attributes": [
        {
            "Key": "ensure",
            "Name": "ensure",
            "Value": "Present"
        },
        {
            "Key": "Contents",
            "Name": "Contents",
            "Value": "My content\n"
        },
        {
            "Key": "destinationpath",
            "Name": "destinationpath",
            "Value": "C:\\example.txt"
        }
    ],
    "Contents": "My content\n",
    "DSCAttributes": {
        "Contents": "My content\n",
        "destinationpath": "C:\\example.txt",
        "ensure": "Present"
    },
    "changed": false,
    "destinationpath": "C:\\example.txt",
    "ensure": "Present",
    "failed": true,
    "resource_name": "File"
}

MSG:

Cannot validate argument on parameter 'ModuleName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

The problem seems to be that Get-Resource can return an empty module (for example for File resource).

Additionally if multiple modules are found there is no way to override or select the proper module to be used.

@wernerb wernerb changed the title ModuleName empty and not required Ability to supply ModuleName Jun 2, 2017
@Sholdaway
Copy link

Hi there. Regarding the module property for the file resource being empty, pretty sure #14 references what you're describing? Within that issue there is a link to a related thread on serverfault.com: https://serverfault.com/questions/778767/invoke-dscresource-against-a-resource-without-a-module

@Sholdaway
Copy link

Sholdaway commented Jun 2, 2017

Also thought I should mention that this is now in the devel branch of the main Ansible product so might be worth raising the issue there:

https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/win_dsc.ps1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants