client/tools
by Jan Pazdziora
client/tools/osad/src/osa_dispatcher.py | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
New commits:
commit 96baa7918f0838f4004ddd988338e2ddbacee979
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Dec 21 20:10:27 2010 +0100
Use params in prepare to support the anonymous PL/pgSQL in PostgreSQL; also use sequence_nextval.
Addressing
2010/12/21 13:06:57 -04:00 24669 0.0.0.0: osad/jabber_lib.main('ERROR', 'Traceback (most recent call last):
File "/usr/share/rhn/osad/jabber_lib.py", line 120, in main
self.fix_connection(c)
File "/usr/share/rhn/osad/osa_dispatcher.py", line 104, in fix_connection
self._register_dispatcher(c.jid, hostname, port)
File "/usr/share/rhn/osad/osa_dispatcher.py", line 252, in _register_dispatcher
h.execute(jabber_id=jabber_id, hostname=hostname, port=port)
File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 166, in execute
return apply(self._execute_wrapper, (self._execute, ) + p, kw)
File "/usr/lib/python2.4/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 263, in _execute_wrapper
raise rhnSQL.SQLStatementPrepareError(0, str(e), self.sql)
SQLStatementPrepareError: (\'syntax error at or near "update" at character 28\
\', 0, \'\
begin\
update rhnPushDispatcher\
set last_checkin = current_timestamp,\
hostname = %(hostname)s,\
port = %(port)s\
where jabber_id = %(jabber_id)s;\
if sql%%rowcount = 0 then\
-- Have to insert the row\
insert into rhnPushDispatcher \
(id, jabber_id, last_checkin, hostname, port)\
values (rhn_pushdispatch_id_seq.nextval, %(jabber_id)s, current_timestamp,\
%(hostname)s, %(port)s);\
end if;\
end;\
\')
')
diff --git a/client/tools/osad/src/osa_dispatcher.py b/client/tools/osad/src/osa_dispatcher.py
index 048e1d5..b914a6d 100644
--- a/client/tools/osad/src/osa_dispatcher.py
+++ b/client/tools/osad/src/osa_dispatcher.py
@@ -231,25 +231,28 @@ class Runner(jabber_lib.Runner):
_query_register_dispatcher = rhnSQL.Statement("""
+ declare
+ i numeric;
begin
update rhnPushDispatcher
set last_checkin = current_timestamp,
- hostname = :hostname,
- port = :port
- where jabber_id = :jabber_id;
- if sql%rowcount = 0 then
+ hostname = :hostname_in,
+ port = :port_in
+ where jabber_id = :jabber_id_in
+ returning id into i;
+ if i is null then
-- Have to insert the row
insert into rhnPushDispatcher
(id, jabber_id, last_checkin, hostname, port)
- values (rhn_pushdispatch_id_seq.nextval, :jabber_id, current_timestamp,
- :hostname, :port);
+ values (sequence_nextval('rhn_pushdispatch_id_seq'), :jabber_id_in, current_timestamp,
+ :hostname_in, :port_in);
end if;
end;
""")
def _register_dispatcher(self, jabber_id, hostname, port):
- h = rhnSQL.prepare(self._query_register_dispatcher)
- h.execute(jabber_id=jabber_id, hostname=hostname, port=port)
+ h = rhnSQL.prepare(self._query_register_dispatcher, params = ( 'hostname_in varchar', 'port_in numeric', 'jabber_id_in varchar' ))
+ h.execute(jabber_id_in=jabber_id, hostname_in=hostname, port_in=port)
rhnSQL.commit()
_query_get_client_jids = rhnSQL.Statement("""
13 years, 4 months
backend/server
by Miroslav Suchý
backend/server/handlers/config_mgmt/rhn_config_management.py | 25 ++++-------
1 file changed, 11 insertions(+), 14 deletions(-)
New commits:
commit 3fcd9f7cf736e8e85994e45d8cd96943ab5a2832
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Dec 21 17:56:28 2010 +0100
use difflib instead of external "diff -u"
diff --git a/backend/server/handlers/config_mgmt/rhn_config_management.py b/backend/server/handlers/config_mgmt/rhn_config_management.py
index 3600658..9a53cb5 100644
--- a/backend/server/handlers/config_mgmt/rhn_config_management.py
+++ b/backend/server/handlers/config_mgmt/rhn_config_management.py
@@ -17,9 +17,8 @@
#
# $Id$
-import os
+import difflib
from spacewalk.common import rhnFault, log_debug
-import tempfile
from spacewalk.server import rhnSQL, configFilesHandler
from spacewalk.common.fileutils import ostr_to_sym
@@ -482,23 +481,22 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
return first_row + "\n" + second_row + "\n"
return ""
- pipe = os.popen("/usr/bin/diff -u %s %s" % (fsrc['filename'],
- fdst['filename']))
- first_row = pipe.readline()
+ diff = difflib.unified_diff(src_content, dst_content, path, path, fsrc['modified'], fdst['modified'], lineterm='')
+ first_row = diff.next()
if not first_row:
return ""
if not first_row.startswith('---'):
# Hmm, weird
- return first_row + pipe.read()
+ return first_row + '\n'.join(list(diff))
- second_row = pipe.readline()
+ second_row = diff.next()
if not second_row.startswith('+++'):
# Hmm, weird
- return second_row + pipe.read()
+ return second_row + '\n'.join(list(diff))
(first_row, second_row) = self.__header(path, fsrc, config_channel_src, fdst, config_channel_dst)
- return first_row + "\n" + second_row + '\n' + pipe.read()
+ return first_row + "\n" + second_row + '\n' + '\n'.join(list(diff))
def _get_file_revision(self, config_channel, revision, path):
if revision and not revision.isdigit():
@@ -521,13 +519,12 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
# seems to be invalid (bug 151220)
# Empty files or directories may have NULL instead of lobs
- fd, f['filename'] = tempfile.mkstemp(prefix = '/tmp/rhncfg-')
fc_lob = f.get('file_contents')
if fc_lob:
- os.write(fd, rhnSQL.read_lob(fc_lob))
- os.close(fd)
- del fc_lob
- return f
+ content = rhnSQL.read_lob(fc_lob).split('\n')
+ else:
+ content = ''
+ return content
# Helper functions
_query_org_config_channels = rhnSQL.Statement("""
13 years, 4 months
Changes to 'refs/tags/spacecmd-1.3.4-1'
by aparsons
Tag 'spacecmd-1.3.4-1' created by Aron Parsons <aparsons(a)redhat.com> at 2010-12-21 16:45 +0000
Tagging package [spacecmd] version [1.3.4-1] in directory [spacecmd/].
Changes since spacewalk-web-1.3.16-1:
Aron Parsons (8):
spacecmd: load all configuration parameters the same way
spacecmd: simplify getting the configuration directory
spacecmd: added support for server-specific sections in the configuration file
spacecmd: added support for a system-wide configuration file
spacecmd: support server-specific configuration sections in the configuration file
spacecmd: add details about configuration files to the man page
spacecmd: man page formatting
Automatic commit of package [spacecmd] release [1.3.4-1].
Miroslav Suchý (3):
move function ostr_to_sym from rhncfgcli_elist to config_common/file_utils
634963 - print diffs for "rhncfg-manager diff-revisions" if we differ in selinux context, ownership or attributes
move function ostr_to_sym from config_common/file_utils to spacewalk-backend-libs
Tomas Lestach (3):
664717 - adding RHEL6 dist channel map translations
664717 - removing unused ks install type translations
642926 - offer correct Channel and Channel Version for child channel errata listings
---
backend/server/handlers/config_mgmt/rhn_config_management.py | 48 +++--
backend/spacewalk/common/fileutils.py | 82 +++++++++
client/tools/rhncfg/config_client/rhncfgcli_elist.py | 86 ----------
client/tools/rhncfg/config_common/file_utils.py | 1
client/tools/rhncfg/rhncfg.spec | 1
java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java | 27 ---
java/code/src/com/redhat/rhn/domain/channel/SelectableChannelVersion.java | 1
java/code/src/com/redhat/rhn/domain/kickstart/KickstartInstallType.java | 1
java/code/src/com/redhat/rhn/frontend/action/channel/manage/AddRedHatErrataAction.java | 6
rel-eng/packages/spacecmd | 2
spacecmd/spacecmd.spec | 11 +
spacecmd/src/bin/spacecmd | 86 ++++------
spacecmd/src/doc/spacecmd.1 | 23 ++
spacecmd/src/lib/misc.py | 76 ++++++--
spacecmd/src/lib/shell.py | 15 -
15 files changed, 257 insertions(+), 209 deletions(-)
---
13 years, 4 months
8 commits - rel-eng/packages spacecmd/spacecmd.spec spacecmd/src
by aparsons
rel-eng/packages/spacecmd | 2 -
spacecmd/spacecmd.spec | 11 +++++
spacecmd/src/bin/spacecmd | 86 +++++++++++++++++++-------------------------
spacecmd/src/doc/spacecmd.1 | 23 +++++++++++
spacecmd/src/lib/misc.py | 76 ++++++++++++++++++++++++++++----------
spacecmd/src/lib/shell.py | 15 +++----
6 files changed, 132 insertions(+), 81 deletions(-)
New commits:
commit 9ea8ad7d3653f76e4ad1d24ce10aab7e31982485
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 11:45:26 2010 -0500
Automatic commit of package [spacecmd] release [1.3.4-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index 6aa975b..a8fec68 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-1.3.3-1 spacecmd/
+1.3.4-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index ff9aa6e..de2b7f9 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 1.3.3
+Version: 1.3.4
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -61,6 +61,11 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Tue Dec 21 2010 Aron Parsons <aparsons(a)redhat.com> 1.3.4-1
+- support server-specific configuration sections in the configuration file
+- added support for a system-wide configuration file
+- added support for server-specific sections in the configuration file
+
* Fri Dec 10 2010 Aron Parsons <aparsons(a)redhat.com> 1.3.3-1
- add support for server UUIDs
commit 045704e991a59ebd7102ed299697aaee353f68aa
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 11:42:35 2010 -0500
spacecmd: man page formatting
diff --git a/spacecmd/src/doc/spacecmd.1 b/spacecmd/src/doc/spacecmd.1
index d6fb5c4..94a451d 100644
--- a/spacecmd/src/doc/spacecmd.1
+++ b/spacecmd/src/doc/spacecmd.1
@@ -63,11 +63,12 @@ print debug messages
show this help message and exit
.fi
.SH CONFIGURATION FILES
-.P
+.nf
Configuration files are loaded from /etc/spacecmd.conf and ~/.spacecmd/config.
The default section is [spacecmd]. It can then be overridden with server
specific sections. Command-line arguments always override options in the
configuration files.
+.fi
.P
.nf
[spacecmd]
commit 08b64cc2042266bf81ea852bc543651426b988e1
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 11:35:59 2010 -0500
spacecmd: add details about configuration files to the man page
diff --git a/spacecmd/src/doc/spacecmd.1 b/spacecmd/src/doc/spacecmd.1
index 49500a6..d6fb5c4 100644
--- a/spacecmd/src/doc/spacecmd.1
+++ b/spacecmd/src/doc/spacecmd.1
@@ -59,8 +59,28 @@ print only error messages
.B \-d, \-\-debug
print debug messages
.TP
-.B \-h, \-\-help
+.B \-h, \-\-help
show this help message and exit
+.fi
+.SH CONFIGURATION FILES
+.P
+Configuration files are loaded from /etc/spacecmd.conf and ~/.spacecmd/config.
+The default section is [spacecmd]. It can then be overridden with server
+specific sections. Command-line arguments always override options in the
+configuration files.
+.P
+.nf
+[spacecmd]
+server=localhost
+username=admin
+password=redhat
+nossl=0
+
+[satellite.example.com]
+username=joe
+password=secret
+nossl=1
+.fi
.SH EXAMPLES
.P
.B Make temporary groups on-the-fly
commit 4f998ffa3d0b8fa3e8d284c53c5f45fa2cd50b81
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 11:25:33 2010 -0500
spacecmd: support server-specific configuration sections in the configuration file
diff --git a/spacecmd/src/bin/spacecmd b/spacecmd/src/bin/spacecmd
index 579b3e7..025fc23 100755
--- a/spacecmd/src/bin/spacecmd
+++ b/spacecmd/src/bin/spacecmd
@@ -81,6 +81,12 @@ if __name__ == '__main__':
# create an instance of the shell
shell = SpacewalkShell(options, conf_dir, config)
+ # set the default server to localhost
+ if shell.options.server:
+ shell.config['server'] = shell.options.server
+ else:
+ shell.config['server'] = 'localhost'
+
# load options from a configuration file
if os.path.isfile(user_conf_file):
files_read = config.read( [ _SYSTEM_CONF_FILE, user_conf_file ] )
@@ -104,10 +110,6 @@ if __name__ == '__main__':
except IOError:
logging.error('Could not create %s' % user_conf_file)
- # set the default server to localhost
- if not shell.options.server:
- shell.options.server = 'localhost'
-
# run a single command from the command line
if len(args):
try:
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index b84f72a..f83d23e 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -189,34 +189,40 @@ def do_login(self, args):
logging.warning('You are already logged in')
return True
- # read the server from the arguments passed
+ # an argument passed to the function get precedence
if len(args) == 2:
server = args[1]
- elif self.options.server:
- server = self.options.server
else:
+ # use the server we were already using
+ server = self.config['server']
+
+ # bail out if not server was given
+ if not server:
logging.warning('No server specified')
return False
- # load the server-specific configuration from disk
- if self.config.has_section(server):
+ # load the server-specific configuration
+ if self.config_parser.has_section(server):
self.load_config_section(server)
- # read the username from the arguments passed
+ # an argument passed to the function get precedence
if len(args):
username = args[0]
- elif self.options.username:
- username = self.options.username
+ elif self.config.has_key('username'):
+ # use the username from before
+ username = self.config['username']
else:
username = ''
- if self.options.nossl:
+ # set the protocol
+ if self.config.has_key('nossl') and self.config['nossl']:
proto = 'http'
else:
proto = 'https'
server_url = '%s://%s/rpc/api' % (proto, server)
+ # this will enable spewing out all client/server traffic
verbose_xmlrpc = False
if self.options.debug > 1:
verbose_xmlrpc = True
@@ -245,7 +251,7 @@ def do_login(self, args):
session_file = os.path.join(self.conf_dir, server, 'session')
# retrieve a cached session
- # (skip this if username and password are provided)
+ # (skip this if username and password are provided on the command line)
if os.path.isfile(session_file) \
and not self.options.username \
and not self.options.password:
@@ -286,14 +292,7 @@ def do_login(self, args):
if len(username):
logging.info('Spacewalk Username: %s' % username)
else:
- if self.options.username:
- username = self.options.username
-
- # remove this from the options so that if 'login' is called
- # again, the user is prompted for the information
- self.options.username = None
- else:
- username = prompt_user('Spacewalk Username:', noblank = True)
+ username = prompt_user('Spacewalk Username:', noblank = True)
if self.options.password:
password = self.options.password
@@ -301,6 +300,8 @@ def do_login(self, args):
# remove this from the options so that if 'login' is called
# again, the user is prompted for the information
self.options.password = None
+ elif self.config.has_key('password'):
+ password = self.config['password']
else:
password = getpass('Spacewalk Password: ')
@@ -879,13 +880,23 @@ def load_config_section(self, section):
logging.debug('Loading configuration section [%s]' % section)
for key in config_opts:
- # command-line arguments take precedence over the config file
- if not self.options.__dict__[key]:
+ # don't override command-line options
+ if self.options.__dict__[key]:
+ # set the config value to the command-line argument
+ self.config[key] = self.options.__dict__[key]
+ else:
try:
- self.options.__dict__[key] = self.config.get(section, key)
+ self.config[key] = self.config_parser.get(section, key)
except NoOptionError:
pass
- logging.debug('Current Configuration: %s' % self.options)
+ # handle the nossl boolean
+ if self.config.has_key('nossl'):
+ if re.match('^1|y|true$', self.config['nossl'], re.I):
+ self.config['nossl'] = True
+ else:
+ self.config['nossl'] = False
+
+ logging.debug('Current Configuration: %s' % self.config)
# vim:ts=4:expandtab:
diff --git a/spacecmd/src/lib/shell.py b/spacecmd/src/lib/shell.py
index 90aa2ff..4c3fa8d 100644
--- a/spacecmd/src/lib/shell.py
+++ b/spacecmd/src/lib/shell.py
@@ -48,11 +48,12 @@ class SpacewalkShell(Cmd):
# do nothing on an empty line
emptyline = lambda self: None
- def __init__(self, options, conf_dir, config):
+ def __init__(self, options, conf_dir, config_parser):
self.session = ''
self.username = ''
self.server = ''
self.ssm = {}
+ self.config = {}
self.postcmd(False, '')
@@ -60,7 +61,7 @@ class SpacewalkShell(Cmd):
self.options = options
# make the configuration file available everywhere
- self.config = config
+ self.config_parser = config_parser
# this is used when loading and saving caches
self.conf_dir = conf_dir
commit c18c8ff35ae89e80083f2beee6fa61b5262bca06
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 10:30:46 2010 -0500
spacecmd: added support for a system-wide configuration file
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 643d85f..ff9aa6e 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -32,6 +32,9 @@ spacecmd is a command-line interface to Spacewalk and Satellite servers
%{__mkdir_p} %{buildroot}/%{_bindir}
%{__install} -p -m0755 src/bin/spacecmd %{buildroot}/%{_bindir}/
+%{__mkdir_p} %{buildroot}/%{_sysconfdir}
+touch %{buildroot}/%{_sysconfdir}/spacecmd.conf
+
%{__mkdir_p} %{buildroot}/%{_sysconfdir}/bash_completion.d
%{__install} -p -m0644 src/misc/spacecmd-bash-completion %{buildroot}/%{_sysconfdir}/bash_completion.d/spacecmd
@@ -51,6 +54,7 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%defattr(-,root,root,-)
%{_bindir}/spacecmd
%{python_sitelib}/spacecmd/
+%ghost %config %{_sysconfdir}/spacecmd.conf
%dir %{_sysconfdir}/bash_completion.d
%{_sysconfdir}/bash_completion.d/spacecmd
%doc src/doc/README src/doc/COPYING
diff --git a/spacecmd/src/bin/spacecmd b/spacecmd/src/bin/spacecmd
index 476d7e1..579b3e7 100755
--- a/spacecmd/src/bin/spacecmd
+++ b/spacecmd/src/bin/spacecmd
@@ -33,6 +33,8 @@ Type: 'help' for a list of commands
'quit' to quit
'''
+_SYSTEM_CONF_FILE = '/etc/spacecmd.conf'
+
if __name__ == '__main__':
optionsTable = [
Option('-u', '--username', action='store',
@@ -71,7 +73,7 @@ if __name__ == '__main__':
# files are loaded from ~/.spacecmd/
conf_dir = os.path.expanduser('~/.spacecmd')
- conf_file = os.path.join(conf_dir, 'config')
+ user_conf_file = os.path.join(conf_dir, 'config')
# server-specifics will be loaded from the configuration file later
config = SafeConfigParser()
@@ -80,8 +82,11 @@ if __name__ == '__main__':
shell = SpacewalkShell(options, conf_dir, config)
# load options from a configuration file
- if os.path.isfile(conf_file):
- config.read(conf_file)
+ if os.path.isfile(user_conf_file):
+ files_read = config.read( [ _SYSTEM_CONF_FILE, user_conf_file ] )
+
+ for item in files_read:
+ logging.debug('Read configuration from %s' % item)
# load the default configuration section
shell.load_config_section('spacecmd')
@@ -93,11 +98,11 @@ if __name__ == '__main__':
os.mkdir(conf_dir, 0700)
# create a template configuration file
- handle = open(conf_file, 'w')
+ handle = open(user_conf_file, 'w')
handle.write('[spacecmd]\n')
handle.close()
except IOError:
- logging.error('Could not create %s' % conf_file)
+ logging.error('Could not create %s' % user_conf_file)
# set the default server to localhost
if not shell.options.server:
commit 5e74c2a9f244f8501925deae987953e08f26dd2d
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 10:23:01 2010 -0500
spacecmd: added support for server-specific sections in the configuration file
diff --git a/spacecmd/src/bin/spacecmd b/spacecmd/src/bin/spacecmd
index b0aadcd..476d7e1 100755
--- a/spacecmd/src/bin/spacecmd
+++ b/spacecmd/src/bin/spacecmd
@@ -57,29 +57,34 @@ if __name__ == '__main__':
parser = OptionParser(option_list=optionsTable, usage=usage)
(options, args) = parser.parse_args()
-
- # enable debugging as early as possible
+
+ # determine the logging level
if options.debug:
level = logging.DEBUG
+ elif options.quiet:
+ level = logging.ERROR
+ else:
+ level = logging.INFO
+
+ # configure logging
+ logging.basicConfig(level=level, format='%(levelname)s: %(message)s')
# files are loaded from ~/.spacecmd/
conf_dir = os.path.expanduser('~/.spacecmd')
conf_file = os.path.join(conf_dir, 'config')
+ # server-specifics will be loaded from the configuration file later
+ config = SafeConfigParser()
+
+ # create an instance of the shell
+ shell = SpacewalkShell(options, conf_dir, config)
+
# load options from a configuration file
if os.path.isfile(conf_file):
- config = SafeConfigParser()
config.read(conf_file)
- config_opts = [ 'server', 'username', 'password', 'nossl' ]
-
- for key in config_opts:
- # command-line arguments take precedence over the config file
- if not options.__dict__[key]:
- try:
- options.__dict__[key] = config.get('spacecmd', key)
- except NoOptionError:
- pass
+ # load the default configuration section
+ shell.load_config_section('spacecmd')
else:
try:
# create ~/.spacecmd
@@ -95,24 +100,8 @@ if __name__ == '__main__':
logging.error('Could not create %s' % conf_file)
# set the default server to localhost
- if not options.server:
- options.server = 'localhost'
-
- # reset the log level after parsing the config file
- if options.debug:
- level = logging.DEBUG
- elif options.quiet:
- level = logging.ERROR
- else:
- level = logging.INFO
-
- logging.basicConfig(level=level, format='%(levelname)s: %(message)s')
-
- # print the configuration that we loaded
- logging.debug('Configuration: %s' % options)
-
- # create an instance of the shell
- shell = SpacewalkShell(options, conf_dir, config)
+ if not shell.options.server:
+ shell.options.server = 'localhost'
# run a single command from the command line
if len(args):
@@ -127,7 +116,7 @@ if __name__ == '__main__':
if isinstance(detail, xmlrpclib.Fault):
detail = detail.faultString
- if options.debug:
+ if shell.options.debug:
# print the traceback when debugging
logging.exception(detail)
else:
@@ -135,7 +124,7 @@ if __name__ == '__main__':
sys.exit(1)
else:
- if not options.quiet:
+ if not shell.options.quiet:
print _INTRO
if not shell.do_login(''):
@@ -158,7 +147,7 @@ if __name__ == '__main__':
if re.search('Could not find session', detail, re.I):
shell.session = ''
- if options.debug:
+ if shell.options.debug:
# print the traceback when debugging
logging.exception(detail)
else:
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index ff76c50..b84f72a 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -20,8 +20,9 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
-import readline
+import logging, readline
from getpass import getpass
+from ConfigParser import NoOptionError
from spacecmd.utils import *
# list of system selection options for the help output
@@ -188,25 +189,31 @@ def do_login(self, args):
logging.warning('You are already logged in')
return True
- if self.options.nossl:
- proto = 'http'
+ # read the server from the arguments passed
+ if len(args) == 2:
+ server = args[1]
+ elif self.options.server:
+ server = self.options.server
else:
- proto = 'https'
+ logging.warning('No server specified')
+ return False
+
+ # load the server-specific configuration from disk
+ if self.config.has_section(server):
+ self.load_config_section(server)
# read the username from the arguments passed
if len(args):
username = args[0]
+ elif self.options.username:
+ username = self.options.username
else:
username = ''
- # read the server from the arguments passed
- if len(args) == 2:
- server = args[1]
- elif self.options.server:
- server = self.options.server
+ if self.options.nossl:
+ proto = 'http'
else:
- logging.warning('No server specified')
- return False
+ proto = 'https'
server_url = '%s://%s/rpc/api' % (proto, server)
@@ -865,4 +872,20 @@ def replace_line_buffer(self, msg = None):
# keep track of what is displayed so we can clear it later
self.current_line = new_line
+
+def load_config_section(self, section):
+ config_opts = [ 'server', 'username', 'password', 'nossl' ]
+
+ logging.debug('Loading configuration section [%s]' % section)
+
+ for key in config_opts:
+ # command-line arguments take precedence over the config file
+ if not self.options.__dict__[key]:
+ try:
+ self.options.__dict__[key] = self.config.get(section, key)
+ except NoOptionError:
+ pass
+
+ logging.debug('Current Configuration: %s' % self.options)
+
# vim:ts=4:expandtab:
commit d7393afa8b57045cc49ee2d602e83f13af82db02
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 09:50:16 2010 -0500
spacecmd: simplify getting the configuration directory
diff --git a/spacecmd/src/bin/spacecmd b/spacecmd/src/bin/spacecmd
index c77728e..b0aadcd 100755
--- a/spacecmd/src/bin/spacecmd
+++ b/spacecmd/src/bin/spacecmd
@@ -24,7 +24,6 @@
import logging, os, re, sys, xmlrpclib
from ConfigParser import SafeConfigParser, NoOptionError
from optparse import Option, OptionParser
-from pwd import getpwuid
from spacecmd.shell import SpacewalkShell
_INTRO = '''Welcome to spacecmd, a command-line interface to Spacewalk.
@@ -64,8 +63,7 @@ if __name__ == '__main__':
level = logging.DEBUG
# files are loaded from ~/.spacecmd/
- userinfo = getpwuid(os.getuid())
- conf_dir = os.path.join(userinfo[5], '.spacecmd')
+ conf_dir = os.path.expanduser('~/.spacecmd')
conf_file = os.path.join(conf_dir, 'config')
# load options from a configuration file
@@ -114,7 +112,7 @@ if __name__ == '__main__':
logging.debug('Configuration: %s' % options)
# create an instance of the shell
- shell = SpacewalkShell(options)
+ shell = SpacewalkShell(options, conf_dir, config)
# run a single command from the command line
if len(args):
diff --git a/spacecmd/src/lib/shell.py b/spacecmd/src/lib/shell.py
index 2ccf4ad..90aa2ff 100644
--- a/spacecmd/src/lib/shell.py
+++ b/spacecmd/src/lib/shell.py
@@ -22,7 +22,6 @@
import atexit, logging, os, readline, re, sys
from cmd import Cmd
-from pwd import getpwuid
from spacecmd.utils import *
class SpacewalkShell(Cmd):
@@ -49,7 +48,7 @@ class SpacewalkShell(Cmd):
# do nothing on an empty line
emptyline = lambda self: None
- def __init__(self, options):
+ def __init__(self, options, conf_dir, config):
self.session = ''
self.username = ''
self.server = ''
@@ -60,14 +59,11 @@ class SpacewalkShell(Cmd):
# make the options available everywhere
self.options = options
- userinfo = getpwuid(os.getuid())
- self.conf_dir = os.path.join(userinfo[5], '.spacecmd')
+ # make the configuration file available everywhere
+ self.config = config
- try:
- if not os.path.isdir(self.conf_dir):
- os.mkdir(self.conf_dir, 0700)
- except OSError:
- logging.error('Could not create directory %s' % self.conf_dir)
+ # this is used when loading and saving caches
+ self.conf_dir = conf_dir
self.history_file = os.path.join(self.conf_dir, 'history')
commit 166485e4ce68ae7629beb388326c2c8e4a7c15ab
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Dec 21 09:28:12 2010 -0500
spacecmd: load all configuration parameters the same way
diff --git a/spacecmd/src/bin/spacecmd b/spacecmd/src/bin/spacecmd
index 0f8d9cf..c77728e 100755
--- a/spacecmd/src/bin/spacecmd
+++ b/spacecmd/src/bin/spacecmd
@@ -73,17 +73,10 @@ if __name__ == '__main__':
config = SafeConfigParser()
config.read(conf_file)
- boolean_opts = [ 'nossl' ]
- string_opts = [ 'server', 'username', 'password' ]
+ config_opts = [ 'server', 'username', 'password', 'nossl' ]
- for key in boolean_opts:
- if not options.__dict__[key]:
- try:
- options.__dict__[key] = config.getboolean('spacecmd', key)
- except NoOptionError:
- pass
-
- for key in string_opts:
+ for key in config_opts:
+ # command-line arguments take precedence over the config file
if not options.__dict__[key]:
try:
options.__dict__[key] = config.get('spacecmd', key)
@@ -117,6 +110,9 @@ if __name__ == '__main__':
logging.basicConfig(level=level, format='%(levelname)s: %(message)s')
+ # print the configuration that we loaded
+ logging.debug('Configuration: %s' % options)
+
# create an instance of the shell
shell = SpacewalkShell(options)
13 years, 4 months
backend/server backend/spacewalk client/tools
by Miroslav Suchý
backend/server/handlers/config_mgmt/rhn_config_management.py | 4
backend/spacewalk/common/fileutils.py | 82 ++++++++++
client/tools/rhncfg/config_client/rhncfgcli_elist.py | 2
client/tools/rhncfg/config_common/file_utils.py | 83 -----------
client/tools/rhncfg/rhncfg.spec | 1
5 files changed, 85 insertions(+), 87 deletions(-)
New commits:
commit 4359de70f79261b4cd0b68b29f758dba683d91a2
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Dec 21 16:58:31 2010 +0100
move function ostr_to_sym from config_common/file_utils to spacewalk-backend-libs
spacewalk-backend-libs is available in both sat channel and tools channes (but rhncfg-commont is not available in both)
diff --git a/backend/server/handlers/config_mgmt/rhn_config_management.py b/backend/server/handlers/config_mgmt/rhn_config_management.py
index 6bd7e15..3600658 100644
--- a/backend/server/handlers/config_mgmt/rhn_config_management.py
+++ b/backend/server/handlers/config_mgmt/rhn_config_management.py
@@ -21,9 +21,7 @@ import os
from spacewalk.common import rhnFault, log_debug
import tempfile
from spacewalk.server import rhnSQL, configFilesHandler
-import sys
-sys.path.append("/usr/share/rhn")
-from config_common.file_utils import ostr_to_sym
+from spacewalk.common.fileutils import ostr_to_sym
class ConfigManagement(configFilesHandler.ConfigFilesHandler):
def __init__(self):
diff --git a/backend/spacewalk/common/fileutils.py b/backend/spacewalk/common/fileutils.py
index 6e3d2ba..6561a23 100644
--- a/backend/spacewalk/common/fileutils.py
+++ b/backend/spacewalk/common/fileutils.py
@@ -22,6 +22,7 @@ import shutil
import string
import subprocess
import select
+import stat
import tempfile
from checksum import getFileChecksum
@@ -375,3 +376,84 @@ def getUidGid(user=None, group=None):
gid = os.getgid()
return uid, gid
+FILETYPE2CHAR = {
+ 'file' : '-',
+ 'directory' : 'd',
+ 'symlink' : 'l',
+ 'chardev' : 'c',
+ 'blockdev' : 'b',
+}
+
+def ostr_to_sym(octstr, ftype):
+ """ Convert filemode in octets (like '644') to string like "ls -l" ("-rwxrw-rw-")
+ ftype is one of: file, directory, symlink, chardev, blockdev.
+ """
+ mode = int(str(octstr), 8)
+
+ symstr = FILETYPE2CHAR.get(ftype, '?')
+
+ if mode & stat.S_IRUSR:
+ symstr += 'r'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IWUSR:
+ symstr += 'w'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IXUSR:
+ if mode & stat.S_ISUID:
+ symstr += 's'
+ else:
+ symstr += 'x'
+ else:
+ if mode & stat.S_ISUID:
+ symstr += 'S'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IRGRP:
+ symstr += 'r'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IWGRP:
+ symstr += 'w'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IXGRP:
+ if mode & stat.S_ISGID:
+ symstr += 's'
+ else:
+ symstr += 'x'
+ else:
+ if mode & stat.S_ISGID:
+ symstr += 'S'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IROTH:
+ symstr += 'r'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IWOTH:
+ symstr += 'w'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IXOTH:
+ if mode & stat.S_ISVTX:
+ symstr += 't'
+ else:
+ symstr += 'x'
+ else:
+ if mode & stat.S_ISVTX:
+ symstr += 'T'
+ else:
+ symstr += '-'
+
+ return symstr
+
diff --git a/client/tools/rhncfg/config_client/rhncfgcli_elist.py b/client/tools/rhncfg/config_client/rhncfgcli_elist.py
index 637c026..2592d38 100755
--- a/client/tools/rhncfg/config_client/rhncfgcli_elist.py
+++ b/client/tools/rhncfg/config_client/rhncfgcli_elist.py
@@ -1,5 +1,5 @@
from config_common.rhn_log import log_debug, die
-from config_common.file_utils import ostr_to_sym
+from spacewalk.common.fileutils import ostr_to_sym
import handler_base, base64
class Handler(handler_base.HandlerBase):
diff --git a/client/tools/rhncfg/config_common/file_utils.py b/client/tools/rhncfg/config_common/file_utils.py
index a129a0e..b22e855 100644
--- a/client/tools/rhncfg/config_common/file_utils.py
+++ b/client/tools/rhncfg/config_common/file_utils.py
@@ -18,7 +18,6 @@ import os.path
import time
import tempfile
import base64
-import stat
try:
from selinux import lgetfilecon
except:
@@ -150,85 +149,3 @@ def maketemp(prefix=None, directory=None):
(fd, filename) = tempfile.mkstemp(prefix=file_prefix, dir=directory)
return filename, dirs_created, os.fdopen(fd, "w+")
-
-
-FILETYPE2CHAR = {
- 'file' : '-',
- 'directory' : 'd',
- 'symlink' : 'l',
- 'chardev' : 'c',
- 'blockdev' : 'b',
-}
-
-def ostr_to_sym(octstr, ftype):
- """ Convert filemode in octets (like '644') to string like "ls -l" ("-rwxrw-rw-")
- ftype is one of: file, directory, symlink, chardev, blockdev.
- """
- mode = int(str(octstr), 8)
-
- symstr = FILETYPE2CHAR.get(ftype, '?')
-
- if mode & stat.S_IRUSR:
- symstr += 'r'
- else:
- symstr += '-'
-
- if mode & stat.S_IWUSR:
- symstr += 'w'
- else:
- symstr += '-'
-
- if mode & stat.S_IXUSR:
- if mode & stat.S_ISUID:
- symstr += 's'
- else:
- symstr += 'x'
- else:
- if mode & stat.S_ISUID:
- symstr += 'S'
- else:
- symstr += '-'
-
- if mode & stat.S_IRGRP:
- symstr += 'r'
- else:
- symstr += '-'
-
- if mode & stat.S_IWGRP:
- symstr += 'w'
- else:
- symstr += '-'
-
- if mode & stat.S_IXGRP:
- if mode & stat.S_ISGID:
- symstr += 's'
- else:
- symstr += 'x'
- else:
- if mode & stat.S_ISGID:
- symstr += 'S'
- else:
- symstr += '-'
-
- if mode & stat.S_IROTH:
- symstr += 'r'
- else:
- symstr += '-'
-
- if mode & stat.S_IWOTH:
- symstr += 'w'
- else:
- symstr += '-'
-
- if mode & stat.S_IXOTH:
- if mode & stat.S_ISVTX:
- symstr += 't'
- else:
- symstr += 'x'
- else:
- if mode & stat.S_ISVTX:
- symstr += 'T'
- else:
- symstr += '-'
-
- return symstr
diff --git a/client/tools/rhncfg/rhncfg.spec b/client/tools/rhncfg/rhncfg.spec
index 16fba8b..5a43fa6 100644
--- a/client/tools/rhncfg/rhncfg.spec
+++ b/client/tools/rhncfg/rhncfg.spec
@@ -31,6 +31,7 @@ The base libraries and functions needed by all rhncfg-* packages.
Summary: Red Hat Network Configuration Client
Group: Applications/System
Requires: %{name} = %{version}-%{release}
+Requires: spacewalk-backend-libs >= 1.3.32-1
%description client
A command line interface to the client features of the RHN Configuration
13 years, 4 months
2 commits - backend/server client/tools
by Miroslav Suchý
backend/server/handlers/config_mgmt/rhn_config_management.py | 50 +++---
client/tools/rhncfg/config_client/rhncfgcli_elist.py | 86 -----------
client/tools/rhncfg/config_common/file_utils.py | 82 ++++++++++
3 files changed, 114 insertions(+), 104 deletions(-)
New commits:
commit ec990a25c6b0ce66dd0e515cd8d0f1d645f45912
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Dec 21 16:30:01 2010 +0100
634963 - print diffs for "rhncfg-manager diff-revisions" if we differ in selinux context, ownership or attributes
diff --git a/backend/server/handlers/config_mgmt/rhn_config_management.py b/backend/server/handlers/config_mgmt/rhn_config_management.py
index 985c6f8..6bd7e15 100644
--- a/backend/server/handlers/config_mgmt/rhn_config_management.py
+++ b/backend/server/handlers/config_mgmt/rhn_config_management.py
@@ -21,6 +21,9 @@ import os
from spacewalk.common import rhnFault, log_debug
import tempfile
from spacewalk.server import rhnSQL, configFilesHandler
+import sys
+sys.path.append("/usr/share/rhn")
+from config_common.file_utils import ostr_to_sym
class ConfigManagement(configFilesHandler.ConfigFilesHandler):
def __init__(self):
@@ -424,6 +427,24 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
return self._get_maximum_file_size()
+ def __attributes_differ(self, fsrc, fdst):
+ """ Returns true if acl, ownership, type or selinux context differ. """
+ return (fsrc['filemode'] != fdst['filemode']) or (fsrc['label'] != fdst['label']) or \
+ (fsrc['username'] != fdst['username']) or (fsrc['groupname'] != fdst['groupname']) or \
+ (fsrc['selinux_ctx'] != fdst['selinux_ctx'])
+
+ def __header(self, path, fsrc, config_channel_src, fdst, config_channel_dst):
+ """ Returns diff like header for this two files. """
+ template = "--- %s\t%s\tattributes: %s %s %s %s\tconfig channel: %s\trevision: %s"
+ first_row = template % (path, f_date(fsrc['modified']), ostr_to_sym(fsrc['filemode'], fsrc['label']),
+ fsrc['username'], fsrc['groupname'], fsrc['selinux_ctx'], config_channel_src,
+ fsrc['revision'],
+ )
+ second_row = template % (path, f_date(fdst['modified']), ostr_to_sym(fdst['filemode'], fdst['label']),
+ fdst['username'], fdst['groupname'], fdst['selinux_ctx'], config_channel_dst,
+ fdst['revision'],
+ )
+ return (first_row, second_row)
def management_diff(self, dict):
log_debug(1)
@@ -454,19 +475,13 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
% (path, fsrc['label'], \
config_channel_src, fdst['label'], config_channel_dst),
explain=0)
- template = "--- %s\t%s\tconfig channel: %s\trevision: %s target: %s \n"
if fsrc['label'] == 'symlink':
- if fsrc["symlink"] != fdst['symlink']:
- first_row = template % (
- path, f_date(fsrc['modified']), config_channel_src,
- fsrc['revision'], fsrc["symlink"],
- )
- second_row = template % (
- path, f_date(fdst['modified']), config_channel_dst,
- fdst['revision'], fdst["symlink"],
- )
- return first_row + second_row
+ if (fsrc["symlink"] != fdst['symlink']) or self.__attributes_differ(fsrc, fdst):
+ (first_row, second_row) = self.__header(path, fsrc, config_channel_src, fdst, config_channel_dst)
+ first_row += ' target: %s' % fsrc["symlink"]
+ second_row += ' target: %s' % fdst["symlink"]
+ return first_row + "\n" + second_row + "\n"
return ""
pipe = os.popen("/usr/bin/diff -u %s %s" % (fsrc['filename'],
@@ -484,17 +499,8 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
# Hmm, weird
return second_row + pipe.read()
- template = "--- %s\t%s\tconfig channel: %s\trevision: %s\n"
-
- first_row = template % (
- path, f_date(fsrc['modified']), config_channel_src,
- fsrc['revision'],
- )
- second_row = template % (
- path, f_date(fdst['modified']), config_channel_dst,
- fdst['revision'],
- )
- return first_row + second_row + pipe.read()
+ (first_row, second_row) = self.__header(path, fsrc, config_channel_src, fdst, config_channel_dst)
+ return first_row + "\n" + second_row + '\n' + pipe.read()
def _get_file_revision(self, config_channel, revision, path):
if revision and not revision.isdigit():
commit b0320c911354e9d4f453ef1b9f143d4fc30fae3a
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Dec 21 13:10:30 2010 +0100
move function ostr_to_sym from rhncfgcli_elist to config_common/file_utils
diff --git a/client/tools/rhncfg/config_client/rhncfgcli_elist.py b/client/tools/rhncfg/config_client/rhncfgcli_elist.py
index 6da4730..637c026 100755
--- a/client/tools/rhncfg/config_client/rhncfgcli_elist.py
+++ b/client/tools/rhncfg/config_client/rhncfgcli_elist.py
@@ -1,86 +1,8 @@
from config_common.rhn_log import log_debug, die
-import handler_base, base64, stat
-
-FILETYPE2CHAR = {
- 'file' : '-',
- 'directory' : 'd',
- 'symlink' : 'l',
- 'chardev' : 'c',
- 'blockdev' : 'b',
-}
+from config_common.file_utils import ostr_to_sym
+import handler_base, base64
class Handler(handler_base.HandlerBase):
- def ostr_to_sym(self, octstr, ftype):
- mode = int(str(octstr), 8)
-
- symstr = FILETYPE2CHAR.get(ftype, '?')
-
- if mode & stat.S_IRUSR:
- symstr += 'r'
- else:
- symstr += '-'
-
- if mode & stat.S_IWUSR:
- symstr += 'w'
- else:
- symstr += '-'
-
- if mode & stat.S_IXUSR:
- if mode & stat.S_ISUID:
- symstr += 's'
- else:
- symstr += 'x'
- else:
- if mode & stat.S_ISUID:
- symstr += 'S'
- else:
- symstr += '-'
-
- if mode & stat.S_IRGRP:
- symstr += 'r'
- else:
- symstr += '-'
-
- if mode & stat.S_IWGRP:
- symstr += 'w'
- else:
- symstr += '-'
-
- if mode & stat.S_IXGRP:
- if mode & stat.S_ISGID:
- symstr += 's'
- else:
- symstr += 'x'
- else:
- if mode & stat.S_ISGID:
- symstr += 'S'
- else:
- symstr += '-'
-
- if mode & stat.S_IROTH:
- symstr += 'r'
- else:
- symstr += '-'
-
- if mode & stat.S_IWOTH:
- symstr += 'w'
- else:
- symstr += '-'
-
- if mode & stat.S_IXOTH:
- if mode & stat.S_ISVTX:
- symstr += 't'
- else:
- symstr += 'x'
- else:
- if mode & stat.S_ISVTX:
- symstr += 'T'
- else:
- symstr += '-'
-
- return symstr
-
-
def run(self):
log_debug(2)
r = self.repository
@@ -106,13 +28,13 @@ class Handler(handler_base.HandlerBase):
fsize = '*' + str(len(finfo['file_contents']))
if finfo['filetype'] == 'symlink':
- permstr = self.ostr_to_sym('777', finfo['filetype'])
+ permstr = ostr_to_sym('777', finfo['filetype'])
dest = "%s -> %s" % (file[1], finfo['symlink'])
fsize = str(len(finfo['symlink']))
finfo['username'] = 'root'
finfo['groupname'] = 'root'
else:
- permstr = self.ostr_to_sym(finfo['filemode'], finfo['filetype']) or ''
+ permstr = ostr_to_sym(finfo['filemode'], finfo['filetype']) or ''
dest = file[1]
print "%10s %8s %-8s %10s %+3s %*s %s" % (permstr, finfo['username'], finfo['groupname'], fsize, finfo['revision'], maxlen, file[0], dest)
diff --git a/client/tools/rhncfg/config_common/file_utils.py b/client/tools/rhncfg/config_common/file_utils.py
index a350a30..a129a0e 100644
--- a/client/tools/rhncfg/config_common/file_utils.py
+++ b/client/tools/rhncfg/config_common/file_utils.py
@@ -18,6 +18,7 @@ import os.path
import time
import tempfile
import base64
+import stat
try:
from selinux import lgetfilecon
except:
@@ -150,3 +151,84 @@ def maketemp(prefix=None, directory=None):
return filename, dirs_created, os.fdopen(fd, "w+")
+
+FILETYPE2CHAR = {
+ 'file' : '-',
+ 'directory' : 'd',
+ 'symlink' : 'l',
+ 'chardev' : 'c',
+ 'blockdev' : 'b',
+}
+
+def ostr_to_sym(octstr, ftype):
+ """ Convert filemode in octets (like '644') to string like "ls -l" ("-rwxrw-rw-")
+ ftype is one of: file, directory, symlink, chardev, blockdev.
+ """
+ mode = int(str(octstr), 8)
+
+ symstr = FILETYPE2CHAR.get(ftype, '?')
+
+ if mode & stat.S_IRUSR:
+ symstr += 'r'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IWUSR:
+ symstr += 'w'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IXUSR:
+ if mode & stat.S_ISUID:
+ symstr += 's'
+ else:
+ symstr += 'x'
+ else:
+ if mode & stat.S_ISUID:
+ symstr += 'S'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IRGRP:
+ symstr += 'r'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IWGRP:
+ symstr += 'w'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IXGRP:
+ if mode & stat.S_ISGID:
+ symstr += 's'
+ else:
+ symstr += 'x'
+ else:
+ if mode & stat.S_ISGID:
+ symstr += 'S'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IROTH:
+ symstr += 'r'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IWOTH:
+ symstr += 'w'
+ else:
+ symstr += '-'
+
+ if mode & stat.S_IXOTH:
+ if mode & stat.S_ISVTX:
+ symstr += 't'
+ else:
+ symstr += 'x'
+ else:
+ if mode & stat.S_ISVTX:
+ symstr += 'T'
+ else:
+ symstr += '-'
+
+ return symstr
13 years, 4 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/frontend/action/channel/manage/AddRedHatErrataAction.java | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit a3cb77008d980b7c3e35f6e3a2bf151cca142915
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Tue Dec 21 16:07:07 2010 +0100
642926 - offer correct Channel and Channel Version for child channel errata listings
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/AddRedHatErrataAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/AddRedHatErrataAction.java
index 78da685..140fa73 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/AddRedHatErrataAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/AddRedHatErrataAction.java
@@ -142,6 +142,12 @@ public class AddRedHatErrataAction extends RhnListAction {
selectedChannel = original;
selectedChannelStr = selectedChannel.getId().toString();
String tmp = findVersionFromChannel(selectedChannel);
+ if (tmp == null) {
+ // if we haven't found channel version, let's try to check its parent
+ if (!selectedChannel.isBaseChannel()) {
+ tmp = findVersionFromChannel(selectedChannel.getParentChannel());
+ }
+ }
if (tmp != null) {
selectedVersionStr = tmp;
}
13 years, 4 months
2 commits - java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java | 27 +---------
java/code/src/com/redhat/rhn/domain/channel/SelectableChannelVersion.java | 1
java/code/src/com/redhat/rhn/domain/kickstart/KickstartInstallType.java | 1
3 files changed, 6 insertions(+), 23 deletions(-)
New commits:
commit 71a4da00136ccbbbf60c5fe6cef4ffe702a233c5
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Tue Dec 21 12:10:44 2010 +0100
664717 - removing unused ks install type translations
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java b/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java
index 9bb97a7..c7d4381 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java
@@ -14,8 +14,6 @@
*/
package com.redhat.rhn.domain.channel;
-import com.redhat.rhn.domain.kickstart.KickstartInstallType;
-
import java.util.HashMap;
import java.util.Map;
@@ -91,17 +89,6 @@ public class ChannelVersion {
DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("2.1WS", ChannelVersion.RHEL21);
DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("2.1AW", ChannelVersion.RHEL21);
DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("2.1ASDE", ChannelVersion.RHEL21);
-
- KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.put(KickstartInstallType.RHEL_21,
- ChannelVersion.RHEL21);
- KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.put(KickstartInstallType.RHEL_3,
- ChannelVersion.RHEL3);
- KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.put(KickstartInstallType.RHEL_4,
- ChannelVersion.RHEL4);
- KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.put(KickstartInstallType.RHEL_5,
- ChannelVersion.RHEL5);
- KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.put(KickstartInstallType.RHEL_6,
- ChannelVersion.RHEL6);
}
/**
@@ -114,18 +101,6 @@ public class ChannelVersion {
}
/**
- * Returns the channel version constant for the given kickstart install
- * type, based on it's label and the contents of a static mapping.
- * @param type KickstartInstallType to lookup channel version for.
- * @return ChannelVersion for this KickstartInstallType.
- */
- public static ChannelVersion getChannelVersionForKickstartInstallType(
- KickstartInstallType type) {
- return (ChannelVersion)KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.get(
- type.getLabel());
- }
-
- /**
* Returns the channel version constant for the given DistChannelMap,
* based on the map's release and a static mapping.
* @param dcm DistChannel map to lookup channel version for.
commit 7a805f04794aff3f63fe12b3608c33b317497ec0
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Tue Dec 21 10:47:25 2010 +0100
664717 - adding RHEL6 dist channel map translations
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java b/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java
index 1a30436..9bb97a7 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelVersion.java
@@ -50,6 +50,10 @@ public class ChannelVersion {
public static final Map DIST_CHANNEL_MAP_TO_CHANNEL_VERSION = new HashMap();
static {
+ DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("6Client", ChannelVersion.RHEL6);
+ DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("6Server", ChannelVersion.RHEL6);
+ DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("6Workstation", ChannelVersion.RHEL6);
+
DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("5Client", ChannelVersion.RHEL5);
DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("5Server", ChannelVersion.RHEL5);
DIST_CHANNEL_MAP_TO_CHANNEL_VERSION.put("4.92Client", ChannelVersion.RHEL5);
@@ -96,6 +100,8 @@ public class ChannelVersion {
ChannelVersion.RHEL4);
KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.put(KickstartInstallType.RHEL_5,
ChannelVersion.RHEL5);
+ KICKSTART_INSTALL_TYPE_TO_CHANNEL_VERSION.put(KickstartInstallType.RHEL_6,
+ ChannelVersion.RHEL6);
}
/**
diff --git a/java/code/src/com/redhat/rhn/domain/channel/SelectableChannelVersion.java b/java/code/src/com/redhat/rhn/domain/channel/SelectableChannelVersion.java
index 5b44e0f..9714a77 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/SelectableChannelVersion.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/SelectableChannelVersion.java
@@ -102,6 +102,7 @@ public class SelectableChannelVersion implements Selectable {
*/
public static List<SelectableChannelVersion> getCurrentChannelVersionList() {
List currentList = new ArrayList<ChannelVersion>();
+ currentList.add(new SelectableChannelVersion(ChannelVersion.RHEL6));
currentList.add(new SelectableChannelVersion(ChannelVersion.RHEL5));
currentList.add(new SelectableChannelVersion(ChannelVersion.RHEL4));
currentList.add(new SelectableChannelVersion(ChannelVersion.RHEL3));
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartInstallType.java b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartInstallType.java
index 947c9f5..a3f613a 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartInstallType.java
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartInstallType.java
@@ -28,6 +28,7 @@ public class KickstartInstallType extends BaseDomainHelper {
public static final String RHEL_3 = "rhel_3";
public static final String RHEL_4 = "rhel_4";
public static final String RHEL_5 = "rhel_5";
+ public static final String RHEL_6 = "rhel_6";
public static final String FEDORA = "fedora";
public static final String GENERIC = "generic";
13 years, 4 months
Changes to 'refs/tags/spacewalk-web-1.3.16-1'
by Michael Mraka
Tag 'spacewalk-web-1.3.16-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2010-12-21 13:31 +0000
Tagging package [spacewalk-web] version [1.3.16-1] in directory [web/].
Changes since spacewalk-backend-1.3.31-1:
Michael Mraka (2):
664487 - fixed space report query
Automatic commit of package [spacewalk-web] release [1.3.16-1].
Tomas Lestach (2):
removing rhnlib from server comps
putting back temporary rhnlib for fedora13 comps
---
rel-eng/comps/comps-spacewalk-server-fedora14.xml | 1
rel-eng/comps/comps-spacewalk-server-rhel5.xml | 1
rel-eng/comps/comps-spacewalk-server-rhel6.xml | 1
rel-eng/packages/spacewalk-web | 2 -
web/modules/dobby/Dobby/Reporting.pm | 42 +++++++++-------------
web/spacewalk-web.spec | 6 ++-
6 files changed, 25 insertions(+), 28 deletions(-)
---
13 years, 4 months
rel-eng/packages web/spacewalk-web.spec
by Michael Mraka
rel-eng/packages/spacewalk-web | 2 +-
web/spacewalk-web.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit d14a6c331ffc203a23c9f4070ea7acedd7b0b685
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Dec 21 14:31:57 2010 +0100
Automatic commit of package [spacewalk-web] release [1.3.16-1].
diff --git a/rel-eng/packages/spacewalk-web b/rel-eng/packages/spacewalk-web
index f59c360..6010190 100644
--- a/rel-eng/packages/spacewalk-web
+++ b/rel-eng/packages/spacewalk-web
@@ -1 +1 @@
-1.3.15-1 web/
+1.3.16-1 web/
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 1e564f6..0f07d4f 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -2,7 +2,7 @@ Name: spacewalk-web
Summary: Spacewalk Web site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.3.15
+Version: 1.3.16
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -256,6 +256,10 @@ rm -rf $RPM_BUILD_ROOT
# $Id$
%changelog
+* Tue Dec 21 2010 Michael Mraka <michael.mraka(a)redhat.com> 1.3.16-1
+- 664487 - fixed space report query
+- fixed prototype-*.js reference
+
* Fri Dec 17 2010 Jan Pazdziora 1.3.15-1
- 656963 - the script has to start with #!/bin/sh.
- 656963 - move "Generate jabberd config file" script to correct activity
13 years, 4 months