Task Puppet Manage Archives - Failed

@Inderpreet @Ayman @kodekloud-support3
I got failed this task. Something is wrong with validation for this task.
image

If you check from below I got it well but it seems to be wrongly validated.

Please assist to resolve this.

@Inderpreet @mmumshad any response to this?

@Duncan could you share your manifets file if possible ?

Hi @Inderpreet,
I have sent you in message.
Thanks.

Marked this Pending for you, can you please try again once.

Thanks @Inderpreet for your feedback. It is fine now.

@Duncan I have pp file like this. But its NOT working. And idea on this to troubleshoot please?

node "*.stratos.xfusioncorp.com" {

include mymodule

}

class mymodule {

archive { ‘/usr/src/media/media.zip’:

ensure => present,

extract => true,

extract_path => ‘/opt/media’,

source => ‘/usr/src/media/media.zip’,

cleanup => true,

}

}

You can’t have an * inside the quotes in a node definition. (See Node definitions). If you need some sort of pattern, you must use RegEx.

@francilio Thanks for your reply and clearcut details with URLs.

I tried with below pp file. By giving only one app server in the node.

[root@jump_host manifests]# cat beta.pp
node "stapp01.stratos.xfusioncorp.com" {
        include mymodule
}

class mymodule {

archive { '/usr/src/beta/beta.zip':
ensure => present,
extract => true,
extract_path => '/opt/beta',
source => '/usr/src/beta/beta.zip',
cleanup => true,
}
}
[root@jump_host manifests]#

In this case… puppet agent --test executed successfully. But I am NOT seeing unziped file on target appserver folder.

[root@stapp01 tony]# puppet agent --test
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for stapp01.stratos.xfusioncorp.com
Info: Applying configuration version '1594609306'
Notice: Applied catalog in 0.18 seconds
[root@stapp01 tony]# cd /opt/beta/
[root@stapp01 beta]# ls
[root@stapp01 beta]#

Any idea on this please?

You ran ls on /opt/beta, but your manifest has /opt/media on extract_path.

@francilio Sorry… that is the copy paste error (copied from notepad, instead of terminal). Updated with latest pp file. Still I am seeing same issue

Hello, balu.networks7

node "stapp01.stratos.xfusioncorp.com" {
        include mymodule
}

class mymodule {

archive { '/opt/beta/beta.zip':
ensure => present,
extract => true,
extract_path => '/opt/beta',
source => '/usr/src/beta/beta.zip',
cleanup => true,
}
}

Thanks so much @Tej-Singh-Rana

It’s working.

@Tej-Singh-Rana @balu.networks7

I dont know how you made this work, but for me it still failed! I cannot understand the reason why. Even with the exact puppet file my file is unable to extract. What am I missing exactly ?

I referred to the complete guide too:
puppet/archive · Compressed archive file download and extraction with native types/providers for Windows and Unix · Puppet Forge

@kleansoul Can you pls post the pp file that you used?

Hello, kleansoul
You don’t need to define path field if you are defining source. extract_path field path put it in the archive module line. Should be like “/opt/games/games.zip”

Hello, kleansoul
I think you have to read my comment again. You did half work.

Sorry, but I am unable to understand the other half part which you are trying to address.

I understood you mean that the extract_path field should be full so that too changed , but the result is same.

Can you please highlight what is wrong in my code. I am trying to learn puppet and did several combinations on archive module in my lab setup but none worked for me yet. Maybe with your help I can learn something new.

Thank you in advance! :slight_smile:

node ‘stapp01.stratos.xfusioncorp.com’ {

archive { ‘/opt/games/games.zip’:
ensure => present,
extract => true,
extract_path => ‘/opt/games/games.zip’,
source => ‘/usr/src/games/games.zip’,
cleanup => true,
}
}
Hope it will help you.

I noticed that you defined source path as it as. You have to define source in the supported uri https|http|file.
For example : source => ‘file:///usr/src/games/games.zip’ from there it will pick your zip file.