Jira (PUP-7040) Non-existent services throw an error when attempting to disable them

1 view
Skip to first unread message

Justin Wiley (JIRA)

unread,
Dec 21, 2016, 1:49:03 PM12/21/16
to puppe...@googlegroups.com
Justin Wiley updated an issue
 
Puppet / Bug PUP-7040
Non-existent services throw an error when attempting to disable them
Change By: Justin Wiley
Summary: Non-existent services  shouldn't  throw an error when attempting to disable them .
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Justin Wiley (JIRA)

unread,
Dec 21, 2016, 1:50:04 PM12/21/16
to puppe...@googlegroups.com
Justin Wiley updated an issue
When attempting to disable a service that doesn't exist on a machine, Puppet throws an error:

{noformat}
Error: /Stage[main]/module::Disable_cups/Service[cups]: Could not evaluate: Could not find init script or upstart conf file for 'cups'
{noformat}

{code:ruby}
service {'cups':
  enable => false,
}
{code}

It seems to me that there should be a way to suppress this error, as there are cases in which disabled is the goal, but completely missing is also fine.  This to me would be more in-line with the
 package  {{Package}} module  behavior, where you can say {{ensure => absent}} and it won't throw an error if the package already didn't exist.

Justin Wiley (JIRA)

unread,
Dec 21, 2016, 1:50:04 PM12/21/16
to puppe...@googlegroups.com
Justin Wiley updated an issue
When attempting to disable a service that doesn't exist on a machine, Puppet throws an error:

{noformat}
Error: /Stage[main]/module::Disable_cups/Service[cups]: Could not evaluate: Could not find init script or upstart conf file for 'cups'
{noformat}

{code:ruby}
service {'cups':
  enable => false,
}
{code}

It seems to me that there should be a way to suppress this error, as there are cases in which disabled is the goal, but completely missing is also fine.   This to me would be more in-line with the package behavior, where you can say {{ensure => absent}} and it won't throw an error if the package already didn't exist.

Russell Mull (JIRA)

unread,
May 16, 2017, 4:55:04 PM5/16/17
to puppe...@googlegroups.com

Moses Mendoza (JIRA)

unread,
May 18, 2017, 1:59:19 PM5/18/17
to puppe...@googlegroups.com

Moses Mendoza (JIRA)

unread,
May 18, 2017, 1:59:24 PM5/18/17
to puppe...@googlegroups.com

Branan Riley (JIRA)

unread,
May 23, 2017, 1:32:03 PM5/23/17
to puppe...@googlegroups.com

Ben Ford (JIRA)

unread,
May 23, 2017, 1:40:02 PM5/23/17
to puppe...@googlegroups.com
Ben Ford commented on Bug PUP-7040
 
Re: Non-existent services throw an error when attempting to disable them

What if the error was changed to a warning instead? I can see lots of opportunity for mistakes if it just silently ate the error. For example,

service {'cupsd':
  enable => false,
}

is a perfectly reasonable bit of code to use accidentally and if Puppet didn't warn you, you might never know.

Justin Wiley (JIRA)

unread,
May 23, 2017, 1:58:02 PM5/23/17
to puppe...@googlegroups.com
Justin Wiley commented on Bug PUP-7040

That's a good point, and a warning would be alright in my book since it wouldn't return an exit code that would bomb out a pipeline.

Branan Riley (JIRA)

unread,
May 14, 2018, 2:24:03 PM5/14/18
to puppe...@googlegroups.com
Branan Riley updated an issue
Change By: Branan Riley
Labels: beginner help_wanted service triaged type_and_provider
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (Jira)

unread,
Dec 2, 2020, 5:50:04 PM12/2/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-7040
 
Re: Non-existent services throw an error when attempting to disable them

I can't reproduce this problem. PUP-6822 also shows it's working as expected for linux, but wasn't for windows, so I'm assuming this was fixed in between:

# /usr/bin/systemctl is-enabled -- cups
Failed to get unit file state for cups.service: No such file or directory
# cat manifest.pp
service {'cups':
  enable => false,
}
# puppet apply manifest.pp
Notice: Compiled catalog for XXX in environment production in 0.17 seconds
Notice: Applied catalog in 0.03 seconds

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages