Skocz do zawartości

[Python] Prośba O Sprawdzenie Kodu


borzole

Rekomendowane odpowiedzi

Witam.

Ponieważ nie mam żadnego mentora w python to będę Was męczył, cieszycie się :D

Wczoraj skończyłem przerabiać swój plugin dla yum (to co było wcześniej to tylko tak, aby działał). Obecny kształt uważam na ~90% poprawny.

Na dole strony jest paczka dla F14, ale na F13 powinna się zainstalować.

A teraz wszystkie dobre dusze poproszę o wyczerpujące komentarze co się nie podoba w kodzie lub działaniu pluginu, a nawet paczki rpm.

Plugin okazał się bardzo pomocny przy upgrade fedorki, kiedy wygenerowało się sporo plików *.rpmnew.

 

ps. proszę moderatorów nie traktować tego jak tani chwyt na reklamę bloga :)

Odnośnik do komentarza
Udostępnij na innych stronach

No to ja spróbowałem. Po zainstalowaniu wtyczki "yum update". Odnalazło mi dwa pliki typu *.rpmnew. Wyszedłem z melda, nie kasowałem plików. Update zakończył się błędami jak niżej

 

[root@F13 fedora]# yum update

Wczytane wtyczki: hg, langpacks, presto, protectbase, refresh-packagekit

Adding pl_PL to language list

0 packages excluded due to repository protections

Ustawianie procesu aktualizacji

Brak pakietów oznaczonych do aktualizacji

111d110

< set sensor1 3

270c269

< chip "w83627ehf-*" "w83627dhg-*"

---

> chip "w83627ehf-*" "w83627dhg-*" "w83667hg-*"

274c273

< label in3 "VCC"

---

> label in3 "+3.3V"

2a3

>

6c7,8

< # if a backend is particularly slow you can raise this timeout here

---

>

> # If a back end is particularly slow you can raise this timeout here

9,13d10

< # domains = LOCAL,LDAP

< # SSSD will not start if you don't configure any domain.

< # Add new domains condifgurations as [domain/<NAME>] sections.

< # Then add the list of domains (in the order you want them to be

< # queried in the 'domains" attribute above and uncomment it

14a12,16

> # SSSD will not start if you do not configure any domains.

> # Add new domain configurations as [domain/<NAME>] sections, and

> # then add the list of domains (in the order you want them to be

> # queried) to the "domains" attribute below and uncomment it.

> ; domains = LOCAL,LDAP

17,19c19,21

< # the following prevents sssd for searching for the root user/group in

< # all domains (you can add here a comma separated list of system accounts are

< # always going to be /etc/passwd users, or that you want to filter out)

---

> # The following prevents SSSD from searching for the root user/group in

> # all domains (you can add here a comma-separated list of system accounts that

> # are always going to be /etc/passwd users, or that you want to filter out).

24,26c26,28

< # The EntryCacheTimeout indicates the number of seconds to retain before

< # an entry in cache is considered stale and must block to refresh.

< # The EntryCacheNoWaitRefreshTimeout indicates the number of seconds to

---

> # The entry_cache_timeout indicates the number of seconds to retain an

> # entry in cache before it is considered stale and must block to refresh.

> # The entry_cache_nowait_timeout indicates the number of seconds to

28,31c30,33

< # be returned from cache until the full EntryCacheTimeout). Setting this

< # value to 0 turns this feature off (default)

< # entry_cache_timeout = 600

< # entry_cache_nowait_timeout = 300

---

> # be returned from cache until the full entry_cache_timeout). Setting this

> # value to 0 turns this feature off (default).

> ; entry_cache_timeout = 600

> ; entry_cache_nowait_timeout = 300

35a38,44

> # Example domain configurations

> # Note that enabling enumeration in the following configurations will have a

> # moderate performance impact while enumerations are actually running, and

> # may increase the time necessary to detect network disconnection.

> # Consequently, the default value for enumeration is FALSE.

> # Refer to the sssd.conf man page for full details.

>

37c46

