__zypper_repo seems to parse repo_id incorrectly #203
Labels
No labels
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ungleich-public/cdist#203
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: telmich
@dheule does __zypper_repo work for you?
I get this:
INFO: testhost: Executing code for __zypper_repo/nginx
Repository named 'nginx' already exists. Please use another alias.
While using it like this:
Debugging the explorer:
[22:18] artist:.cdist% cat code-remote
zypper -q --non-interactive --gpg-auto-import-keys addrepo 'http://download.opensuse.org/repositories/home:/cberendt:/nginx/SLE_11_SP3/' 'nginx'
[22:18] artist:.cdist% cat explorer/repo_id
[22:19] artist:.cdist% cat parameter/uri
http://download.opensuse.org/repositories/home:/cberendt:/nginx/SLE_11_SP3/
Created by: dheule
Hmm ,,, this error was not so simple.
The grep -E "" matches the beginning of a word (<) then the STRING and then the end of a word (>).
This works as long as not a / is the last char in a line.
So the error is only popping up if a url ends with a / and it is the longest url in all repos configured.
Created by: telmich
Hey Daniel,
I had the problem on SLES 11. Particulary I saw that the grep -E did not
match the URL. The way I currently fixed it is like this:
[14:33] artist:cdist% git d
diff --git a/cdist/conf/type/__zypper_repo/explorer/repo_id b/cdist/conf/type/__zypper_repo/explorer/repo_id
index be0b977..5ae0d03 100644
--- a/cdist/conf/type/__zypper_repo/explorer/repo_id
+++ b/cdist/conf/type/__zypper_repo/explorer/repo_id
@@ -26,4 +26,4 @@ if [ -f "$__object/parameter/uri" ]; then
else
uri="$__object_id"
fi
-echo $(zypper lr -u | grep -E "<$uri>" | cut -d'|' -f 1 | grep -E '^[0-9]' )
+echo $(zypper lr -u | grep -E "$uri" | cut -d'|' -f 1 | grep -E '^[0-9]' )
I think that the URL I have is actually not containing any "<" nor ">".
I saw the output of zypper, which seems to be pretty much cluttered and
was wondering, if there is no better way to parse repos on SuSE?
And I am using the type like this:
Don't know if that's a user problem or a design problem or a parsing problem at the moment ;-)
Many greetings from Philadelphia,
Nico
dheule [Fri, Jun 20, 2014 at 09:03:51AM -0700]:
New PGP key: 659B 0D91 E86E 7E24 FD15 69D0 C729 21A1 293F 2D24
Created by: dheule
Hello Nico,
i was unable to reproduce your problem.
For me on SLES11 SP3 the explorer retrives correctly the repo_id which is a number
and not a name.
The repo_id is allways going from 1 to n
the repo_id is allowing us to delete repos from which we don't know even the name ( used in zypper_ris for example )
Please can you send me the exact os version and an example output from the command 'zypper lr -u' from the host with the problem.
so i will look in the deep ...
Thank you,
Daniel
Created by: telmich
Hey Daniel,
thanks for the notice and enjoy your holidays!
Nico
dheule [Tue, Jun 10, 2014 at 01:40:27PM -0700]:
New PGP key: 659B 0D91 E86E 7E24 FD15 69D0 C729 21A1 293F 2D24
Created by: dheule
Hello Nico.
I will have a look at this
after my holidays. (24.6.)
Regards Daniel
Another thing: I see you are parsing zypper lr output; I guess it would be
easier to not parse it like this, but use:
zypper repos nginx
Alias : nginx
Name : nginx
URI : http://download.opensuse.org/repositories/home:/cberendt->
Enabled : Yes
Priority : 99
Auto-refresh : Off
Keep Packages : Off
Type : rpm-md
GPG Check : On
GPG Key URI :
Path Prefix :
Parent Service :
MD Cache Path : /var/cache/zypp/raw/nginx
and thus: zypper repos nginx | awk '/^URI/ { print $3 }'
http://download.opensuse.org/repositories/home:/cberendt:/nginx/SLE_11_SP3/
What do you think?
—
Reply to this email directly or view it on GitHub
https://github.com/telmich/cdist/issues/341#issuecomment-45666874.
Created by: telmich
Another thing: I see you are parsing zypper lr output; I guess it would be easier to not parse it like this, but use:
zypper repos nginx
Alias : nginx
Name : nginx
URI : http://download.opensuse.org/repositories/home:/cberendt->
Enabled : Yes
Priority : 99
Auto-refresh : Off
Keep Packages : Off
Type : rpm-md
GPG Check : On
GPG Key URI :
Path Prefix :
Parent Service :
MD Cache Path : /var/cache/zypp/raw/nginx
and thus: zypper repos nginx | awk '/^URI/ { print $3 }'
http://download.opensuse.org/repositories/home:/cberendt:/nginx/SLE_11_SP3/
What do you think?