[Spacewalk-devel] spacecmd - new function patch

2013-12-20 Thread Gregor Gruener

Hi spacewalkers,

I've updated the spacecmd package.py file, to add a new function 
package_listdependencies.

Can you review and add this patch upstream.

Cheers,
Gregor Grüner
From 28c227e56f6d3506a0ff97579576d9feeed7850c Mon Sep 17 00:00:00 2001
From: Gregor Gruener ggru...@redhat.com
Date: Fri, 20 Dec 2013 09:33:31 +0100
Subject: [PATCH] added function package_listdependencies

---
 spacecmd/spacecmd.spec  |  3 +++
 spacecmd/src/lib/package.py | 39 +++
 2 files changed, 42 insertions(+)

diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 3b81360..12c9ed3 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -64,6 +64,9 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
 %doc %{_mandir}/man1/spacecmd.1.gz
 
 %changelog
+* Fri Dec 20 2013 Gregor Gruener ggru...@redhat.com 2.1.21-1
+- added function package_listdependencies
+
 * Fri Dec 13 2013 Milan Zazrivec mzazri...@redhat.com 2.1.20-1
 - 1009841 - don't attempt to write out 'None'
 
diff --git a/spacecmd/src/lib/package.py b/spacecmd/src/lib/package.py
index ea2f355..8bbc8a7 100644
--- a/spacecmd/src/lib/package.py
+++ b/spacecmd/src/lib/package.py
@@ -297,4 +297,43 @@ def do_package_listerrata(self, args):
 if len(errata):
 print '\n'.join(sorted([ e.get('advisory') for e in errata ]))
 
+
+
+def help_package_listdependencies(self):
+print 'package_listdependencies: List the dependencies for a package'
+print 'usage: package_listdependencies PACKAGE'
+
+def do_package_listdependencies(self, args):
+(args, options) = parse_arguments(args)
+
+if not len(args):
+self.help_package_listdependencies()
+return
+
+packages = []
+for package in args:
+packages.extend(self.do_package_search(' '.join(args), True))
+
+if not len(packages):
+logging.warning('No packages found')
+return
+
+add_separator = False
+
+for package in packages:
+if add_separator: print self.SEPARATOR
+add_separator = True
+
+package_id = self.get_package_id(package)
+
+if not package_id:
+logging.warning('%s is not a valid package' % package)
+continue
+
+package_id = int(package_id)
+pkgdeps = self.client.packages.list_dependencies(self.session, package_id)
+for dep in pkgdeps:
+print 'Package Name: %s' % package
+print 'Dependency: %s Type: %s Modifier: %s' % (dep['dependency'], dep['dependency_type'], dep['dependency_modifier'])
+
 # vim:ts=4:expandtab:
-- 
1.8.3.1

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

Re: [Spacewalk-devel] RFC: manage bare-metal systems from Spacewalk

2013-12-20 Thread Silvio Moioli
On 12/19/2013 01:44 PM, Michael Mraka wrote:
 So do we need entitle such system at all? Nowadays there can be
 unetitled system in spacewalk. Does bootstrap entitlement brings us
 something more than current unetitled system?

Short answer: yes. Among other things, a bootstrap-entitled system can
be powered back on and provisioned.

Long answer: we use the bootstrap entitlement to distinguish bare-metal
systems from others in the Web UI: they get a different icon, some forms
are disabled where they do not make sense, we added a bare-metal
specific search page, etc.
Basically we want the sysadmin to have an inventory of bare-metal
systems where the only possible operations are:
 - display some hardware details;
 - kickstart;
 - do power management;
 - move between organizations.

Also, we could not find out how to create an activation key without any
entitlement. It seems like both an entitlement and a base channel are
needed in the Web UI, and even with hand-written SQL you need an
entitlement to insert a line in rhnRegTokenEntitlement, otherwise you
get an invalid token.

Server-side error:
rhnServer/server_token.fetch_token('ERROR', Invalid token '1-KEY_NAME')

Client-side error:
Could not find token '1-nokey'
Error Class Code: 60
Error Class Info:
The activation token specified could not be found on the server.
Please retry with a valid key.

 [automatic shutdown...] That's a feature of the boot image, right?

Yes.

 So I could achieve the same with 'poweroff' in post install kickstart script.

I guess so, even though I do not understand why you would want to do that.

Idea is that the boot image is used by default before any kickstart. We
want any new bare-metal system to automatically appear in Spacewalk as
soon as it is connected to the network and powered on, to have it
inventoried and ease a subsequent kickstart.

Because it might take a long time (even months) between inventory and
kickstart, we automatically shut the system down in between.

 Yes, we can't create such boot image in satellite right now. So I'd have
 to create external distribution with memory only image and import it to
 satellite. Then I'd have to create an activation key which asigns no base
 channel and no entitlements to systems. And I'd also have to manage
 kickstart based on this distribution + activation key to be the default
 pxe image. Is it all I need?

I am not sure to understand who I refers to in the above sentences -
is it you as a Spacewalk developer or user?

