web/modules/rhn/RHN/DB/ChannelEditor.pm | 26 --------
web/modules/sniglets/Sniglets/ChannelEditor.pm | 75 -------------------------
web/modules/sniglets/Sniglets/ServerActions.pm | 73 ------------------------
3 files changed, 174 deletions(-)
New commits:
commit 080a3278edb7d80783f02a8dc269c503435ce51f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 22 10:06:06 2009 +0100
rhn:schedule_config_action_cb not used, removing, as well as
schedule_config_action_cb.
diff --git a/web/modules/sniglets/Sniglets/ServerActions.pm
b/web/modules/sniglets/Sniglets/ServerActions.pm
index a1f3369..5751671 100644
--- a/web/modules/sniglets/Sniglets/ServerActions.pm
+++ b/web/modules/sniglets/Sniglets/ServerActions.pm
@@ -59,7 +59,6 @@ sub register_callbacks {
$pxt->register_callback('rhn:sscd_reboot_servers_cb' =>
\&sscd_reboot_servers_cb);
- $pxt->register_callback('rhn:schedule_config_action_cb' =>
\&schedule_config_action_cb);
$pxt->register_callback('rhn:add_managed_files_to_set_cb' =>
\&add_managed_files_to_set_cb);
$pxt->register_callback('rhn:add_managed_filenames_to_set_cb' =>
\&add_managed_filenames_to_set_cb);
$pxt->register_callback('rhn:schedule_ssm_config_action_cb' =>
\&schedule_ssm_config_action_cb);
@@ -442,78 +441,6 @@ my %config_actions = ('configfiles.verify' =>
'verification',
'configfiles.upload' => 'upload',
'configfiles.deploy' => 'deploy');
-sub schedule_config_action_cb {
- my $pxt = shift;
- my $sid = $pxt->param('sid');
- die "no server id" unless $sid;
-
- PXT::Utils->untaint(\$sid);
-
- my $action;
-
- foreach my $action_type (keys %config_actions) {
- $action = $action_type if $pxt->dirty_param($action_type);
- }
-
- die "no action" unless $action;
-
- my $set_label = $pxt->dirty_param('set_label') || '';
- my $set = RHN::Set->lookup(-label => $set_label, -uid =>
$pxt->user->id);
- my %ids = map { ( $_, 1 ) } $set->contents;
-
- my $count = scalar $set->contents;
-
- $set->empty;
- $set->commit;
-
- my $server = RHN::Server->lookup(-id => $sid);
-
- my $action_id;
- my $earliest_date = Sniglets::ServerActions->parse_date_pickbox($pxt);
-
- if ($action eq 'configfiles.upload') {
- my @filename_ids = keys %ids;
-
- my $dest_type = $pxt->dirty_param('destination_channel_type') ||
'sandbox';
-
- my $ccid = RHN::ConfigChannel->vivify_server_config_channel($sid, $dest_type eq
'sandbox' ? 'server_import' : 'local_override');
-
- ($action_id) = RHN::Scheduler->schedule_config_upload(-org_id =>
$pxt->user->org_id,
- -user_id => $pxt->user->id,
- -earliest => $earliest_date,
- -server_id => $sid,
- -action_name => 'Configuration ' . $config_actions{$action},
- -filename_ids => [@filename_ids],
- -config_channel_id => $ccid,
- );
-
- }
- else {
- my @revisions;
-
- foreach my $revision ($server->latest_managed_config_revisions()) {
- # skip file/rev unless it's truly under management on the server...
- next unless $ids{$revision->{LATEST_CONFIG_REVISION_ID}};
- push @revisions, $revision->{LATEST_CONFIG_REVISION_ID};
- }
-
-
- ($action_id) = RHN::Scheduler->schedule_config_action(-org_id =>
$pxt->user->org_id,
- -user_id => $pxt->user->id,
- -earliest => $earliest_date,
- -server_id => $sid,
- -action_type => $action,
- -action_name => 'Configuration ' . $config_actions{$action},
- -revision_ids => [@revisions],
- );
- }
-
- $pxt->push_message( site_info =>
- sprintf('System config <strong><a
href="/network/systems/details/history/event.pxt?sid=%d&hid=%d">%s</a></strong>
scheduled for <strong>%d</strong> file%s.',
- $sid, $action_id, $config_actions{$action}, $count, $count == 1 ? '' :
's') );
-
$pxt->redirect("/rhn/systems/details/configuration/Overview.do?sid=$sid");
-}
-
sub _schedule_config_action {
my $user = shift;
my $action = shift;
commit d760f4fda97072eeb37077651aa36e76b096c381
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 22 10:01:50 2009 +0100
Removal of channel_delete_cb made delete_channel unused, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm
b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index 57e65f0..d84a281 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -203,32 +203,6 @@ EOQ
return @channels;
}
-sub delete_channel {
- my $class = shift;
- my $cid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth;
-
- my $channel = RHN::Channel->lookup(-id => $cid);
-
- die "Attempt to delete RHN channel '$cid'" unless
$channel->org_id;
-
- $sth = $dbh->prepare(<<EOQ);
-INSERT
- INTO rhnRepoRegenQueue
- (id, channel_label, client, reason, force, bypass_filters, next_action, created,
modified)
-VALUES (rhn_repo_regen_queue_id_seq.nextval,
- :label, 'perl-web::delete_channel', NULL, 'N', 'N',
sysdate, sysdate, sysdate)
-EOQ
-
- $sth->execute_h(label => $channel->label);
-
- $dbh->call_procedure('delete_channel', $cid);
-
- $dbh->commit;
-}
-
#remove all packages from channel, and replace with contents of set.
#Caller is responsible for making sure the user is allowed to do this
sub replace_channel_packages {
commit 252364ae09db8f2b99021d3bd979117ecedb7987
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 22 10:00:03 2009 +0100
rhn:channel_delete_cb not used, removing, as well as channel_delete_cb.
diff --git a/web/modules/sniglets/Sniglets/ChannelEditor.pm
b/web/modules/sniglets/Sniglets/ChannelEditor.pm
index bfc32e5..3285543 100644
--- a/web/modules/sniglets/Sniglets/ChannelEditor.pm
+++ b/web/modules/sniglets/Sniglets/ChannelEditor.pm
@@ -46,7 +46,6 @@ sub register_callbacks {
$pxt->register_callback('rhn:channel_view_cb' => \&channel_view_cb);
$pxt->register_callback('rhn:channel_edit_cb' => \&channel_edit_cb);
- $pxt->register_callback('rhn:channel_delete_cb' =>
\&channel_delete_cb);
$pxt->register_callback('rhn:update_channel_cache' =>
\&update_channel_cache);
$pxt->register_callback('rhn:clone_channel_cb' =>
\&clone_channel_cb);
}
@@ -85,80 +84,6 @@ sub channel_view_cb {
$pxt->redirect($url);
}
-sub channel_delete_cb {
- my $pxt = shift;
-
- my $cid = $pxt->param('cid') || 0;
-
- die "no channel id"
- unless $cid;
-
- unless ($pxt->user->verify_channel_admin($cid) and
$pxt->user->is('channel_admin')) {
- $pxt->redirect("/errors/permission.pxt");
- }
-
- if (RHN::Channel->children($cid)) {
- $pxt->push_message(local_alert => 'A channel cannot be deleted until all
child channels are deleted.');
- return;
- }
- if (RHN::Channel->distros($cid)) {
- $pxt->push_message(local_alert => 'A channel cannot be deleted until all
associated kickstart distributions are deleted or dissociated.');
- return;
- }
-
-
- my @servers = RHN::Channel->servers($cid);
-
- my $force_unsub = $pxt->dirty_param('force_unsubscribe') || 0;
-
- if (@servers) {
- my $servers_link = $pxt->dirty_param('servers_link');
- throw "param 'servers_link' needed but not provided" unless
$servers_link;
- unless ($force_unsub == 1) {
- $pxt->push_message(local_alert => "There are currently systems
subscribed to this channel. Please confirm system channel removal by selecting the
unsubscribe checkbox.");
- return;
- }
- foreach my $sid(@servers) {
- my $server = RHN::Server->lookup(-id => $sid);
- $server->unsubscribe_from_channel($cid);
- }
- }
-
- my $channel = RHN::Channel->lookup(-id => $cid);
- my $name = $channel->name;
-
- my $ds = new RHN::DataSource::Package(-mode => 'packages_only_in_channel');
- my $orphaned_packages = $ds->execute_query(-cid => $cid, -org_id =>
$pxt->user->org_id);
-
- RHN::ChannelEditor->delete_channel($cid);
-
- foreach my $sid (@servers) {
- RHN::Server->schedule_errata_cache_update($pxt->user->org_id, $sid, 0);
- }
-
- $pxt->push_message(site_info => "Channel <strong>$name</strong>
has been deleted.");
-
- my $redirect_to;
-
- if (@{$orphaned_packages}) {
- $redirect_to = $pxt->dirty_param('orphaned_packages_redirect');
- throw "param 'orphaned_packages_redirect' needed but not provided"
unless $redirect_to;
-
- $redirect_to .= '?view_channel=no_channels';
- my $set = RHN::Set->lookup(-label => 'deletable_package_list', -uid
=> $pxt->user->id);
- $set->empty;
- $set->add(map { $_->{ID} } @{$orphaned_packages});
- $set->commit;
-
- $pxt->push_message(site_info => "The packages selected below were unique
to <strong>$name</strong>, and have now been orphaned. The packages which are
not selected were already orphaned.");
- }
- else {
- $redirect_to = $pxt->dirty_param('redirect_to');
- throw "param 'redirect_to' needed but not provided" unless
$redirect_to;
- }
- $pxt->redirect($redirect_to);
-}
-
sub channel_edit_cb {
my $pxt = shift;