< # directory. These local users and groups are not visibile in /etc/passwd, it

---

> # directory. These local users and groups are not visible in /etc/passwd; it

39,44c48,53

< # [domain/LOCAL]

< # description = LOCAL Users domain

< # id_provider = local

< # enumerate = true

< # min_id = 500

< # max_id = 999

---

> ; [domain/LOCAL]

> ; description = LOCAL Users domain

> ; id_provider = local

> ; enumerate = true

> ; min_id = 500

> ; max_id = 999

47,49c56,58

< # ldap_schema can be set to 'rfc2307', which uses the 'memberuid' attribute

< # for group membership, or to 'rfc2307bis', which uses the 'member' attribute

< # to denote group membership. Changes to this setting affects only how we

---

> # ldap_schema can be set to "rfc2307", which uses the "memberuid" attribute

> # for group membership, or to "rfc2307bis", which uses the "member" attribute

> # to denote group membership. Changes to this setting affect only how we

53,61c62,70

< # [domain/LDAP]

< # id_provider = ldap

< # auth_provider = ldap

< # ldap_schema = rfc2307

< # ldap_uri = ldap://ldap.mydomain.org

< # ldap_user_search_base = dc=mydomain,dc=org

< # ldap_tls_reqcert = demand

< # cache_credentials = true

< # enumerate = true

---

> ; [domain/LDAP]

> ; id_provider = ldap

> ; auth_provider = ldap

> ; ldap_schema = rfc2307

> ; ldap_uri = ldap://ldap.mydomain.org

> ; ldap_search_base = dc=mydomain,dc=org

> ; ldap_tls_reqcert = demand

> ; cache_credentials = true

> ; enumerate = False

65,88c74,98

< # [domain/AD]

< # description = LDAP domain with AD server

< # enumerate = false

< # min_id = 1000

< #

< # id_provider = ldap

< # auth_provider = ldap

< # ldap_uri = ldap://your.ad.server.com

< # ldap_schema = rfc2307bis

< # ldap_user_search_base = cn=users,dc=example,dc=com

< # ldap_group_search_base = cn=users,dc=example,dc=com

< # ldap_default_bind_dn = cn=Administrator,cn=Users,dc=example,dc=com

< # ldap_default_authtok_type = password

< # ldap_default_authtok = YOUR_PASSWORD

< # ldap_user_object_class = person

< # ldap_user_name = msSFU30Name

< # ldap_user_uid_number = msSFU30UidNumber

< # ldap_user_gid_number = msSFU30GidNumber

< # ldap_user_home_directory = msSFU30HomeDirectory

< # ldap_user_shell = msSFU30LoginShell

< # ldap_user_principal = userPrincipalName

< # ldap_group_object_class = group

< # ldap_group_name = msSFU30Name

< # ldap_group_gid_number = msSFU30GidNumber

---

> ; [domain/AD]

> ; description = LDAP domain with AD server

> ; enumerate = false

> ; min_id = 1000

> ;

> ; id_provider = ldap

> ; auth_provider = ldap

> ; ldap_uri = ldap://your.ad.server.com

> ; ldap_schema = rfc2307bis

> ; ldap_user_search_base = cn=users,dc=example,dc=com

> ; ldap_group_search_base = cn=users,dc=example,dc=com

> ; ldap_default_bind_dn = cn=Administrator,cn=Users,dc=example,dc=com

> ; ldap_default_authtok_type = password

> ; ldap_default_authtok = YOUR_PASSWORD

> ; ldap_user_object_class = person

> ; ldap_user_name = msSFU30Name

> ; ldap_user_uid_number = msSFU30UidNumber

> ; ldap_user_gid_number = msSFU30GidNumber

> ; ldap_user_home_directory = msSFU30HomeDirectory

> ; ldap_user_shell = msSFU30LoginShell

> ; ldap_user_principal = userPrincipalName

> ; ldap_group_object_class = group

> ; ldap_group_name = msSFU30Name

> ; ldap_group_gid_number = msSFU30GidNumber

