[Spacewalk-devel] Java Script on Repositories/Sync page.

2014-03-07 Thread Dimitar Yordanov
Hi all,

   I was working on adding several check-boxes on the Repositories/Sync page 
when it turned out that the check-boxes were somehow disabled.

Channels - Manage Software channels - Some Custom Channael - 
Repositories - Sync
https://sw.redhat.com/rhn/channels/manage/Sync.do?cid=102
/WEB-INF/pages/channel/manage/syncrepos.jsp

It seems it is related to the following Java Script: 

script type=text/javascript
  $(function() {
function toggleStatus() {
  var status = $('fieldset#recurring-picker-${picker.name} 
input[type=radio]:checked').val();
  $('fieldset#recurring-picker-${picker.name} 
.recurring-options[data-status!=' + status + 
'][data-picker-name=${picker.name}]').find('select, input').prop('disabled', 
true);
  $('fieldset#recurring-picker-${picker.name} 
.recurring-options[data-status=' + status + 
'][data-picker-name=${picker.name}]').find('select, input').prop('disabled', 
false);
}
$('fieldset#recurring-picker-${picker.name} 
input[type=radio]').click(function() {
toggleStatus();
});
toggleStatus();
 });
/script


from /WEB-INF/pages/common/fragments/repeat-task-picker.jspf

Dimi


-- 
Dimitar Yordanov
Systems Management, Satellite QA

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] [PATCH] 1070866 - spacewalk-repo-sync fails in case both options --sync-kickstart and --url are specified.

2014-03-04 Thread Dimitar Yordanov
- Original Message -
 From: Michael Mraka michael.mr...@redhat.com
 To: spacewalk-devel@redhat.com
 Sent: Tuesday, March 4, 2014 9:16:07 AM
 Subject: Re: [Spacewalk-devel] [PATCH] 1070866 - spacewalk-repo-sync fails in 
 case both options --sync-kickstart and
 --url are specified.
 
 % From b3be4347594e20a6833896057118b3e349eec1d9 Mon Sep 17 00:00:00 2001
 % From: Dimitar Yordanov dyord...@redhat.com
 % Date: Thu, 27 Feb 2014 16:45:55 +0100
 % Subject: [PATCH] 1070866 - sw-repo-sync fails to sync kickstart.
 %
 % ---
 %  backend/satellite_tools/reposync.py  | 4 +++-
 %  backend/satellite_tools/spacewalk-repo-sync.sgml | 2 +-
 %  2 files changed, 4 insertions(+), 2 deletions(-)
 %
 % diff --git a/backend/satellite_tools/reposync.py
 b/backend/satellite_tools/reposync.py
 % index d336a88..983612e 100644
 % --- a/backend/satellite_tools/reposync.py
 % +++ b/backend/satellite_tools/reposync.py
 % @@ -119,7 +119,9 @@ class RepoSync(object):
 %
 %  if not self.no_errata:
 %  self.import_updates(plugin, url)
 % -if self.sync_kickstart:
 % +
 % +# only for repos obtained from the DB
 % +if self.sync_kickstart and repo_label:
 
 Hi Dimi,
 
 I think ignoring --sync-kickstart when --url is used is not a good
 solution (even if it's stated in man page). Better solution would
 be to require repo_label to be set on command line in such case.
 
  
   Hi Michael,
 
 I was thinking about this solution as well, but at the end decided to 
stick to the solution with restricting kickstart sync only for repositories set 
from WebIU and obtained from the DB.
 My concerns about setting repo_label from CLI are several:
 1. The repo label is used to check if the kickstart is already synced.

   
 if rhnSQL.fetchone_dict(
select id
from rhnKickstartableTree
where org_id = :org_id and channel_id = :channel_id and label = 
:label
, org_id = self.channel['org_id'], channel_id = 
self.channel['id'], label = repo_label):
print Kickstartable tree %s already synced. % repo_label
return

 2. The repo label is used to set the ks path:
 ks_path = 'rhn/kickstart/%s/%s' % ( self.channel['org_id'], repo_label 
)
  
 When a repository is set from WebUI is guaranteed that the repo label is 
unique.
 I have a feeling this will not be possible from CLI.
 
   Dimi
 ...
 %  listitem
 % -paraAttempt to create kickstartable tree (distribution) if
 there is subdirectory images/pxeboot/ under repo's URL./para
 % +paraAttempt to create kickstartable tree (distribution) if
 there is subdirectory images/pxeboot/ under repo's URL. The option is
 ignored for repositories set from CLI via option [-u|--url]./para
 %  /listitem
 %  /varlistentry
 %  /variablelist
 
 
 Regards,
 
 --
 Michael Mráka
 Satellite Engineering, Red Hat
 
 ___
 Spacewalk-devel mailing list
 Spacewalk-devel@redhat.com
 https://www.redhat.com/mailman/listinfo/spacewalk-devel

-- 
Dimitar Yordanov
Systems Management QA
#satellite-qa

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] [PATCH] 1070866 - spacewalk-repo-sync fails in case both options --sync-kickstart and --url are specified.

2014-02-27 Thread Dimitar Yordanov


-- 
Dimitar Yordanov
Systems Management QA
#satellite-qa
From b3be4347594e20a6833896057118b3e349eec1d9 Mon Sep 17 00:00:00 2001
From: Dimitar Yordanov dyord...@redhat.com
Date: Thu, 27 Feb 2014 16:45:55 +0100
Subject: [PATCH] 1070866 - sw-repo-sync fails to sync kickstart.

---
 backend/satellite_tools/reposync.py  | 4 +++-
 backend/satellite_tools/spacewalk-repo-sync.sgml | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index d336a88..983612e 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -119,7 +119,9 @@ class RepoSync(object):
 
 if not self.no_errata:
 self.import_updates(plugin, url)
-if self.sync_kickstart:
+
+# only for repos obtained from the DB
+if self.sync_kickstart and repo_label:
 try:
 self.import_kickstart(plugin, url, repo_label)
 except:
diff --git a/backend/satellite_tools/spacewalk-repo-sync.sgml b/backend/satellite_tools/spacewalk-repo-sync.sgml
index 097ed40..88aee5d 100644
--- a/backend/satellite_tools/spacewalk-repo-sync.sgml
+++ b/backend/satellite_tools/spacewalk-repo-sync.sgml
@@ -144,7 +144,7 @@ Syncs the content from yum repos into Spacewalk or Satellite channels.
 varlistentry
 term--sync-kickstart/term
 listitem
-paraAttempt to create kickstartable tree (distribution) if there is subdirectory images/pxeboot/ under repo's URL./para
+paraAttempt to create kickstartable tree (distribution) if there is subdirectory images/pxeboot/ under repo's URL. The option is ignored for repositories set from CLI via option [-u|--url]./para
 /listitem
 /varlistentry
 /variablelist
-- 
1.8.3.1

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] [PATCH] 1069879 - spacwalk-repo-sync prints the same message for every channel.