With this contribution we propose to add a pre-built bootstrap image to
the files installed by Spacewalk, users should not edit it in any way.
This image gets automatically configured as default in Cobbler as soon
as the feature is enabled in the Web UI. Enabling will also create a
user-invisible activation key used by the bootstrap image on bare-metal
systems. That special key will only assign a user-invisible bootstrap
entitlement that, in turn, will be used later used to distinguish such
bare-metal systems visually.

 Just trying to figure out whether we can't achieve the same goal
 somehow easier with the current code...

We obviously also thought hard about this, but could not find out a
simpler alternative. Suggestions are welcome, as always.

Regards,
-- 
Silvio Moioli
SUSE LINUX Products GmbH
Maxfeldstraße 5, 90409 Nürnberg Germany

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

Re: [Spacewalk-devel] spacecmd - new function patch

2013-12-20 Thread Milan Zázrivec
On Friday 20 December 2013 09:39:12 Gregor Gruener wrote:
 Hi spacewalkers,
 
 I've updated the spacecmd package.py file, to add a new function
 package_listdependencies.
 Can you review and add this patch upstream.

Applied in 374d691d0a1b49407ecdf5ba232a4b3d0c6bf927

Thank you for your contribution.

Regards
-Milan Zázrivec

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


Re: [Spacewalk-devel] RFC: manage bare-metal systems from Spacewalk

2013-12-20 Thread Duncan Mac-Vicar P.
On 20/12/13 10:57, Silvio Moioli wrote:
 I guess so, even though I do not understand why you would want to do that.
 
 Idea is that the boot image is used by default before any kickstart. We
 want any new bare-metal system to automatically appear in Spacewalk as
 soon as it is connected to the network and powered on, to have it
 inventoried and ease a subsequent kickstart.

The only purpose of the boot image is to add the necessary intelligence
to a bare-metal system to get out of its state of bare-metal plus some
inventory capabilities.

However, from the user perspective, the machine is empty. It has no OS yet.

-- 
Duncan Mac-Vicar P. - http://www.suse.com/

SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

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

Re: [Spacewalk-devel] [PATCH] Added exception handling so traceback does not occur when wrong password/username is entered