> ; ldap_force_upper_case_realm = True

Error in atexit._run_exitfuncs:

Traceback (most recent call last):

File "/usr/lib64/python2.6/atexit.py", line 24, in _run_exitfuncs

func(*targs, **kargs)

File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 183, in run

func(conduitcls(self, self.base, conf, **kwargs))

File "/usr/lib/yum-plugins/hg.py", line 78, in close_hook

repo(conduit,dir)

File "/usr/lib/yum-plugins/hg.py", line 34, in repo

hg_ci(conduit,path)

File "/usr/lib/yum-plugins/hg.py", line 18, in hg_ci

subprocess.check_call([hg, "st"],stdout=DEVNULL,stderr=DEVNULL)

File "/usr/lib64/python2.6/subprocess.py", line 483, in check_call

retcode = call(*popenargs, **kwargs)

File "/usr/lib64/python2.6/subprocess.py", line 470, in call

return Popen(*popenargs, **kwargs).wait()

File "/usr/lib64/python2.6/subprocess.py", line 621, in __init__

errread, errwrite)

File "/usr/lib64/python2.6/subprocess.py", line 1126, in _execute_child

raise child_exception

OSError: [Errno 2] Nie ma takiego pliku ani katalogu

Error in sys.exitfunc:

Traceback (most recent call last):

File "/usr/lib64/python2.6/atexit.py", line 24, in _run_exitfuncs

func(*targs, **kargs)

File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 183, in run

func(conduitcls(self, self.base, conf, **kwargs))

File "/usr/lib/yum-plugins/hg.py", line 78, in close_hook

repo(conduit,dir)

File "/usr/lib/yum-plugins/hg.py", line 34, in repo

hg_ci(conduit,path)

File "/usr/lib/yum-plugins/hg.py", line 18, in hg_ci

subprocess.check_call([hg, "st"],stdout=DEVNULL,stderr=DEVNULL)

File "/usr/lib64/python2.6/subprocess.py", line 483, in check_call

retcode = call(*popenargs, **kwargs)

File "/usr/lib64/python2.6/subprocess.py", line 470, in call

return Popen(*popenargs, **kwargs).wait()

File "/usr/lib64/python2.6/subprocess.py", line 621, in __init__

errread, errwrite)

File "/usr/lib64/python2.6/subprocess.py", line 1126, in _execute_child

raise child_exception

OSError: [Errno 2] Nie ma takiego pliku ani katalogu

 

 

Na zawodowstwo mógłbyś przejść i jakiś podpis do paczek dołączać ;)

 

[EDIT]

Fedora 13 x86_64 - widać niby w logach, ale żeby nie było wątpliwości.

 

[EDIT 2]

Na F14 też coś słabo

 

 

[root@F14 ~]# yum update -d 10

Wczytywanie wtyczki "hg"

Wczytywanie wtyczki "langpacks"

Wczytywanie wtyczki "presto"

Running "config" handler for "langpacks" plugin

Adding pl_PL to language list

Running "config" handler for "presto" plugin

Config time: 0.126

Yum Version: 3.2.28

COMMAND: yum update -d 10

Installroot: /

Ustawianie zestawów pakietów

pkgsack time: 0.081

Odczytywanie lokalnej bazy danych RPM

rpmdb time: 0.000

Ustawianie procesu aktualizacji

Aktualizowanie wszystkiego

Budowanie obiektu aktualizacji

up:Obs Init time: 0.433

putting libpng in simple update

 

// tutaj lista chyba wszystkich pakietów jakie mam w systemie w formacie

// putting <nazwa pakietu> in simple update

// wycinam

 

up:simple updates time: 0.418

up:obs time: 0.009

up:condense time: 0.000

updates time: 1.741

Brak pakietów oznaczonych do aktualizacji

Running "close" handler for "hg" plugin

hg: /etc

 

//tutaj zwis, czekam kilka minut, w końcu wciskam Ctrl-C

 

^CError in atexit._run_exitfuncs:

Traceback (most recent call last):

File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs

