Ask Your Question
0

When I try to invoke CURL i get the following message

asked 2017-09-14 11:04:54 -0500

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Serve r Error: Invalid relationship: Exec[install app] { require => Package[curl] }, b ecause Package[curl] doesn't seem to be in the catalog Warning: Not using cache on failed catalog Could not retrieve catalog; skipping run

My Manifest

class pwctestmobility { $ensure = present exec{'install app': command=> "curl -X GET -k -sS -u user:pass https://mdm1-ukstg.pwcinternal.com/ap...summary?adminDeviceSpaceId=1", require => [Package['curl']], path => '/etc/puppetlabs/code/environments/production/modules/mobile/manifests', }

Am using the common phase, new to puppet and coding, so any help would be appreciated . I am trying to deploy a mobile using API which is done via curl

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-09-15 02:43:02 -0500

stivesso gravatar image

It seems like you have not declare a Package Resource (for curl).You declared a relationship (with require), but you didn't declare the resource you are referring to on that dependency.
Add the following to your code and check again (you might also need to share a bit more of that code so that we understand the context).

package { 'curl':
  ensure => present,
}
edit flag offensive delete link more

Comments

Thanks Stivesso, I will post the cord here in a while

Dinesh Rajakumar gravatar imageDinesh Rajakumar ( 2017-09-19 06:02:33 -0500 )edit
1

answered 2017-09-15 01:34:51 -0500

notwithoutcid gravatar image

TLDR: Append package { 'curl': ensure => installed, } somewhere in the class/module/environment where it can be called by this class.

First, let's break this down into a readable format:

class pwctestmobility { 
  $ensure = present 

  exec{'install app': 
    command=> "curl -X GET -k -sS -u user:pass https://mdm1-ukstg.pwcinternal.com/ap...summary?adminDeviceSpaceId=1", 
    require => [Package['curl']], 
    path => '/etc/puppetlabs/code/environments/production/modules/mobile/manifests', 
  }
}

The error indicated that require line. Do you have a package resource declaration for curl? Should look something like:

package { 'curl':
  ensure => installed,
}

Also, while unrelated to the error given, the exec resource "path =>" declaration is the search path used for command execution, (similar to the $PATH environment variable) on the node. So unless the curl executable exists at '/etc/puppetlabs/code/environments/production/modules/mobile/manifests' on each node you plan to push this to it's probably not going to work.

Generally, you need to either declare the absolute path of the executable (ie /usr/bin/curl or similar) or declare the path(s) that it may exist such as:

 path => '/usr/bin'

OR

path => ['/usr/bin', '/usr/sbin'],

You might want to do some more research on those resources:

https://docs.puppet.com/puppet/latest/types/package.html https://docs.puppet.com/puppet/5.2/types/exec.html#exec-attribute-path https://docs.puppet.com/puppet/5.2/metaparameter.html#require

edit flag offensive delete link more

Comments

thanks a lot, I will test this and update back, a basic question, I understand CURL will be installed by default in PE or should we do that

Dinesh Rajakumar gravatar imageDinesh Rajakumar ( 2017-09-19 06:05:29 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-09-14 11:04:54 -0500

Seen: 45 times

Last updated: Sep 15