2013-12-20 Thread Milan Zázrivec
On Friday 20 December 2013 11:42:58 Andy Zaugg wrote:
 ---
  .../spacewalk-create-channel/spacewalk-create-channel  | 10
 +- 1 file changed, 9 insertions(+), 1 deletion(-)
 
 diff --git
 a/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
 eate-channel
 b/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
 eate-channel index 1ffbf27..b5f876b 100755
 ---
 a/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
 eate-channel +++
 b/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
 eate-channel @@ -12,6 +12,7 @@ import getopt
  import sys
  import getpass
  from xmlrpclib import Server
 +from xmlrpclib import Fault
  import string
  import os
  from os import path
 @@ -170,7 +171,14 @@ def main():
 client = Server(proto + :// + server + /rpc/api)
 if clone and client.api.getVersion()  5.1:
print --clone cannot be used with a Satellite version older than
 5.1 -   auth = client.auth.login(user, password)
 +   try:
 +  auth = client.auth.login(user, password)
 +   except Fault:
 +  excInfo = sys.exc_info()[1]
 +  print \n %s  % excInfo.faultString
 +  sys.exit(1)
 +
 +
 
 skiplist = []
 if options.skiplist:

Applied in dc1dec14fdc3e377cbda465008535ed81f1898d5

Thank you for your contribution.

Regards
-Milan Zázrivec

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


[Spacewalk-devel] [PATCH] perl List port to new css/markup

2013-12-20 Thread Duncan Mac-Vicar P.

Attached is a first port of the list view to the new CSS markup. I still
have a question though.

https://git.fedorahosted.org/cgit/spacewalk.git/tree/web/modules/sniglets/Sniglets/ListView/Style.pm

The way the styles work is by defining Style:standard with the default
methods and then other styles override this default.

When I look at Sniglets::ListView::Style::standard sub header

I see that package Sniglets::ListView::Style::channel_tree redefines it
exactly in the same way (overrides without changing it). Is it because
of the use of Style::blank below?

package Sniglets::ListView::Style::channel_tree;
use base qw/Sniglets::ListView::Style::blank/;

What is the reason for this?

-- 
Duncan Mac-Vicar P. - http://www.suse.com/

SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

diff --git a/branding/templates/header.pxt b/branding/templates/header.pxt
index d90e605..c567b3a 100644
--- a/branding/templates/header.pxt
+++ b/branding/templates/header.pxt
@@ -21,6 +21,10 @@
 script src=/javascript/bootstrap.js/script
 script src=/javascript/spacewalk-essentials.js/script
 script src=/javascript/spacewalk-checkall.js/script
+
+script src=/rhn/dwr/engine.js/script
+script src=/rhn/dwr/util.js/script
+script src=/rhn/dwr/interface/DWRItemSelector.js/script
   /head
 /pxt-passthrough
 
diff --git a/web/modules/pxt/PXT/HTML.pm b/web/modules/pxt/PXT/HTML.pm
index 7064042..dbde608 100644
--- a/web/modules/pxt/PXT/HTML.pm
+++ b/web/modules/pxt/PXT/HTML.pm
@@ -119,6 +119,7 @@ sub hidden {
 #text(
 #	-name = foo,
 #	-value = foo,
+# -placeholder = foo,
 #	-maxlength = 30,
 #	-size = 15);
 sub text{
@@ -129,7 +130,7 @@ sub text{
 $class-_spew(-text no name given, defaulting to  . $e{-name});
   }
 
-  return $class-_format(\%e,input type=\text\);
+  return $class-_format(\%e,input class=\form-control\ type=\text\);
 }
 
 #file(
@@ -451,6 +452,26 @@ sub link {
   return sprintf qq{a href=%s$css_class$target%s/a}, $url, $label;
 }
 
+sub button {
+  my $class = shift;
+  my $text = shift;
+  my %params = @_;
+
+  if (not exists $params{-name}) {
+die nameless button;
+  }
+
+  my @inner;
+  for my $attr (qw/value type name class/) {
+next unless exists $params{-$attr};
+push @inner, sprintf(qq{$attr=$params{-$attr}});
+  }
+
+  my $inner_str = join( , @inner);
+
+  return qq{button $inner_str$text/button};
+}
+
 sub link2 {
   my $class = shift;
   my %params = validate(@_, { url = 1, text = 0, css = 0, target = 0, params = 0 });
diff --git a/web/modules/sniglets/Sniglets/ListView/List.pm b/web/modules/sniglets/Sniglets/ListView/List.pm
index 47030ce..9732c20 100644
--- a/web/modules/sniglets/Sniglets/ListView/List.pm
+++ b/web/modules/sniglets/Sniglets/ListView/List.pm
@@ -492,6 +492,17 @@ sub render_formvars {
 
 sub render_alphabar {
   my $self = shift;
+  my $pxt = shift;
+  my $content = shift;
+
+  # if there is no alphabar we still need the div there
+  my $template = $self-style-alphabar();
+  $template =~ s/\{alphabar_content\}/$content/;
+  return $template;
+}
+
+sub render_alphabar_content {
+  my $self = shift;
   my $alphabar = shift;
   my $pagesize = shift;
   my $url = shift;
@@ -536,10 +547,12 @@ sub render_filterbox {
 
   throw No 'sort_by' column for mode ' . $self-mode-{__name__} . '\n unless defined $filter_by;
 
-  $ret .= q{div class=filter-input};
-  $ret .= sprintf('Filter by %s: ', $filter_by-name);
+  $ret .= q{div class=spacewalk-list-filter};
+  $ret .= q{div class=input-group input-group-sm};
+
   if ($self-filter_type eq 'text') {
-$ret .= PXT::HTML-text(-name = 'filter_value', -value = PXT::Utils-escapeHTML($self-filter_string || ''), -size = 12);
+$ret .= PXT::HTML-text(-name = 'filter_value', -value = PXT::Utils-escapeHTML($self-filter_string || ''),
+-placeholder = sprintf('Filter by %s: ', $filter_by-name));
 $ret .= PXT::HTML-hidden(-name = 'prev_filter_value', -value = PXT::Utils-escapeHTML($self-filter_string || ''));
   }
   elsif ($self-filter_type eq 'select') {
@@ -554,8 +567,12 @@ sub render_filterbox {
 throw Unknown filter type: ' . $self-filter_type . ';
   }
 
-  $ret .=  ;
-  $ret .= PXT::HTML-submit_image(-src = '/img/button-go.gif', -alt = Filter, -name = filter_list);
+  $ret .= q{div class=input-group-btn};
+  $ret .= PXT::HTML-button(PXT::HTML-icon(-class = 'fa fa-eye') , -type = 'submit', -name = filter_list,
+-class = btn btn-default spacewalk-button-filter);
+  $ret .= q{/div};
+
+  $ret .= q{/div};
   $ret .= q{/div};
 
   return $ret;
@@ -598,26 +615,6 @@ sub render_select_buttons {
   return $block;
 }
 
-sub render_set_info {
-  my $self = shift;
-  my $pxt = shift;
-  my $block = shift;
-  my $pos = shift;
-
-  my $subst = { };
-
-  if ($self-allow_selections($pxt) and $self-{__set__}) {
-my $num_contents = scalar $self-{__set__}-contents;
-

[Spacewalk-devel] [PATCH] Adding a password strength meter to spacewalk

2013-12-20 Thread R P Herrold
On Fri, 20 Dec 2013, Maximilian Meister wrote:

 this patch would add a bootstrapified password strength 
 meter to all pages where user details are being created or 
 edited (create the initial admin user, create/edit normal 
 users and create organization). There is also a tick icon on 
 the side of the password input fields, which checks if the 
 value in the desired password field will be accepted by the 
 server and if the value in the confirm password field 
 matches the value in the desired password field.

This seems to pull in new dependencies, doesn't it?  It is not 
really clear to me that doing passwd strength testing here, 
'one off' per package makes sense, rather than having a 
general interface to query a facility that many packages 
beyond just spacewalk could use

Also, how would this interact with non-local 
authentication interfaces such as LDAP?

-- Russ herrold

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