func(*targs, **kargs)

File "/usr/lib/python2.7/site-packages/yum/plugins.py", line 183, in run

func(conduitcls(self, self.base, conf, **kwargs))

File "/usr/lib/yum-plugins/hg.py", line 112, in close_hook

main(path)

File "/usr/lib/yum-plugins/hg.py", line 100, in main

mercurial(path)

File "/usr/lib/yum-plugins/hg.py", line 37, in mercurial

sh(hg+" addremove")

File "/usr/lib/yum-plugins/hg.py", line 20, in sh

p.wait()

File "/usr/lib64/python2.7/subprocess.py", line 1242, in wait

pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)

File "/usr/lib64/python2.7/subprocess.py", line 471, in _eintr_retry_call

return func(*args)

KeyboardInterrupt

Error in sys.exitfunc:

 

 

 

F14 64-bitowa, wczoraj instalowana z netinst z domyślnym zestawem pakietów.

Odnośnik do komentarza
Udostępnij na innych stronach

ale kicha :ph34r:

* w przypadku F13 to po funkcjach widzę, że użyłeś starej wersji (moja wina, powinienem ją wyrzucić), więc nawet nie będę wnikał co poszło nie tak

* w przypadku F14 to ....dobra, rzeczywiście wsi.

Wszystko robiłem na już istniejącym repo i z tego co udało mi się ustalić to plugin działa, jeśli repo już istnieje i był pierwszy commit. Zawieszenie następuje przy poleceniu 'hg addremove' i na razie nie mam zielonego pojęcia dlaczego, bo ręcznie wydane działa :unsure: To jest chyba problem węża.

 

Jeśli wykonasz inicjacje repo:

su -
cd /etc
hg init
hg add
hg ci -m 'Wejście smoka'
chmod 700 .hg

to potem plugin będzie już działał.

 

* myślałem nad tym, czy by nie dać predefiniowanego pliku .hgignore chociaż dla /etc

Odnośnik do komentarza
Udostępnij na innych stronach

hg ci -m 'Wejscie smoka'

No strach tak jakos :) Zabija jakas "wibrujaca reka"

Dzisiaj juz nie sprawdze. Jutro wejde na F14 i dam znac co i jak.

 

Sie nie stresuj... :) Wtyczka fajna jest, bo ja np. nigdy nie wiem czy po takiej instalacji wrzucac nowa czy zostawic stara wersje konfiga.

A F13 sie nie przejmuj, bo to zaraz historia bedzie a zanim dopracujesz to moze chwila minac - byle zapal nie minal ;)

 

[EDIT]

A ja slabo w temacie - meld ma wersje tesktowa/konsolowa? Czy to tylko wtyczka graficzna/desktopowa jest?

Odnośnik do komentarza
Udostępnij na innych stronach

Poprawilem, powinno byc juz dobrze.

 

* Dodalem przykladowy plik /etc/.hgignore zeby taki glupotek jak adiustacja czasu, czy cache nie wychwytywal.

Jesli plik juz jest w repo, a chcemy go ignorowac to trzeba go najpierw zapomniec: hg forget pliczunio

* Zauwazylem, ze mozna w configu podac 'echo' jako sciezke do 'hg' i wówczas plugin nie bedzie tworzyl repozytorium mercuriala, ale nadal bedzie porównywal pliki *.rpmsave & *.rpmnew

 

[EDIT]

jeszcze moze takie pierdólki:

* repo mozna sobie obejrzec wklepujac

cd /etc

hg view

ladniejsza wersja po zainstalowaniu tortoisehg, wówczas wklepujemy

hgtk log

* w konsoli mozna miec wpisana nazwe galezi repo, jesli do .bashrc doda sie taki wpis:

hg_branch() {
ref=$(hg branch 2> /dev/null) && echo " hg:${ref#refs/heads/}"
}
# hg branch
PS1+='\[\033[31m\]$(hg_branch)\[\033[0m\]'
# domkniecie
PS1+=']\$ '

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
×
×
  • Dodaj nową pozycję...