i’m trying to wield the yumrepo cookbook to control the yum repos i dist
to my systems. by default, the yum_repository resource from the yum
cookbook marks the repo as enabled. so it seems i should be able to
toggle that and make the repo disabled by default. but my attempts are
failing.
this is the yum_repository block from the yumrepo::epel recipe:
yum_repository “epel” do
description "Extra Packages for Enterprise Linux"
key node[‘repo’][‘epel’][‘key’]
url node[‘repo’][‘epel’][‘url’]
mirrorlist true
action :add
end
above the action line i’ve tried adding ‘enabled “0”’ and ‘enabled 0’,
but the /etc/yum.repos.d/epel.repo shows up as “enabled=1”.
I ran into this problem yesterday. In the yum cookbook file
yum/providers/respository.rb, comment out the following line:
unless ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
i'm trying to wield the yumrepo cookbook to control the yum repos i dist
to my systems. by default, the yum_repository resource from the yum
cookbook marks the repo as enabled. so it seems i should be able to
toggle that and make the repo disabled by default. but my attempts are
failing.
this is the yum_repository block from the yumrepo::epel recipe:
yum_repository "epel" do
description "Extra Packages for Enterprise Linux"
key node['repo']['epel']['key']
url node['repo']['epel']['url']
mirrorlist true
action :add
end
above the action line i've tried adding 'enabled "0"' and 'enabled 0',
but the /etc/yum.repos.d/epel.repo shows up as "enabled=1".
disabling the line you mentioned below helped me in another way, but
doesn't address the problem i'm trying to solve:
with the unless condition in place in yum/providers/respository.rb, a
repo file that is already present on a system won't get updated. i
don't like that. :\ .. so for that reason i'd want to disable that
unless (but i don't like hand "patching" the code). are there other
options to updating a repo file in place without first calling
"action :remove", then "action :add" ?
back to the problem at hand, the result that i want is:
.. i want "enabled=0" so yum doesn't access that repo by default. but
there are times when i might want to call upon epel by doing
--enablerepo=epel. and in order to do that, epel.repo must be present
on the filesystem. aye?
thots?
kallen
On Mon, 02 Apr 2012, John Alberts wrote:
I ran into this problem yesterday. In the yum cookbook file
yum/providers/respository.rb, comment out the following line:
unless ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
i'm trying to wield the yumrepo cookbook to control the yum repos i dist
to my systems. by default, the yum_repository resource from the yum
cookbook marks the repo as enabled. so it seems i should be able to
toggle that and make the repo disabled by default. but my attempts are
failing.
this is the yum_repository block from the yumrepo::epel recipe:
yum_repository "epel" do
description "Extra Packages for Enterprise Linux"
key node['repo']['epel']['key']
url node['repo']['epel']['url']
mirrorlist true
action :add
end
above the action line i've tried adding 'enabled "0"' and 'enabled 0',
but the /etc/yum.repos.d/epel.repo shows up as "enabled=1".
disabling the line you mentioned below helped me in another way, but
doesn't address the problem i'm trying to solve:
with the unless condition in place in yum/providers/respository.rb, a
repo file that is already present on a system won't get updated. i
don't like that. :\ .. so for that reason i'd want to disable that
unless (but i don't like hand "patching" the code). are there other
options to updating a repo file in place without first calling
"action :remove", then "action :add" ?
back to the problem at hand, the result that i want is:
.. i want "enabled=0" so yum doesn't access that repo by default. but
there are times when i might want to call upon epel by doing
--enablerepo=epel. and in order to do that, epel.repo must be present
on the filesystem. aye?
Ah, sorry about that. I didn't mean to mislead you. My problem was I
needed to change the baseurl in the repofile, and that unless
statement made it impossible to update any property in the file. I
assumed the same thing was happening to you.
Glad to hear you found your problem.
disabling the line you mentioned below helped me in another way, but
doesn't address the problem i'm trying to solve:
with the unless condition in place in yum/providers/respository.rb, a
repo file that is already present on a system won't get updated. i
don't like that. :\ .. so for that reason i'd want to disable that
unless (but i don't like hand "patching" the code). are there other
options to updating a repo file in place without first calling
"action :remove", then "action :add" ?
back to the problem at hand, the result that i want is:
.. i want "enabled=0" so yum doesn't access that repo by default. but
there are times when i might want to call upon epel by doing
--enablerepo=epel. and in order to do that, epel.repo must be present
on the filesystem. aye?
I ran into this problem yesterday. In the yum cookbook file
yum/providers/respository.rb, comment out the following line:
unless ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
I don't understand the point of this line anyway.
This check doesn't seem to make sense. Essentially, "unless" means "not
if" when testing if the file exists. The template resource should be
idempotent without that File.exists check.
It could lead to undesired behavior if you want to update an already
managed repo file. I cannot say I have ever noticed this effect in all
the time I've used this resource, however. It could possibly be a bug.
Maybe I am reading this wrong, and it has another purpose.
i'm trying to wield the yumrepo cookbook to control the yum repos i dist
to my systems. by default, the yum_repository resource from the yum
cookbook marks the repo as enabled. so it seems i should be able to
toggle that and make the repo disabled by default. but my attempts are
failing.
this is the yum_repository block from the yumrepo::epel recipe:
yum_repository "epel" do
description "Extra Packages for Enterprise Linux"
key node['repo']['epel']['key']
url node['repo']['epel']['url']
mirrorlist true
action :add
end
above the action line i've tried adding 'enabled "0"' and 'enabled 0',
but the /etc/yum.repos.d/epel.repo shows up as "enabled=1".
I ran into this problem yesterday. In the yum cookbook file
yum/providers/respository.rb, comment out the following line:
unless ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
I don't understand the point of this line anyway.
This check doesn't seem to make sense. Essentially, "unless" means "not
if" when testing if the file exists. The template resource within that
block should be idempotent without that File.exists check.
It could lead to undesired behavior if you want to update an already
managed repo. I cannot say I have noticed this effect in all the time
I've used this resource, however. It could be a bug. Unless I am
reading that wrong, and the line is intended for some other purpose.
Well, I see now why the author of the yum cookbook decided to add that
unless statement. If it's not there, the file is update every single
time, which of course then notifies the execute statement for running
yum makecache. This obviously ends up wasting a lot of time for every
chef run. I dont really understand why chef thinks the template has
changed therefore it thinks the file should be updated.
Is anyone else experiencing this if you have removed the 'unless
::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")'
line from yum/providers/repository.rb?
I ran into this problem yesterday. In the yum cookbook file
yum/providers/respository.rb, comment out the following line:
unless ::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")
I don't understand the point of this line anyway.
This check doesn't seem to make sense. Essentially, "unless" means "not if"
when testing if the file exists. The template resource within that block
should be idempotent without that File.exists check.
It could lead to undesired behavior if you want to update an already managed
repo. I cannot say I have noticed this effect in all the time I've used
this resource, however. It could be a bug. Unless I am reading that wrong,
and the line is intended for some other purpose.
Well, I see now why the author of the yum cookbook decided to add that
unless statement. If it's not there, the file is update every single
time, which of course then notifies the execute statement for running
yum makecache. This obviously ends up wasting a lot of time for every
chef run. I dont really understand why chef thinks the template has
changed therefore it thinks the file should be updated.
Is anyone else experiencing this if you have removed the 'unless
::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")'
line from yum/providers/repository.rb?
This smells like a bug. Can you open a ticket with debug log output
from multiple runs? The whole log isn't required, just the relevant
parts of a yum_repo resource getting configured.
Well, I see now why the author of the yum cookbook decided to add that
unless statement. If it's not there, the file is update every single
time, which of course then notifies the execute statement for running
yum makecache. This obviously ends up wasting a lot of time for every
chef run. I dont really understand why chef thinks the template has
changed therefore it thinks the file should be updated.
Is anyone else experiencing this if you have removed the 'unless
::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")'
line from yum/providers/repository.rb?
This smells like a bug. Can you open a ticket with debug log output
from multiple runs? The whole log isn't required, just the relevant
parts of a yum_repo resource getting configured.
So.... apparently I was mistaken. Something must have changed in
these repository files when I was looking at them before, because now
I can see everything is working like it's supposed to. The repo files
are not being regenerated each time like I thought. Sorry for the
extra noise on the mailing list.
Well, I see now why the author of the yum cookbook decided to add that
unless statement. If it's not there, the file is update every single
time, which of course then notifies the execute statement for running
yum makecache. This obviously ends up wasting a lot of time for every
chef run. I dont really understand why chef thinks the template has
changed therefore it thinks the file should be updated.
Is anyone else experiencing this if you have removed the 'unless
::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")'
line from yum/providers/repository.rb?
This smells like a bug. Can you open a ticket with debug log output
from multiple runs? The whole log isn't required, just the relevant
parts of a yum_repo resource getting configured.
So.... apparently I was mistaken. Something must have changed in
these repository files when I was looking at them before, because now
I can see everything is working like it's supposed to. The repo files
are not being regenerated each time like I thought. Sorry for the
extra noise on the mailing list.
Well, I see now why the author of the yum cookbook decided to add that
unless statement. If it's not there, the file is update every single
time, which of course then notifies the execute statement for running
yum makecache. This obviously ends up wasting a lot of time for every
chef run. I dont really understand why chef thinks the template has
changed therefore it thinks the file should be updated.
Is anyone else experiencing this if you have removed the 'unless
::File.exists?("/etc/yum.repos.d/#{new_resource.repo_name}.repo")'
line from yum/providers/repository.rb?
This smells like a bug. Can you open a ticket with debug log output
from multiple runs? The whole log isn't required, just the relevant
parts of a yum_repo resource getting configured.