2014-02-25 Thread Dimitar Yordanov


-- 
Dimitar Yordanov
Systems Management QA
#satellite-qa
From e54dd0b98837839c7d417fb395c110fe89808573 Mon Sep 17 00:00:00 2001
From: Dimitar Yordanov dyord...@redhat.com
Date: Tue, 25 Feb 2014 21:38:51 +0100
Subject: [PATCH] 1069879 - sw-repo-sync prints message per channel

---
 utils/cloneByDate.py | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/utils/cloneByDate.py b/utils/cloneByDate.py
index 588a1da..7824395 100644
--- a/utils/cloneByDate.py
+++ b/utils/cloneByDate.py
@@ -128,7 +128,11 @@ def main(options):
 
 
 print Reading repository information.
-
+if options.use_update_date:
+options.use_update_date = 'update_date'
+else:
+options.use_update_date = 'issue_date'
+print Using %s. % options.use_update_date
 
 cloners = []
 needed_channels = []
@@ -561,13 +565,8 @@ class ChannelCloner:
  Returns tuple of all available for cloning, and what falls in the date range
 available_errata = self.db_api.applicable_errata(self.from_label, self.to_label)
 to_clone = []
-if self.use_update_date:
-date_to_use = 'update_date'
-else:
-date_to_use = 'issue_date'
-print Using , date_to_use
 for err in available_errata:
-if self.to_date and err[date_to_use].date() = self.to_date.date():
+if self.to_date and err[self.use_update_date].date() = self.to_date.date():
 if self.security_only:
 if err['advisory_type'] == 'Security Advisory':
 to_clone.append(err)
-- 
1.8.3.1

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] [PATCH] 870990 - spacewalk-remove-channel -l can not be used when satellite-sync is running.

2014-02-05 Thread Dimitar Yordanov


-- 
Dimitar Yordanov
Systems Management QA
#satellite-qa
From d4290838141676727db093499230e5b642c25c80 Mon Sep 17 00:00:00 2001
From: Dimitar Yordanov dyord...@redhat.com
Date: Wed, 5 Feb 2014 15:48:56 +0100
Subject: [PATCH] 870990 - sw-rm-ch -l when satellite-sync runs.

---
 backend/satellite_tools/spacewalk-remove-channel | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/backend/satellite_tools/spacewalk-remove-channel b/backend/satellite_tools/spacewalk-remove-channel
index 3ca931d..5b5380f 100755
--- a/backend/satellite_tools/spacewalk-remove-channel
+++ b/backend/satellite_tools/spacewalk-remove-channel
@@ -65,16 +65,6 @@ def main():
 sys.stderr.write('ERROR: must be root to execute\n')
 sys.exit(8)
 
-for command in ['spacewalk-remove-channel', 'satellite-sync',
-'spacewalk-repo-sync']:
-try:
-LOCK.append(rhnLockfile.Lockfile(
-os.path.join(LOCK_DIR, %s.pid % command)))
-except rhnLockfile.LockfileLockedException:
-print(ERROR: An instance of %s is running, exiting. % command)
-sys.exit(-1)
-
-
 global options_table
 parser = OptionParser(option_list=options_table)
 
@@ -89,6 +79,16 @@ def main():
 sys.stderr.write(Nothing to do\n)
 sys.exit(0)
 
+if  not options.list:
+for command in ['spacewalk-remove-channel', 'satellite-sync',
+'spacewalk-repo-sync']:
+try:
+LOCK.append(rhnLockfile.Lockfile(
+os.path.join(LOCK_DIR, %s.pid % command)))
+except rhnLockfile.LockfileLockedException:
+print(ERROR: An instance of %s is running, exiting. % command)
+sys.exit(-1)
+
 initCFG('server')
 initLOG(stdout, options.verbose or 0)
 
-- 
1.8.3.1

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] Clean up embedded Oracle related code.

2014-02-04 Thread Dimitar Yordanov


-- 
Dimitar Yordanov
Systems Management QA
#satellite-qa
From 53403e7eb5b1dbe158a39e32e6d7b360f66c19a0 Mon Sep 17 00:00:00 2001
From: Dimitar Yordanov dyord...@redhat.com
Date: Tue, 4 Feb 2014 15:25:49 +0100
Subject: [PATCH] Clean up - embedded Oracle related code

---
 spacewalk/setup/lib/Spacewalk/Setup.pm | 41 +-
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/spacewalk/setup/lib/Spacewalk/Setup.pm b/spacewalk/setup/lib/Spacewalk/Setup.pm
index 32d3e74..62d3612 100644
--- a/spacewalk/setup/lib/Spacewalk/Setup.pm
+++ b/spacewalk/setup/lib/Spacewalk/Setup.pm
@@ -36,7 +36,7 @@ our $VERSION = '1.1';
 
 use constant SHARED_DIR = /usr/share/spacewalk/setup;
 
-use constant POSTGRESQL_SCHEMA_FILE = File::Spec-catfile(/etc, sysconfig, 
+use constant POSTGRESQL_SCHEMA_FILE = File::Spec-catfile(/etc, sysconfig,
 'rhn', 'postgres', 'main.sql');
 
 use constant POSTGRESQL_DEPLOY_FILE = File::Spec-catfile(/etc, sysconfig,
@@ -376,23 +376,23 @@ sub upgrade_stop_services {
 
 my $spinning_callback_count;
 my @spinning_pattern = split /\n/, EOF;
-.   
- .  
-  o 
-   @
-   (O)  
-(*) 
-   ((%%))   
-(( # )) 
-   ( ( # ) )
- (  (  #  )  )  
-(  !  ) 
-   :
-   .
-   _
-  . .   
-. . 
-
+.
+ .
+  o
+   @
+   (O)
+(*)
+   ((%%))
+(( # ))
+   ( ( # ) )
+ (  (  #  )  )
+(  !  )
+   :
+   .
+   _
+  . .
+. .
+
 EOF
 
 my $spinning_pattern_maxlength = 0;
@@ -509,8 +509,7 @@ sub clear_db {
 
 print loc(** Database: Shutting down spacewalk services that may be using DB.\n);
 
-# The --exclude=oracle is needed for embedded database Satellites.
-system_debug('/usr/sbin/spacewalk-service', '--exclude=oracle', 'stop');
+system_debug('/usr/sbin/spacewalk-service', 'stop');
 
 print loc(** Database: Services stopped.  Clearing DB.\n);
 
@@ -1143,7 +1142,7 @@ sub postgresql_test_db_schema {
 return $row ? 1 : 0;
 }
 
-# Clear the PostgreSQL schema by deleting the 'public' schema with cascade, 
+# Clear the PostgreSQL schema by deleting the 'public' schema with cascade,
 # then re-creating it. Also delete all the other known schemas that
 # Spacewalk might have created.
 
-- 
1.8.3.1

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] [PATCH] 484950 - clear-db flag does'nt do whats it says it does in the --help

2014-02-04 Thread Dimitar Yordanov


-- 
Dimitar Yordanov
Systems Management QA
#satellite-qa
From fd33801c43e02396a6f9937d83fe5a1db801accf Mon Sep 17 00:00:00 2001
From: Dimitar Yordanov dyord...@redhat.com
Date: Tue, 4 Feb 2014 23:12:15 +0100
Subject: [PATCH] 484950 - clear-db flag does not do what in --help

---
 spacewalk/setup/bin/spacewalk-setup | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index 38a001b..61303d2 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -50,6 +50,8 @@ my $product_name = $answers{'product_name'} || 'Spacewalk';
 
 $answers{hostname} ||= Sys::Hostname::hostname;
 
+$opts{skip-db-install} = 1 if $opts{clear-db};
+
 # Skip the logfile init, normally just used when called from install.pl,
 # which already did this.
 if (not $opts{skip-logfile-init}) {
-- 
1.8.3.1

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] Patch: 1058431-sw-remove-channel-does-not-rm-ks-trees

2014-01-28 Thread Dimitar Yordanov
Hi all,

   I tried to fix the problem described in bz1058431 - Spacewalk-remove-channel 
does not remove the kickstart trees.
   You can find my patch enclosed.

Dimi

-- 
Dimitar Yordanov
Systems Management QA
#satellite-qa
From 50cd79f0607322aab39a3d34e48dd8712c87eadb Mon Sep 17 00:00:00 2001
From: Dimitar Yordanov dyord...@redhat.com
Date: Mon, 27 Jan 2014 20:09:53 +0100
Subject: [PATCH] 1058431 - sw-remove-channel does not rm ks trees.

---
 backend/satellite_tools/spacewalk-remove-channel | 71 
 1 file changed, 47 insertions(+), 24 deletions(-)

diff --git a/backend/satellite_tools/spacewalk-remove-channel b/backend/satellite_tools/spacewalk-remove-channel
index f3b5d2e..1b9216c 100755
--- a/backend/satellite_tools/spacewalk-remove-channel
+++ b/backend/satellite_tools/spacewalk-remove-channel
@@ -11,10 +11,10 @@
 # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
 # along with this software; if not, see
 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-# 
+#
 # Red Hat trademarks are not licensed under GPLv2. No permission is
 # granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation. 
+# in this software or its documentation.
 #
 
 import sys
@@ -35,11 +35,11 @@ from spacewalk.server import rhnSQL
 from spacewalk.server.rhnPackage import unlink_package_file
 
 options_table = [
-Option(-v, --verbose,   action=count, 
+Option(-v, --verbose,   action=count,
help=Increase verbosity),
 Option(-l, --list,  action=store_true,
help=List defined channels and exit),
-Option(-c, --channel,   action=append, 
+Option(-c, --channel,   action=append,
help=Delete this channel (can be present multiple times)),
 Option(-u, --unsubscribe,   action=store_true,
help=Unsubscribe systems registered to the specified channels),
@@ -157,7 +157,7 @@ def main():
 def __serverCheck(labels, unsubscribe):
 sql = 
 select distinct S.org_id, S.id, S.name
-from rhnChannel c inner join 
+from rhnChannel c inner join
  rhnServerChannel sc on c.id = sc.channel_id inner join
  rhnServer s on s.id = sc.server_id
 where c.label in (%s)
@@ -187,13 +187,13 @@ def __serverCheck(labels, unsubscribe):
 print str(map['id']).ljust(14),
 print(map['name'])
 
-return len(list) 
+return len(list)
 
 
 def __unsubscribeServers(labels):
 sql = 
 select distinct sc.server_id as server_id, C.id as channel_id, c.parent_channel, c.label
-from rhnChannel c inner join 
+from rhnChannel c inner join
  rhnServerChannel sc on c.id = sc.channel_id
 where c.label in (%s) order by C.parent_channel
 
@@ -231,7 +231,7 @@ def __unsubscribeServers(labels):
 def __kickstartCheck(labels):
 sql = 
 select K.org_id, K.label
-from rhnKSData K inner join 
+from rhnKSData K inner join
  rhnKickstartDefaults KD on KD.kickstart_id = K.id inner join
  rhnKickstartableTree KT on KT.id = KD.kstree_id inner join
  rhnChannel c on c.id = KT.channel_id
@@ -250,7 +250,7 @@ def __kickstartCheck(labels):
   Please remove these or change their associated base channel.\n)
 print('org_id'.ljust(8)),
 print('label')
-print(-*20) 
+print(-*20)
 for map in list:
 print str(map['org_id']).ljust(8),
 print(map['label'])
@@ -260,7 +260,7 @@ def __kickstartCheck(labels):
 
 def __listChannels():
 sql = 
-select c1.label, c2.label parent_channel 
+select c1.label, c2.label parent_channel
 from rhnChannel c1 left outer join rhnChannel c2 on c1.parent_channel = c2.id
 order by c2.label desc, c1.label asc
 
@@ -286,7 +286,7 @@ def __listChannels():
 def delete_channels(channelLabels, force=0, justdb=0, skip_packages=0, skip_channels=0):
 # Get the package ids
 if not channelLabels:
-return 
+return
 
 rpms_ids = list_packages(channelLabels, force=force, sources=0)
 rpms_paths = _get_package_paths(rpms_ids, sources=0)
@@ -297,14 +297,17 @@ def delete_channels(channelLabels, force=0, justdb=0, skip_packages=0, skip_chan
 _delete_srpms(srpms_ids)
 _delete_rpms(rpms_ids)
 
+_delete_ks_files(channelLabels)
+
 if not justdb and not skip_packages:
 _delete_files(rpms_paths + srpms_paths)
 
+
 # Get the channel ids
 h = rhnSQL.prepare(
-select id, parent_channel 
-from rhnChannel 
-where label = :label 
+select id, parent_channel
+from rhnChannel
+where label = :label
 order by parent_channel)
 channel_ids = []
 for label in channelLabels:
@@ -327,7 +330,7 @@ def delete_channels(channelLabels, force=0, justdb=0, skip_packages=0, skip_chan
 ]
 query = 
 delete from %(table_2)s